Merge pull request #5307 from kareem-wolfssl/miscfixes2

Fix a couple of STM32 bugs, and add some missing mutex frees.
This commit is contained in:
David Garske
2022-07-01 09:46:22 -07:00
committed by GitHub
4 changed files with 19 additions and 9 deletions

View File

@@ -548,7 +548,7 @@ static int ServerMemRecv(info_t* info, char* buf, int sz)
}
osSemaphoreAcquire(info->server.mutex, osWaitForever);
#else
if (osSignalWait(1, RECV_WAIT_TIMEOUT) == osEventTimeout) {
if (osSignalWait(1, RECV_WAIT_TIMEOUT).status == osEventTimeout) {
printf("Server Recv: Timeout!\n");
return WOLFSSL_CBIO_ERR_TIMEOUT;
}
@@ -644,7 +644,7 @@ static int ClientMemRecv(info_t* info, char* buf, int sz)
}
osSemaphoreAcquire(info->client.mutex, osWaitForever);
#else
if (osSignalWait(1, RECV_WAIT_TIMEOUT) == osEventTimeout) {
if (osSignalWait(1, RECV_WAIT_TIMEOUT).status == osEventTimeout) {
printf("Client Recv: Timeout!\n");
return WOLFSSL_CBIO_ERR_TIMEOUT;
}

View File

@@ -6164,6 +6164,10 @@ void wolfSSL_DH_free(WOLFSSL_DH* dh)
return;
}
#ifndef SINGLE_THREADED
wc_FreeMutex(&dh->refMutex);
#endif
if (dh->internal) {
wc_FreeDhKey((DhKey*)dh->internal);
XFREE(dh->internal, NULL, DYNAMIC_TYPE_DH);
@@ -8330,6 +8334,10 @@ void wolfSSL_EC_KEY_free(WOLFSSL_EC_KEY *key)
return;
}
#ifndef SINGLE_THREADED
wc_FreeMutex(&key->refMutex);
#endif
if (key->internal != NULL) {
wc_ecc_free((ecc_key*)key->internal);
XFREE(key->internal, heap, DYNAMIC_TYPE_ECC);

View File

@@ -2051,6 +2051,8 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
}
}
HAL_RNG_DeInit(&hrng);
wolfSSL_CryptHwMutexUnLock();
return 0;

View File

@@ -823,13 +823,13 @@ typedef struct w64wrapper {
#endif
#endif /* !NO_FILESYSTEM && !NO_STDIO_FILESYSTEM */
#ifndef CTYPE_USER
#ifndef WOLFSSL_LINUXKM
#include <ctype.h>
#endif
#if defined(HAVE_ECC) || defined(HAVE_OCSP) || \
defined(WOLFSSL_KEY_GEN) || !defined(NO_DSA) || \
defined(OPENSSL_EXTRA)
#ifndef CTYPE_USER
#ifndef WOLFSSL_LINUXKM
#include <ctype.h>
#endif
#if defined(HAVE_ECC) || defined(HAVE_OCSP) || \
defined(WOLFSSL_KEY_GEN) || !defined(NO_DSA) || \
defined(OPENSSL_EXTRA)
#define XTOUPPER(c) toupper((c))
#endif
#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)