Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wp_ecdh_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ static wp_EcdhCtx* wp_ecdh_dup(wp_EcdhCtx* src)
}
if (!ok) {
/* Free allocated memory and up referenced objects. */
wp_ecc_free(src->peer);
wp_ecc_free(src->key);
wp_ecc_free(dst->peer);
wp_ecc_free(dst->key);
OPENSSL_free(dst);
dst = NULL;
}
Expand Down
3 changes: 2 additions & 1 deletion src/wp_ecx_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ static wp_EcxCtx* wp_ecx_dupctx(wp_EcxCtx* src)
dst->peer = src->peer;
}
if (!ok) {
wp_ecx_free(src->key);
wp_ecx_free(dst->key);
wp_ecx_free(dst->peer);
OPENSSL_free(dst);
dst = NULL;
}
Expand Down
17 changes: 10 additions & 7 deletions src/wp_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,13 @@ int wp_unlock(wolfSSL_Mutex* mutex)
*/
int wp_name_to_nid(OSSL_LIB_CTX* libCtx, const char* name, const char* propQ)
{
int nid;
int nid = NID_undef;

EVP_MD* md = EVP_MD_fetch(libCtx, name, propQ);
nid = EVP_MD_type(md);
EVP_MD_free(md);

if (md) {
nid = EVP_MD_type(md);
EVP_MD_free(md);
}
return nid;
}

Expand Down Expand Up @@ -441,11 +442,13 @@ enum wc_HashType wp_nid_to_wc_hash_type(int nid)
int wp_name_to_wc_mgf(OSSL_LIB_CTX* libCtx, const char* name,
const char* propQ)
{
int ret;
int ret = WC_MGF1NONE;

EVP_MD* md = EVP_MD_fetch(libCtx, name, propQ);
ret = wp_mgf1_from_hash(EVP_MD_type(md));
EVP_MD_free(md);
if (md) {
ret = wp_mgf1_from_hash(EVP_MD_type(md));
EVP_MD_free(md);
}

return ret;
}
Expand Down
4 changes: 4 additions & 0 deletions src/wp_kbkdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ static int wp_kbkdf_init_hmac(wp_KbkdfCtx* ctx, unsigned char* key,
localKeyLen = (word32)keyLen;
}

if (localKeyLen > sizeof(localKey)) {
ok = 0;
}

if (ok) {
XMEMCPY(localKey, key, keyLen);
rc = wc_HmacSetKey(&ctx->hmacCtx, ctx->hashType, localKey,
Expand Down
Loading