diff --git a/src/ssl.c b/src/ssl.c index 9972e9f7cd..be630f0107 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -15671,7 +15671,7 @@ int wolfSSL_CTX_set_servername_arg(WOLFSSL_CTX* ctx, void* arg) int wolfSSL_CRYPTO_memcmp(const void *a, const void *b, size_t size) { if (!a || !b) - return 0; + return -1; return ConstantCompare((const byte*)a, (const byte*)b, (int)size); } diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 3672d27b48..c386ab1623 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -9300,7 +9300,7 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz, if (falcon == NULL) return MEMORY_E; - if (wc_falcon_init(falcon) != 0) { + if (wc_falcon_init(falcon) == 0) { tmpIdx = 0; if (wc_falcon_set_level(falcon, 1) == 0) { if (wc_Falcon_PrivateKeyDecode(key, &tmpIdx, falcon, keySz) @@ -9387,7 +9387,7 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz, if (sphincs == NULL) return MEMORY_E; - if (wc_sphincs_init(sphincs) != 0) { + if (wc_sphincs_init(sphincs) == 0) { tmpIdx = 0; if (wc_sphincs_set_level_and_optim(sphincs, 1, FAST_VARIANT) == 0) { diff --git a/wolfcrypt/src/pkcs7.c b/wolfcrypt/src/pkcs7.c index 97d15a3937..be7076fc58 100644 --- a/wolfcrypt/src/pkcs7.c +++ b/wolfcrypt/src/pkcs7.c @@ -10494,7 +10494,7 @@ static int wc_PKCS7_DecryptKtri(wc_PKCS7* pkcs7, byte* in, word32 inSz, DYNAMIC_TYPE_TMP_BUFFER); #ifndef WC_NO_RSA_OAEP if (encOID == RSAESOAEPk) { - if (!outKey) { + if (outKey) { XFREE(outKey, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER); } } @@ -10510,7 +10510,7 @@ static int wc_PKCS7_DecryptKtri(wc_PKCS7* pkcs7, byte* in, word32 inSz, WC_FREE_VAR_EX(privKey, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER); #ifndef WC_NO_RSA_OAEP if (encOID == RSAESOAEPk) { - if (!outKey) { + if (outKey) { XFREE(outKey, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER); } }