mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 14:30:49 +02:00
misc_fixes: cleanup for skoll review.
This commit is contained in:
@@ -547,7 +547,8 @@ int test_wc_DsaExportKeyRaw(void)
|
||||
WC_RNG rng;
|
||||
byte xOut[MAX_DSA_PARAM_SIZE];
|
||||
byte yOut[MAX_DSA_PARAM_SIZE];
|
||||
word32 xOutSz, yOutSz;
|
||||
word32 xOutSz = sizeof(xOut);
|
||||
word32 yOutSz = sizeof(yOut);
|
||||
|
||||
XMEMSET(&key, 0, sizeof(key));
|
||||
XMEMSET(&rng, 0, sizeof(rng));
|
||||
@@ -563,8 +564,6 @@ int test_wc_DsaExportKeyRaw(void)
|
||||
ExpectIntEQ(wc_MakeDsaKey(&rng, &key), 0);
|
||||
|
||||
/* try successful export */
|
||||
xOutSz = sizeof(xOut);
|
||||
yOutSz = sizeof(yOut);
|
||||
ExpectIntEQ(wc_DsaExportKeyRaw(&key, xOut, &xOutSz, yOut, &yOutSz), 0);
|
||||
|
||||
/* test bad args */
|
||||
|
||||
@@ -305,11 +305,13 @@ int test_wc_Md5HmacUpdate(void)
|
||||
b.inLen = XSTRLEN(b.input);
|
||||
|
||||
ExpectIntEQ(wc_HmacInit(&hmac, NULL, INVALID_DEVID), 0);
|
||||
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0))
|
||||
#if !defined(WOLFSSL_KCAPI_HMAC) && !defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0))
|
||||
/* update before setkey results in err. */
|
||||
ExpectIntEQ(wc_HmacUpdate(&hmac, (byte*)b.input, (word32)b.inLen),
|
||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||
#endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
|
||||
#endif /* !WOLFSSL_KCAPI_HMAC && !HAVE_SELFTEST && \
|
||||
(!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
|
||||
ExpectIntEQ(wc_HmacSetKey(&hmac, WC_MD5, (byte*)keys,
|
||||
(word32)XSTRLEN(keys)), 0);
|
||||
ExpectIntEQ(wc_HmacUpdate(&hmac, (byte*)b.input, (word32)b.inLen), 0);
|
||||
|
||||
+5
-5
@@ -709,11 +709,6 @@ int wc_DsaExportKeyRaw(DsaKey* dsa, byte* x, word32* xSz, byte* y, word32* ySz)
|
||||
if (dsa == NULL || xSz == NULL || ySz == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* check we have a key to export */
|
||||
if (mp_iszero(&dsa->x) || mp_iszero(&dsa->y)) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* get required output buffer sizes */
|
||||
xLen = (word32)mp_unsigned_bin_size(&dsa->x);
|
||||
yLen = (word32)mp_unsigned_bin_size(&dsa->y);
|
||||
@@ -728,6 +723,11 @@ int wc_DsaExportKeyRaw(DsaKey* dsa, byte* x, word32* xSz, byte* y, word32* ySz)
|
||||
if (x == NULL || y == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* check we have a key to export */
|
||||
if (mp_iszero(&dsa->x) && mp_iszero(&dsa->y)) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* export x */
|
||||
if (*xSz < xLen) {
|
||||
WOLFSSL_MSG("Output buffer for DSA private key (x) too small, "
|
||||
|
||||
+2
-1
@@ -9848,9 +9848,10 @@ static int ECC_populate_EVP_PKEY(WOLFSSL_EVP_PKEY* pkey, WOLFSSL_EC_KEY *key)
|
||||
pkey->pkey.ptr = (char*)derBuf;
|
||||
if ((derSz = wc_EccPublicKeyToDer(ecc, derBuf, (word32)derSz,
|
||||
1)) < 0) {
|
||||
XFREE(derBuf, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
XFREE(derBuf, pkey->heap, DYNAMIC_TYPE_OPENSSL);
|
||||
derBuf = NULL;
|
||||
pkey->pkey.ptr = NULL;
|
||||
pkey->pkey_sz = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,6 +368,7 @@ static int HmacKeyCopyHash(byte macType, wc_HmacHash* src, wc_HmacHash* dst)
|
||||
#endif
|
||||
|
||||
default:
|
||||
ret = BAD_FUNC_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -475,6 +476,7 @@ static int HmacKeyHashUpdate(byte macType, wc_HmacHash* hash, byte* pad)
|
||||
#endif
|
||||
|
||||
default:
|
||||
ret = BAD_FUNC_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -777,6 +777,7 @@ int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd, int passLen,
|
||||
#endif
|
||||
}
|
||||
|
||||
ForceZero(B, WC_MAX_BLOCK_SIZE);
|
||||
WC_FREE_VAR_EX(B, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
ForceZero(buffer, totalLen);
|
||||
if (buffer != staticBuffer) {
|
||||
|
||||
Reference in New Issue
Block a user