1

(1 replies, posted in wolfSSL)

Hey, I'm not sure if this is the right place to post bugs and such, but I've had a few issues while using WolfSSL.



The first one is defined in line 150 of wolfio.h

    #define close(s) closesocket(s)

It defines close as closesockets, which in turn causes compilation issues when I'm using std::ofstream::close for closing down files in projects which use WolfSSL. The preprocessor makes it std::ofstream::closesockets, which doesn't exist.

I could of course undefine it, but it would be preferred to have this implemented in another way, or maybe I'm just using it wrong?




The 2nd thing I've noticed is while using Hmac. Running the code below will crash for me:

//#Define WOLFSSL_SHA512

#include <wolfssl/wolfcrypt/hmac.h>

void Sha256()
{
    Hmac        hmac;

    byte        key[24];

    byte        buffer[2048];

    byte        hmacDigest[SHA256_DIGEST_SIZE];

    wc_HmacSetKey(&hmac, SHA256, key, sizeof(key));
    wc_HmacUpdate(&hmac, buffer, sizeof(buffer));

    wc_HmacFinal(&hmac, hmacDigest);

    return;
}

int main()
{
    Sha256();

    return 0;
}

It crashes with the error: "Run time check failure #2 - Stack around the variable 'hmac' was corrupted".

However if I uncomment the "#Define WOLFSSL_SHA512" the code will run perfectly fine, which I find odd since I wouldn't think i had to define for Sha512 to be able to run Sha256.

If it makes any difference I'm compiling this on windows 10 using Visual Studio 2017, and Version 3.13.0 of WolfSSL.