Merge pull request #585 from NickolasLapp/master

Rename *Mutex Functions with wc_ prefix. Expose these functions for Stunnel.
This commit is contained in:
toddouska
2016-10-12 11:19:32 -07:00
committed by GitHub
23 changed files with 354 additions and 311 deletions
+17 -17
View File
@@ -65,7 +65,7 @@ int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
return BAD_COND_E;
}
#endif
if (InitMutex(&crl->crlLock) != 0) {
if (wc_InitMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("Init Mutex failed");
return BAD_MUTEX_E;
}
@@ -144,7 +144,7 @@ void FreeCRL(WOLFSSL_CRL* crl, int dynamic)
}
pthread_cond_destroy(&crl->cond);
#endif
FreeMutex(&crl->crlLock);
wc_FreeMutex(&crl->crlLock);
if (dynamic) /* free self */
XFREE(crl, crl->heap, DYNAMIC_TYPE_CRL);
}
@@ -159,8 +159,8 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
WOLFSSL_ENTER("CheckCertCRL");
if (LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("LockMutex failed");
if (wc_LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("wc_LockMutex failed");
return BAD_MUTEX_E;
}
@@ -203,7 +203,7 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
}
}
UnLockMutex(&crl->crlLock);
wc_UnLockMutex(&crl->crlLock);
if (foundEntry == 0) {
WOLFSSL_MSG("Couldn't find CRL for status check");
@@ -248,15 +248,15 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
return -1;
}
if (LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("LockMutex failed");
if (wc_LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("wc_LockMutex failed");
FreeCRL_Entry(crle, crl->heap);
XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
return BAD_MUTEX_E;
}
crle->next = crl->crlList;
crl->crlList = crle;
UnLockMutex(&crl->crlLock);
wc_UnLockMutex(&crl->crlLock);
return 0;
}
@@ -337,15 +337,15 @@ static int SignalSetup(WOLFSSL_CRL* crl, int status)
int ret;
/* signal to calling thread we're setup */
if (LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("LockMutex crlLock failed");
if (wc_LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("wc_LockMutex crlLock failed");
return BAD_MUTEX_E;
}
crl->setup = status;
ret = pthread_cond_signal(&crl->cond);
UnLockMutex(&crl->crlLock);
wc_UnLockMutex(&crl->crlLock);
if (ret != 0)
return BAD_COND_E;
@@ -403,8 +403,8 @@ static int SwapLists(WOLFSSL_CRL* crl)
}
}
if (LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("LockMutex failed");
if (wc_LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("wc_LockMutex failed");
FreeCRL(tmp, 0);
#ifdef WOLFSSL_SMALL_STACK
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
@@ -418,7 +418,7 @@ static int SwapLists(WOLFSSL_CRL* crl)
tmp->crlList = crl->crlList;
crl->crlList = newList;
UnLockMutex(&crl->crlLock);
wc_UnLockMutex(&crl->crlLock);
FreeCRL(tmp, 0);
@@ -747,8 +747,8 @@ static int StartMonitorCRL(WOLFSSL_CRL* crl)
}
/* wait for setup to complete */
if (LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("LockMutex crlLock error");
if (wc_LockMutex(&crl->crlLock) != 0) {
WOLFSSL_MSG("wc_LockMutex crlLock error");
return BAD_MUTEX_E;
}
@@ -762,7 +762,7 @@ static int StartMonitorCRL(WOLFSSL_CRL* crl)
if (crl->setup < 0)
ret = crl->setup; /* store setup error */
UnLockMutex(&crl->crlLock);
wc_UnLockMutex(&crl->crlLock);
if (ret < 0) {
WOLFSSL_MSG("DoMonitor setup failure");
+29 -29
View File
@@ -313,12 +313,12 @@ static word32 GetEntropy(unsigned char* out, word32 num_bytes)
if ((rngMutex = (wolfSSL_Mutex*)XMALLOC(sizeof(wolfSSL_Mutex), 0,
DYNAMIC_TYPE_TLSX)) == NULL)
return DRBG_OUT_OF_MEMORY;
InitMutex(rngMutex);
wc_InitMutex(rngMutex);
}
ret |= LockMutex(rngMutex);
ret |= wc_LockMutex(rngMutex);
ret |= wc_RNG_GenerateBlock(rng, out, num_bytes);
ret |= UnLockMutex(rngMutex);
ret |= wc_UnLockMutex(rngMutex);
if (ret != 0)
return DRBG_ENTROPY_FAIL;
@@ -1334,7 +1334,7 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
ctx->timeout = WOLFSSL_SESSION_TIMEOUT;
ctx->minDowngrade = TLSv1_MINOR; /* current default */
if (InitMutex(&ctx->countMutex) < 0) {
if (wc_InitMutex(&ctx->countMutex) < 0) {
WOLFSSL_MSG("Mutex error on CTX init");
ctx->err = CTX_INIT_MUTEX_E;
return BAD_MUTEX_E;
@@ -1498,7 +1498,7 @@ void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
if (ctx->heap != (void*)WOLFSSL_HEAP_TEST) {
#endif
WOLFSSL_HEAP_HINT* hint = (WOLFSSL_HEAP_HINT*)(ctx->heap);
FreeMutex(&((WOLFSSL_HEAP*)(hint->memory))->memory_mutex);
wc_FreeMutex(&((WOLFSSL_HEAP*)(hint->memory))->memory_mutex);
#ifdef WOLFSSL_HEAP_TEST
}
#endif
@@ -1511,7 +1511,7 @@ void FreeSSL_Ctx(WOLFSSL_CTX* ctx)
{
int doFree = 0;
if (LockMutex(&ctx->countMutex) != 0) {
if (wc_LockMutex(&ctx->countMutex) != 0) {
WOLFSSL_MSG("Couldn't lock count mutex");
/* check error state, if mutex error code then mutex init failed but
@@ -1525,12 +1525,12 @@ void FreeSSL_Ctx(WOLFSSL_CTX* ctx)
ctx->refCount--;
if (ctx->refCount == 0)
doFree = 1;
UnLockMutex(&ctx->countMutex);
wc_UnLockMutex(&ctx->countMutex);
if (doFree) {
WOLFSSL_MSG("CTX ref count down to 0, doing full free");
SSL_CtxResourceFree(ctx);
FreeMutex(&ctx->countMutex);
wc_FreeMutex(&ctx->countMutex);
XFREE(ctx, ctx->heap, DYNAMIC_TYPE_CTX);
}
else {
@@ -3117,12 +3117,12 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
}
/* increment CTX reference count */
if (LockMutex(&ctx->countMutex) != 0) {
if (wc_LockMutex(&ctx->countMutex) != 0) {
WOLFSSL_MSG("Couldn't lock CTX count mutex");
return BAD_MUTEX_E;
}
ctx->refCount++;
UnLockMutex(&ctx->countMutex);
wc_UnLockMutex(&ctx->countMutex);
ssl->ctx = ctx; /* only for passing to calls, options could change */
ssl->version = ctx->method->version;
@@ -3271,7 +3271,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
ctx_hint = ((WOLFSSL_HEAP_HINT*)(ctx->heap));
/* lock and check IO count / handshake count */
if (LockMutex(&(ctx_hint->memory->memory_mutex)) != 0) {
if (wc_LockMutex(&(ctx_hint->memory->memory_mutex)) != 0) {
WOLFSSL_MSG("Bad memory_mutex lock");
XFREE(ssl->heap, ctx->heap, DYNAMIC_TYPE_SSL);
ssl->heap = NULL; /* free and set to NULL for IO counter */
@@ -3280,7 +3280,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
if (ctx_hint->memory->maxHa > 0 &&
ctx_hint->memory->maxHa <= ctx_hint->memory->curHa) {
WOLFSSL_MSG("At max number of handshakes for static memory");
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
XFREE(ssl->heap, ctx->heap, DYNAMIC_TYPE_SSL);
ssl->heap = NULL; /* free and set to NULL for IO counter */
return MEMORY_E;
@@ -3289,7 +3289,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
if (ctx_hint->memory->maxIO > 0 &&
ctx_hint->memory->maxIO <= ctx_hint->memory->curIO) {
WOLFSSL_MSG("At max number of IO allowed for static memory");
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
XFREE(ssl->heap, ctx->heap, DYNAMIC_TYPE_SSL);
ssl->heap = NULL; /* free and set to NULL for IO counter */
return MEMORY_E;
@@ -3298,7 +3298,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
ctx_hint->memory->curHa++;
ssl_hint->memory = ctx_hint->memory;
ssl_hint->haFlag = 1;
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
/* check if tracking stats */
if (ctx_hint->memory->flag & WOLFMEM_TRACK_STATS) {
@@ -3312,24 +3312,24 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
/* check if using fixed IO buffers */
if (ctx_hint->memory->flag & WOLFMEM_IO_POOL_FIXED) {
if (LockMutex(&(ctx_hint->memory->memory_mutex)) != 0) {
if (wc_LockMutex(&(ctx_hint->memory->memory_mutex)) != 0) {
WOLFSSL_MSG("Bad memory_mutex lock");
return BAD_MUTEX_E;
}
if (SetFixedIO(ctx_hint->memory, &(ssl_hint->inBuf)) != 1) {
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
return MEMORY_E;
}
if (SetFixedIO(ctx_hint->memory, &(ssl_hint->outBuf)) != 1) {
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
return MEMORY_E;
}
if (ssl_hint->outBuf == NULL || ssl_hint->inBuf == NULL) {
WOLFSSL_MSG("Not enough memory to create fixed IO buffers");
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
return MEMORY_E;
}
UnLockMutex(&(ctx_hint->memory->memory_mutex));
wc_UnLockMutex(&(ctx_hint->memory->memory_mutex));
}
#ifdef WOLFSSL_HEAP_TEST
}
@@ -3724,7 +3724,7 @@ void SSL_ResourceFree(WOLFSSL* ssl)
WOLFSSL_HEAP* ctx_heap;
ctx_heap = ssl_hint->memory;
if (LockMutex(&(ctx_heap->memory_mutex)) != 0) {
if (wc_LockMutex(&(ctx_heap->memory_mutex)) != 0) {
WOLFSSL_MSG("Bad memory_mutex lock");
}
ctx_heap->curIO--;
@@ -3737,7 +3737,7 @@ void SSL_ResourceFree(WOLFSSL* ssl)
if (ssl_hint->haFlag) { /* check if handshake count has been decreased*/
ctx_heap->curHa--;
}
UnLockMutex(&(ctx_heap->memory_mutex));
wc_UnLockMutex(&(ctx_heap->memory_mutex));
/* check if tracking stats */
if (ctx_heap->flag & WOLFMEM_TRACK_STATS) {
@@ -3910,12 +3910,12 @@ void FreeHandshakeResources(WOLFSSL* ssl)
WOLFSSL_HEAP* ctx_heap;
ctx_heap = ssl_hint->memory;
if (LockMutex(&(ctx_heap->memory_mutex)) != 0) {
if (wc_LockMutex(&(ctx_heap->memory_mutex)) != 0) {
WOLFSSL_MSG("Bad memory_mutex lock");
}
ctx_heap->curHa--;
ssl_hint->haFlag = 0; /* set to zero since handshake has been dec */
UnLockMutex(&(ctx_heap->memory_mutex));
wc_UnLockMutex(&(ctx_heap->memory_mutex));
#ifdef WOLFSSL_HEAP_TEST
}
#endif
@@ -10708,11 +10708,11 @@ int SendCertificateStatus(WOLFSSL* ssl)
if (ret != 0) {
XFREE(request, ssl->heap, DYNAMIC_TYPE_OCSP_REQUEST);
}
else if (!ssl->buffers.weOwnCert && 0 == LockMutex(
else if (!ssl->buffers.weOwnCert && 0 == wc_LockMutex(
&ssl->ctx->cm->ocsp_stapling->ocspLock)) {
if (!ssl->ctx->certOcspRequest)
ssl->ctx->certOcspRequest = request;
UnLockMutex(&ssl->ctx->cm->ocsp_stapling->ocspLock);
wc_UnLockMutex(&ssl->ctx->cm->ocsp_stapling->ocspLock);
}
}
@@ -10805,12 +10805,12 @@ int SendCertificateStatus(WOLFSSL* ssl)
if (ret != 0) {
XFREE(request, ssl->heap, DYNAMIC_TYPE_OCSP_REQUEST);
}
else if (!ssl->buffers.weOwnCert && 0 == LockMutex(
else if (!ssl->buffers.weOwnCert && 0 == wc_LockMutex(
&ssl->ctx->cm->ocsp_stapling->ocspLock)) {
if (!ssl->ctx->certOcspRequest)
ssl->ctx->certOcspRequest = request;
UnLockMutex(&ssl->ctx->cm->ocsp_stapling->ocspLock);
wc_UnLockMutex(&ssl->ctx->cm->ocsp_stapling->ocspLock);
}
}
@@ -10885,12 +10885,12 @@ int SendCertificateStatus(WOLFSSL* ssl)
break;
}
else if (!ssl->buffers.weOwnCertChain && 0 ==
LockMutex(
wc_LockMutex(
&ssl->ctx->cm->ocsp_stapling->ocspLock)) {
if (!ssl->ctx->chainOcspRequest[i])
ssl->ctx->chainOcspRequest[i] = request;
UnLockMutex(
wc_UnLockMutex(
&ssl->ctx->cm->ocsp_stapling->ocspLock);
}
+8 -8
View File
@@ -49,7 +49,7 @@ int InitOCSP(WOLFSSL_OCSP* ocsp, WOLFSSL_CERT_MANAGER* cm)
ForceZero(ocsp, sizeof(WOLFSSL_OCSP));
if (InitMutex(&ocsp->ocspLock) != 0)
if (wc_InitMutex(&ocsp->ocspLock) != 0)
return BAD_MUTEX_E;
ocsp->cm = cm;
@@ -102,7 +102,7 @@ void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
XFREE(entry, ocsp->cm->heap, DYNAMIC_TYPE_OCSP_ENTRY);
}
FreeMutex(&ocsp->ocspLock);
wc_FreeMutex(&ocsp->ocspLock);
if (dynamic)
XFREE(ocsp, ocsp->cm->heap, DYNAMIC_TYPE_OCSP);
@@ -167,7 +167,7 @@ static int GetOcspEntry(WOLFSSL_OCSP* ocsp, OcspRequest* request,
*entry = NULL;
if (LockMutex(&ocsp->ocspLock) != 0) {
if (wc_LockMutex(&ocsp->ocspLock) != 0) {
WOLFSSL_LEAVE("CheckCertOCSP", BAD_MUTEX_E);
return BAD_MUTEX_E;
}
@@ -189,7 +189,7 @@ static int GetOcspEntry(WOLFSSL_OCSP* ocsp, OcspRequest* request,
}
}
UnLockMutex(&ocsp->ocspLock);
wc_UnLockMutex(&ocsp->ocspLock);
return *entry ? 0 : MEMORY_ERROR;
}
@@ -204,7 +204,7 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
*status = NULL;
if (LockMutex(&ocsp->ocspLock) != 0) {
if (wc_LockMutex(&ocsp->ocspLock) != 0) {
WOLFSSL_LEAVE("CheckCertOCSP", BAD_MUTEX_E);
return BAD_MUTEX_E;
}
@@ -239,7 +239,7 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
}
}
UnLockMutex(&ocsp->ocspLock);
wc_UnLockMutex(&ocsp->ocspLock);
return ret;
}
@@ -346,7 +346,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
ret = xstat2err(ocspResponse->status->status);
if (LockMutex(&ocsp->ocspLock) != 0)
if (wc_LockMutex(&ocsp->ocspLock) != 0)
ret = BAD_MUTEX_E;
else {
if (status != NULL) {
@@ -383,7 +383,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
}
}
UnLockMutex(&ocsp->ocspLock);
wc_UnLockMutex(&ocsp->ocspLock);
}
}
else
+41 -41
View File
@@ -411,9 +411,9 @@ static word32 MissedDataSessions = 0; /* # of sessions with missed data */
static void UpdateMissedDataSessions(void)
{
LockMutex(&RecoveryMutex);
wc_LockMutex(&RecoveryMutex);
MissedDataSessions += 1;
UnLockMutex(&RecoveryMutex);
wc_UnLockMutex(&RecoveryMutex);
}
@@ -421,9 +421,9 @@ static void UpdateMissedDataSessions(void)
void ssl_InitSniffer(void)
{
wolfSSL_Init();
InitMutex(&ServerListMutex);
InitMutex(&SessionMutex);
InitMutex(&RecoveryMutex);
wc_InitMutex(&ServerListMutex);
wc_InitMutex(&SessionMutex);
wc_InitMutex(&RecoveryMutex);
}
@@ -461,10 +461,10 @@ static void FreeSnifferServer(SnifferServer* srv)
{
if (srv) {
#ifdef HAVE_SNI
LockMutex(&srv->namedKeysMutex);
wc_LockMutex(&srv->namedKeysMutex);
FreeNamedKeyList(srv->namedKeys);
UnLockMutex(&srv->namedKeysMutex);
FreeMutex(&srv->namedKeysMutex);
wc_UnLockMutex(&srv->namedKeysMutex);
wc_FreeMutex(&srv->namedKeysMutex);
#endif
SSL_CTX_free(srv->ctx);
}
@@ -526,8 +526,8 @@ void ssl_FreeSniffer(void)
SnifferSession* removeSession;
int i;
LockMutex(&ServerListMutex);
LockMutex(&SessionMutex);
wc_LockMutex(&ServerListMutex);
wc_LockMutex(&SessionMutex);
srv = ServerList;
while (srv) {
@@ -545,12 +545,12 @@ void ssl_FreeSniffer(void)
}
}
UnLockMutex(&SessionMutex);
UnLockMutex(&ServerListMutex);
wc_UnLockMutex(&SessionMutex);
wc_UnLockMutex(&ServerListMutex);
FreeMutex(&RecoveryMutex);
FreeMutex(&SessionMutex);
FreeMutex(&ServerListMutex);
wc_FreeMutex(&RecoveryMutex);
wc_FreeMutex(&SessionMutex);
wc_FreeMutex(&ServerListMutex);
if (TraceFile) {
TraceOn = 0;
@@ -656,7 +656,7 @@ static void InitSnifferServer(SnifferServer* sniffer)
sniffer->port = 0;
#ifdef HAVE_SNI
sniffer->namedKeys = 0;
InitMutex(&sniffer->namedKeysMutex);
wc_InitMutex(&sniffer->namedKeysMutex);
#endif
sniffer->next = 0;
}
@@ -1040,7 +1040,7 @@ static int IsServerRegistered(word32 addr)
int ret = 0; /* false */
SnifferServer* sniffer;
LockMutex(&ServerListMutex);
wc_LockMutex(&ServerListMutex);
sniffer = ServerList;
while (sniffer) {
@@ -1051,7 +1051,7 @@ static int IsServerRegistered(word32 addr)
sniffer = sniffer->next;
}
UnLockMutex(&ServerListMutex);
wc_UnLockMutex(&ServerListMutex);
return ret;
}
@@ -1064,7 +1064,7 @@ static int IsPortRegistered(word32 port)
int ret = 0; /* false */
SnifferServer* sniffer;
LockMutex(&ServerListMutex);
wc_LockMutex(&ServerListMutex);
sniffer = ServerList;
while (sniffer) {
@@ -1075,7 +1075,7 @@ static int IsPortRegistered(word32 port)
sniffer = sniffer->next;
}
UnLockMutex(&ServerListMutex);
wc_UnLockMutex(&ServerListMutex);
return ret;
}
@@ -1086,7 +1086,7 @@ static SnifferServer* GetSnifferServer(IpInfo* ipInfo, TcpInfo* tcpInfo)
{
SnifferServer* sniffer;
LockMutex(&ServerListMutex);
wc_LockMutex(&ServerListMutex);
sniffer = ServerList;
while (sniffer) {
@@ -1097,7 +1097,7 @@ static SnifferServer* GetSnifferServer(IpInfo* ipInfo, TcpInfo* tcpInfo)
sniffer = sniffer->next;
}
UnLockMutex(&ServerListMutex);
wc_UnLockMutex(&ServerListMutex);
return sniffer;
}
@@ -1122,7 +1122,7 @@ static SnifferSession* GetSnifferSession(IpInfo* ipInfo, TcpInfo* tcpInfo)
assert(row <= HASH_SIZE);
LockMutex(&SessionMutex);
wc_LockMutex(&SessionMutex);
session = SessionTable[row];
while (session) {
@@ -1141,7 +1141,7 @@ static SnifferSession* GetSnifferSession(IpInfo* ipInfo, TcpInfo* tcpInfo)
if (session)
session->lastUsed= currTime; /* keep session alive, remove stale will */
/* leave alone */
UnLockMutex(&SessionMutex);
wc_UnLockMutex(&SessionMutex);
/* determine side */
if (session) {
@@ -1315,10 +1315,10 @@ static int SetNamedPrivateKey(const char* name, const char* address, int port,
}
#ifdef HAVE_SNI
else {
LockMutex(&sniffer->namedKeysMutex);
wc_LockMutex(&sniffer->namedKeysMutex);
namedKey->next = sniffer->namedKeys;
sniffer->namedKeys = namedKey;
UnLockMutex(&sniffer->namedKeysMutex);
wc_UnLockMutex(&sniffer->namedKeysMutex);
}
#endif
@@ -1345,10 +1345,10 @@ int ssl_SetNamedPrivateKey(const char* name,
TraceHeader();
TraceSetNamedServer(name, address, port, keyFile);
LockMutex(&ServerListMutex);
wc_LockMutex(&ServerListMutex);
ret = SetNamedPrivateKey(name, address, port, keyFile,
typeKey, password, error);
UnLockMutex(&ServerListMutex);
wc_UnLockMutex(&ServerListMutex);
if (ret == 0)
Trace(NEW_SERVER_STR);
@@ -1369,10 +1369,10 @@ int ssl_SetPrivateKey(const char* address, int port, const char* keyFile,
TraceHeader();
TraceSetServer(address, port, keyFile);
LockMutex(&ServerListMutex);
wc_LockMutex(&ServerListMutex);
ret = SetNamedPrivateKey(NULL, address, port, keyFile,
typeKey, password, error);
UnLockMutex(&ServerListMutex);
wc_UnLockMutex(&ServerListMutex);
if (ret == 0)
Trace(NEW_SERVER_STR);
@@ -1824,7 +1824,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
if (nameSz >= sizeof(name))
nameSz = sizeof(name) - 1;
name[nameSz] = 0;
LockMutex(&session->context->namedKeysMutex);
wc_LockMutex(&session->context->namedKeysMutex);
namedKey = session->context->namedKeys;
while (namedKey != NULL) {
if (nameSz == namedKey->nameSz &&
@@ -1832,7 +1832,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
if (wolfSSL_use_PrivateKey_buffer(session->sslServer,
namedKey->key, namedKey->keySz,
SSL_FILETYPE_ASN1) != SSL_SUCCESS) {
UnLockMutex(&session->context->namedKeysMutex);
wc_UnLockMutex(&session->context->namedKeysMutex);
SetError(CLIENT_HELLO_LATE_KEY_STR, error, session,
FATAL_ERROR_STATE);
return -1;
@@ -1842,7 +1842,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
else
namedKey = namedKey->next;
}
UnLockMutex(&session->context->namedKeysMutex);
wc_UnLockMutex(&session->context->namedKeysMutex);
}
}
#endif
@@ -2296,7 +2296,7 @@ static void RemoveSession(SnifferSession* session, IpInfo* ipInfo,
Trace(REMOVE_SESSION_STR);
if (!haveLock)
LockMutex(&SessionMutex);
wc_LockMutex(&SessionMutex);
current = SessionTable[row];
@@ -2315,7 +2315,7 @@ static void RemoveSession(SnifferSession* session, IpInfo* ipInfo,
}
if (!haveLock)
UnLockMutex(&SessionMutex);
wc_UnLockMutex(&SessionMutex);
}
@@ -2406,7 +2406,7 @@ static SnifferSession* CreateSession(IpInfo* ipInfo, TcpInfo* tcpInfo,
row = SessionHash(ipInfo, tcpInfo);
/* add it to the session table */
LockMutex(&SessionMutex);
wc_LockMutex(&SessionMutex);
session->next = SessionTable[row];
SessionTable[row] = session;
@@ -2418,7 +2418,7 @@ static SnifferSession* CreateSession(IpInfo* ipInfo, TcpInfo* tcpInfo,
RemoveStaleSessions();
}
UnLockMutex(&SessionMutex);
wc_UnLockMutex(&SessionMutex);
/* determine headed side */
if (ipInfo->dst == session->context->server &&
@@ -3562,9 +3562,9 @@ int ssl_GetSessionStats(unsigned int* active, unsigned int* total,
int ret;
if (missedData) {
LockMutex(&RecoveryMutex);
wc_LockMutex(&RecoveryMutex);
*missedData = MissedDataSessions;
UnLockMutex(&RecoveryMutex);
wc_UnLockMutex(&RecoveryMutex);
}
if (reassemblyMem) {
@@ -3572,7 +3572,7 @@ int ssl_GetSessionStats(unsigned int* active, unsigned int* total,
int i;
*reassemblyMem = 0;
LockMutex(&SessionMutex);
wc_LockMutex(&SessionMutex);
for (i = 0; i < HASH_SIZE; i++) {
session = SessionTable[i];
while (session) {
@@ -3581,7 +3581,7 @@ int ssl_GetSessionStats(unsigned int* active, unsigned int* total,
session = session->next;
}
}
UnLockMutex(&SessionMutex);
wc_UnLockMutex(&SessionMutex);
}
ret = wolfSSL_get_session_stats(active, total, peak, maxSessions);
+70 -68
View File
@@ -2270,14 +2270,14 @@ WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew_ex(void* heap)
if (cm) {
XMEMSET(cm, 0, sizeof(WOLFSSL_CERT_MANAGER));
if (InitMutex(&cm->caLock) != 0) {
if (wc_InitMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("Bad mutex init");
wolfSSL_CertManagerFree(cm);
return NULL;
}
#ifdef WOLFSSL_TRUST_PEER_CERT
if (InitMutex(&cm->tpLock) != 0) {
if (wc_InitMutex(&cm->tpLock) != 0) {
WOLFSSL_MSG("Bad mutex init");
wolfSSL_CertManagerFree(cm);
return NULL;
@@ -2323,11 +2323,11 @@ void wolfSSL_CertManagerFree(WOLFSSL_CERT_MANAGER* cm)
#endif
#endif
FreeSignerTable(cm->caTable, CA_TABLE_SIZE, cm->heap);
FreeMutex(&cm->caLock);
wc_FreeMutex(&cm->caLock);
#ifdef WOLFSSL_TRUST_PEER_CERT
FreeTrustedPeerTable(cm->tpTable, TP_TABLE_SIZE, cm->heap);
FreeMutex(&cm->tpLock);
wc_FreeMutex(&cm->tpLock);
#endif
XFREE(cm, cm->heap, DYNAMIC_TYPE_CERT_MANAGER);
@@ -2344,12 +2344,12 @@ int wolfSSL_CertManagerUnloadCAs(WOLFSSL_CERT_MANAGER* cm)
if (cm == NULL)
return BAD_FUNC_ARG;
if (LockMutex(&cm->caLock) != 0)
if (wc_LockMutex(&cm->caLock) != 0)
return BAD_MUTEX_E;
FreeSignerTable(cm->caTable, CA_TABLE_SIZE, NULL);
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return SSL_SUCCESS;
@@ -2364,12 +2364,12 @@ int wolfSSL_CertManagerUnload_trust_peers(WOLFSSL_CERT_MANAGER* cm)
if (cm == NULL)
return BAD_FUNC_ARG;
if (LockMutex(&cm->tpLock) != 0)
if (wc_LockMutex(&cm->tpLock) != 0)
return BAD_MUTEX_E;
FreeTrustedPeerTable(cm->tpTable, TP_TABLE_SIZE, NULL);
UnLockMutex(&cm->tpLock);
wc_UnLockMutex(&cm->tpLock);
return SSL_SUCCESS;
@@ -2777,7 +2777,7 @@ int AlreadySigner(WOLFSSL_CERT_MANAGER* cm, byte* hash)
int ret = 0;
word32 row = HashSigner(hash);
if (LockMutex(&cm->caLock) != 0)
if (wc_LockMutex(&cm->caLock) != 0)
return ret;
signers = cm->caTable[row];
while (signers) {
@@ -2793,7 +2793,7 @@ int AlreadySigner(WOLFSSL_CERT_MANAGER* cm, byte* hash)
}
signers = signers->next;
}
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return ret;
}
@@ -2813,7 +2813,7 @@ int AlreadyTrustedPeer(WOLFSSL_CERT_MANAGER* cm, byte* hash)
int ret = 0;
word32 row = TrustedPeerHashSigner(hash);
if (LockMutex(&cm->tpLock) != 0)
if (wc_LockMutex(&cm->tpLock) != 0)
return ret;
tp = cm->tpTable[row];
while (tp) {
@@ -2829,7 +2829,7 @@ int AlreadyTrustedPeer(WOLFSSL_CERT_MANAGER* cm, byte* hash)
}
tp = tp->next;
}
UnLockMutex(&cm->tpLock);
wc_UnLockMutex(&cm->tpLock);
return ret;
}
@@ -2850,7 +2850,7 @@ TrustedPeerCert* GetTrustedPeer(void* vp, byte* hash, int type)
row = TrustedPeerHashSigner(hash);
if (LockMutex(&cm->tpLock) != 0)
if (wc_LockMutex(&cm->tpLock) != 0)
return ret;
tp = cm->tpTable[row];
@@ -2867,7 +2867,7 @@ TrustedPeerCert* GetTrustedPeer(void* vp, byte* hash, int type)
break;
default:
WOLFSSL_MSG("Unknown search type");
UnLockMutex(&cm->tpLock);
wc_UnLockMutex(&cm->tpLock);
return NULL;
}
if (XMEMCMP(hash, subjectHash, SIGNER_DIGEST_SIZE) == 0) {
@@ -2876,7 +2876,7 @@ TrustedPeerCert* GetTrustedPeer(void* vp, byte* hash, int type)
}
tp = tp->next;
}
UnLockMutex(&cm->tpLock);
wc_UnLockMutex(&cm->tpLock);
return ret;
}
@@ -2916,7 +2916,7 @@ Signer* GetCA(void* vp, byte* hash)
if (cm == NULL)
return NULL;
if (LockMutex(&cm->caLock) != 0)
if (wc_LockMutex(&cm->caLock) != 0)
return ret;
signers = cm->caTable[row];
@@ -2933,7 +2933,7 @@ Signer* GetCA(void* vp, byte* hash)
}
signers = signers->next;
}
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return ret;
}
@@ -2951,7 +2951,7 @@ Signer* GetCAByName(void* vp, byte* hash)
if (cm == NULL)
return NULL;
if (LockMutex(&cm->caLock) != 0)
if (wc_LockMutex(&cm->caLock) != 0)
return ret;
for (row = 0; row < CA_TABLE_SIZE && ret == NULL; row++) {
@@ -2964,7 +2964,7 @@ Signer* GetCAByName(void* vp, byte* hash)
signers = signers->next;
}
}
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return ret;
}
@@ -3072,10 +3072,10 @@ int AddTrustedPeer(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int verify)
row = TrustedPeerHashSigner(peerCert->subjectNameHash);
#endif
if (LockMutex(&cm->tpLock) == 0) {
if (wc_LockMutex(&cm->tpLock) == 0) {
peerCert->next = cm->tpTable[row];
cm->tpTable[row] = peerCert; /* takes ownership */
UnLockMutex(&cm->tpLock);
wc_UnLockMutex(&cm->tpLock);
}
else {
WOLFSSL_MSG(" Trusted Peer Cert Mutex Lock failed");
@@ -3218,10 +3218,10 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
row = HashSigner(signer->subjectNameHash);
#endif
if (LockMutex(&cm->caLock) == 0) {
if (wc_LockMutex(&cm->caLock) == 0) {
signer->next = cm->caTable[row];
cm->caTable[row] = signer; /* takes ownership */
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
if (cm->caCacheCallback)
cm->caCacheCallback(der->buffer, (int)der->length, type);
}
@@ -3331,24 +3331,24 @@ int wolfSSL_Init(void)
return WC_INIT_E;
}
#ifndef NO_SESSION_CACHE
if (InitMutex(&session_mutex) != 0) {
if (wc_InitMutex(&session_mutex) != 0) {
WOLFSSL_MSG("Bad Init Mutex session");
return BAD_MUTEX_E;
}
#endif
if (InitMutex(&count_mutex) != 0) {
if (wc_InitMutex(&count_mutex) != 0) {
WOLFSSL_MSG("Bad Init Mutex count");
return BAD_MUTEX_E;
}
}
if (LockMutex(&count_mutex) != 0) {
if (wc_LockMutex(&count_mutex) != 0) {
WOLFSSL_MSG("Bad Lock Mutex count");
return BAD_MUTEX_E;
}
initRefCount++;
UnLockMutex(&count_mutex);
wc_UnLockMutex(&count_mutex);
return SSL_SUCCESS;
}
@@ -5956,7 +5956,7 @@ int wolfSSL_memsave_session_cache(void* mem, int sz)
cache_header.sessionSz = (int)sizeof(WOLFSSL_SESSION);
XMEMCPY(mem, &cache_header, sizeof(cache_header));
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
WOLFSSL_MSG("Session cache mutex lock failed");
return BAD_MUTEX_E;
}
@@ -5970,7 +5970,7 @@ int wolfSSL_memsave_session_cache(void* mem, int sz)
XMEMCPY(clRow++, ClientCache + i, sizeof(ClientRow));
#endif
UnLockMutex(&session_mutex);
wc_UnLockMutex(&session_mutex);
WOLFSSL_LEAVE("wolfSSL_memsave_session_cache", SSL_SUCCESS);
@@ -6005,7 +6005,7 @@ int wolfSSL_memrestore_session_cache(const void* mem, int sz)
return CACHE_MATCH_ERROR;
}
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
WOLFSSL_MSG("Session cache mutex lock failed");
return BAD_MUTEX_E;
}
@@ -6019,7 +6019,7 @@ int wolfSSL_memrestore_session_cache(const void* mem, int sz)
XMEMCPY(ClientCache + i, clRow++, sizeof(ClientRow));
#endif
UnLockMutex(&session_mutex);
wc_UnLockMutex(&session_mutex);
WOLFSSL_LEAVE("wolfSSL_memrestore_session_cache", SSL_SUCCESS);
@@ -6058,7 +6058,7 @@ int wolfSSL_save_session_cache(const char *fname)
return FWRITE_ERROR;
}
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
WOLFSSL_MSG("Session cache mutex lock failed");
XFCLOSE(file);
return BAD_MUTEX_E;
@@ -6086,7 +6086,7 @@ int wolfSSL_save_session_cache(const char *fname)
}
#endif /* NO_CLIENT_CACHE */
UnLockMutex(&session_mutex);
wc_UnLockMutex(&session_mutex);
XFCLOSE(file);
WOLFSSL_LEAVE("wolfSSL_save_session_cache", rc);
@@ -6129,7 +6129,7 @@ int wolfSSL_restore_session_cache(const char *fname)
return CACHE_MATCH_ERROR;
}
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
WOLFSSL_MSG("Session cache mutex lock failed");
XFCLOSE(file);
return BAD_MUTEX_E;
@@ -6160,7 +6160,7 @@ int wolfSSL_restore_session_cache(const char *fname)
#endif /* NO_CLIENT_CACHE */
UnLockMutex(&session_mutex);
wc_UnLockMutex(&session_mutex);
XFCLOSE(file);
WOLFSSL_LEAVE("wolfSSL_restore_session_cache", rc);
@@ -6497,8 +6497,8 @@ int CM_SaveCertCache(WOLFSSL_CERT_MANAGER* cm, const char* fname)
return SSL_BAD_FILE;
}
if (LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("LockMutex on caLock failed");
if (wc_LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("wc_LockMutex on caLock failed");
XFCLOSE(file);
return BAD_MUTEX_E;
}
@@ -6520,7 +6520,7 @@ int CM_SaveCertCache(WOLFSSL_CERT_MANAGER* cm, const char* fname)
XFREE(mem, cm->heap, DYNAMIC_TYPE_TMP_BUFFER);
}
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
XFCLOSE(file);
return rc;
@@ -6588,8 +6588,8 @@ int CM_MemSaveCertCache(WOLFSSL_CERT_MANAGER* cm, void* mem, int sz, int* used)
WOLFSSL_ENTER("CM_MemSaveCertCache");
if (LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("LockMutex on caLock failed");
if (wc_LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("wc_LockMutex on caLock failed");
return BAD_MUTEX_E;
}
@@ -6597,7 +6597,7 @@ int CM_MemSaveCertCache(WOLFSSL_CERT_MANAGER* cm, void* mem, int sz, int* used)
if (ret == SSL_SUCCESS)
*used = GetCertCacheMemSize(cm);
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return ret;
}
@@ -6627,8 +6627,8 @@ int CM_MemRestoreCertCache(WOLFSSL_CERT_MANAGER* cm, const void* mem, int sz)
return CACHE_MATCH_ERROR;
}
if (LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("LockMutex on caLock failed");
if (wc_LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("wc_LockMutex on caLock failed");
return BAD_MUTEX_E;
}
@@ -6644,7 +6644,7 @@ int CM_MemRestoreCertCache(WOLFSSL_CERT_MANAGER* cm, const void* mem, int sz)
current += added;
}
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return ret;
}
@@ -6657,14 +6657,14 @@ int CM_GetCertCacheMemSize(WOLFSSL_CERT_MANAGER* cm)
WOLFSSL_ENTER("CM_GetCertCacheMemSize");
if (LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("LockMutex on caLock failed");
if (wc_LockMutex(&cm->caLock) != 0) {
WOLFSSL_MSG("wc_LockMutex on caLock failed");
return BAD_MUTEX_E;
}
sz = GetCertCacheMemSize(cm);
UnLockMutex(&cm->caLock);
wc_UnLockMutex(&cm->caLock);
return sz;
}
@@ -7514,7 +7514,7 @@ int wolfSSL_Cleanup(void)
if (initRefCount == 0)
return ret; /* possibly no init yet, but not failure either way */
if (LockMutex(&count_mutex) != 0) {
if (wc_LockMutex(&count_mutex) != 0) {
WOLFSSL_MSG("Bad Lock Mutex count");
return BAD_MUTEX_E;
}
@@ -7523,16 +7523,16 @@ int wolfSSL_Cleanup(void)
if (initRefCount < 0)
initRefCount = 0;
UnLockMutex(&count_mutex);
wc_UnLockMutex(&count_mutex);
if (!release)
return ret;
#ifndef NO_SESSION_CACHE
if (FreeMutex(&session_mutex) != 0)
if (wc_FreeMutex(&session_mutex) != 0)
ret = BAD_MUTEX_E;
#endif
if (FreeMutex(&count_mutex) != 0)
if (wc_FreeMutex(&count_mutex) != 0)
ret = BAD_MUTEX_E;
#if defined(HAVE_ECC) && defined(FP_ECC)
@@ -7620,7 +7620,7 @@ WOLFSSL_SESSION* GetSessionClient(WOLFSSL* ssl, const byte* id, int len)
return NULL;
}
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
WOLFSSL_MSG("Lock session mutex failed");
return NULL;
}
@@ -7657,7 +7657,7 @@ WOLFSSL_SESSION* GetSessionClient(WOLFSSL* ssl, const byte* id, int len)
}
}
UnLockMutex(&session_mutex);
wc_UnLockMutex(&session_mutex);
return ret;
}
@@ -7699,7 +7699,7 @@ WOLFSSL_SESSION* GetSession(WOLFSSL* ssl, byte* masterSecret,
return NULL;
}
if (LockMutex(&session_mutex) != 0)
if (wc_LockMutex(&session_mutex) != 0)
return 0;
/* start from most recently used */
@@ -7744,7 +7744,7 @@ WOLFSSL_SESSION* GetSession(WOLFSSL* ssl, byte* masterSecret,
}
}
UnLockMutex(&session_mutex);
wc_UnLockMutex(&session_mutex);
return ret;
}
@@ -7774,7 +7774,7 @@ static int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom)
}
#endif
if (LockMutex(&session_mutex) != 0)
if (wc_LockMutex(&session_mutex) != 0)
return BAD_MUTEX_E;
#ifdef HAVE_SESSION_TICKET
@@ -7791,7 +7791,7 @@ static int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom)
copyInto->isDynamic = 0;
#endif
if (UnLockMutex(&session_mutex) != 0) {
if (wc_UnLockMutex(&session_mutex) != 0) {
return BAD_MUTEX_E;
}
@@ -7803,7 +7803,7 @@ static int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom)
if (!tmpBuff)
return MEMORY_ERROR;
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
XFREE(tmpBuff, ssl->heap, DYNAMIC_TYPE_SESSION_TICK);
return BAD_MUTEX_E;
}
@@ -7825,7 +7825,7 @@ static int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom)
copyInto->ticket = copyInto->staticTicket;
}
if (UnLockMutex(&session_mutex) != 0) {
if (wc_UnLockMutex(&session_mutex) != 0) {
if (ret == SSL_SUCCESS)
ret = BAD_MUTEX_E;
}
@@ -7907,7 +7907,7 @@ int AddSession(WOLFSSL* ssl)
}
#endif
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
#ifdef HAVE_SESSION_TICKET
XFREE(tmpBuff, ssl->heap, DYNAMIC_TYPE_SESSION_TICK);
#endif
@@ -8033,7 +8033,7 @@ int AddSession(WOLFSSL* ssl)
}
#endif /* defined(WOLFSSL_SESSION_STATS) && defined(WOLFSSL_PEAK_SESSIONS) */
if (UnLockMutex(&session_mutex) != 0)
if (wc_UnLockMutex(&session_mutex) != 0)
return BAD_MUTEX_E;
return error;
@@ -8059,7 +8059,7 @@ int wolfSSL_GetSessionAtIndex(int idx, WOLFSSL_SESSION* session)
row = idx >> SESSIDX_ROW_SHIFT;
col = idx & SESSIDX_IDX_MASK;
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
return BAD_MUTEX_E;
}
@@ -8070,7 +8070,7 @@ int wolfSSL_GetSessionAtIndex(int idx, WOLFSSL_SESSION* session)
result = SSL_SUCCESS;
}
if (UnLockMutex(&session_mutex) != 0)
if (wc_UnLockMutex(&session_mutex) != 0)
result = BAD_MUTEX_E;
WOLFSSL_LEAVE("wolfSSL_GetSessionAtIndex", result);
@@ -8174,13 +8174,13 @@ int wolfSSL_get_session_stats(word32* active, word32* total, word32* peak,
if (active == NULL && total == NULL && peak == NULL)
return BAD_FUNC_ARG;
if (LockMutex(&session_mutex) != 0) {
if (wc_LockMutex(&session_mutex) != 0) {
return BAD_MUTEX_E;
}
result = get_locked_session_stats(active, total, peak);
if (UnLockMutex(&session_mutex) != 0)
if (wc_UnLockMutex(&session_mutex) != 0)
result = BAD_MUTEX_E;
WOLFSSL_LEAVE("wolfSSL_get_session_stats", result);
@@ -13964,6 +13964,7 @@ static void InitwolfSSL_DH(WOLFSSL_DH* dh)
if (dh) {
dh->p = NULL;
dh->g = NULL;
dh->q = NULL;
dh->pub_key = NULL;
dh->priv_key = NULL;
dh->internal = NULL;
@@ -14016,6 +14017,7 @@ void wolfSSL_DH_free(WOLFSSL_DH* dh)
wolfSSL_BN_free(dh->pub_key);
wolfSSL_BN_free(dh->g);
wolfSSL_BN_free(dh->p);
wolfSSL_BN_free(dh->q);
InitwolfSSL_DH(dh); /* set back to NULLs for safety */
XFREE(dh, NULL, DYNAMIC_TYPE_DH);
@@ -17959,7 +17961,7 @@ void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl)
#ifdef OPENSSL_EXTRA /*Lighttp compatibility*/
#if defined(HAVE_LIGHTY) || defined(WOLFSSL_MYSQL_COMPATIBLE)
#if defined(HAVE_LIGHTY) || defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(HAVE_STUNNEL)
unsigned char *wolfSSL_SHA1(const unsigned char *d, size_t n, unsigned char *md)
{
@@ -18149,7 +18151,7 @@ void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl)
return NULL;
}
#endif /* HAVE_LIGHTY || WOLFSSL_MYSQL_COMPATIBLE */
#endif /* HAVE_LIGHTY || WOLFSSL_MYSQL_COMPATIBLE || HAVE_STUNNEL */
#endif
@@ -18556,7 +18558,7 @@ int wolfSSL_get_state(const WOLFSSL* ssl)
}
void* wolfSSL_sk_X509_NAME_value(STACK_OF(WOLFSSL_X509_NAME)* sk, int i)
void* wolfSSL_sk_X509_NAME_value(const STACK_OF(WOLFSSL_X509_NAME)* sk, int i)
{
(void)sk;
(void)i;
+3 -3
View File
@@ -4234,12 +4234,12 @@ static word32 GetEntropy(unsigned char* out, word32 num_bytes)
if ((rngMutex = (wolfSSL_Mutex*)XMALLOC(sizeof(wolfSSL_Mutex), NULL,
DYNAMIC_TYPE_TLSX)) == NULL)
return DRBG_OUT_OF_MEMORY;
InitMutex(rngMutex);
wc_InitMutex(rngMutex);
}
ret |= LockMutex(rngMutex);
ret |= wc_LockMutex(rngMutex);
ret |= wc_RNG_GenerateBlock(rng, out, num_bytes);
ret |= UnLockMutex(rngMutex);
ret |= wc_UnLockMutex(rngMutex);
if (ret != 0)
return DRBG_ENTROPY_FAIL;