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
2 changes: 1 addition & 1 deletion tests/api/test_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int test_wc_DsaSignVerify(void)
ExpectIntEQ(wc_DsaVerify(hash, signature, NULL, &answer), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
ExpectIntEQ(wc_DsaVerify(hash, signature, &key, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));

#if !defined(HAVE_FIPS) && defined(WOLFSSL_PUBLIC_MP)
#if !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS) && defined(WOLFSSL_PUBLIC_MP)
/* hard set q to 0 and test fail case */
mp_free(&key.q);
ExpectIntEQ(mp_init(&key.q), 0);
Expand Down
3 changes: 2 additions & 1 deletion tests/api/test_ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,8 @@ int test_wc_ecc_export_x963_ex(void)
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
ExpectIntEQ(wc_ecc_export_x963_ex(&key, out, NULL, COMP),
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
#if defined(HAVE_FIPS) && (!defined(FIPS_VERSION_LT) || FIPS_VERSION_LT(5,3))
#if (defined(HAVE_FIPS) && (!defined(FIPS_VERSION_LT) || FIPS_VERSION_LT(5,3)))\
|| defined(HAVE_SELFTEST)
ExpectIntEQ(wc_ecc_export_x963_ex(&key, out, &badOutLen, COMP),
WC_NO_ERR_TRACE(BUFFER_E));
#else
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_ossl_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ int test_wolfSSL_EC_POINT(void)
hexStr = EC_POINT_point2hex(group, Gxy, POINT_CONVERSION_COMPRESSED, ctx);
ExpectNotNull(hexStr);
ExpectStrEQ(hexStr, compG);
#ifdef HAVE_COMP_KEY
#if defined(HAVE_COMP_KEY) && !defined(HAVE_SELFTEST)
ExpectNotNull(get_point = EC_POINT_hex2point
(group, hexStr, get_point, ctx));
ExpectIntEQ(EC_POINT_cmp(group, Gxy, get_point, ctx), 0);
Expand Down
3 changes: 2 additions & 1 deletion wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -13211,7 +13211,8 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen,
if (ret == 0) {
/* Calculate the size of the encoded public point. */
PRIVATE_KEY_UNLOCK();
#if defined(HAVE_COMP_KEY) && defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)
#if defined(HAVE_COMP_KEY) && \
(defined(HAVE_SELFTEST) || (defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0)))
/* in earlier versions of FIPS the get length functionality is not
* available with compressed keys */
pubSz = key->dp ? key->dp->size : MAX_ECC_BYTES;
Expand Down
19 changes: 19 additions & 0 deletions wolfcrypt/src/cmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,19 @@ int wc_InitCmac_ex(Cmac* cmac, const byte* key, word32 keySz,
byte l[WC_AES_BLOCK_SIZE];

XMEMSET(l, 0, WC_AES_BLOCK_SIZE);
#ifndef HAVE_SELFTEST
ret = wc_AesEncryptDirect(&cmac->aes, l, l);
if (ret == 0) {
ShiftAndXorRb(cmac->k1, l);
ShiftAndXorRb(cmac->k2, cmac->k1);
ForceZero(l, WC_AES_BLOCK_SIZE);
}
#else
wc_AesEncryptDirect(&cmac->aes, l, l);
ShiftAndXorRb(cmac->k1, l);
ShiftAndXorRb(cmac->k2, cmac->k1);
ForceZero(l, WC_AES_BLOCK_SIZE);
#endif
}
break;
#endif /* !NO_AES && WOLFSSL_AES_DIRECT */
Expand Down Expand Up @@ -233,12 +240,19 @@ int wc_CmacUpdate(Cmac* cmac, const byte* in, word32 inSz)
if (cmac->totalSz != 0) {
xorbuf(cmac->buffer, cmac->digest, WC_AES_BLOCK_SIZE);
}
#ifndef HAVE_SELFTEST
ret = wc_AesEncryptDirect(&cmac->aes, cmac->digest,
cmac->buffer);
if (ret == 0) {
cmac->totalSz += WC_AES_BLOCK_SIZE;
cmac->bufferSz = 0;
}
#else
wc_AesEncryptDirect(&cmac->aes, cmac->digest,
cmac->buffer);
cmac->totalSz += WC_AES_BLOCK_SIZE;
cmac->bufferSz = 0;
#endif
}
}
}; break;
Expand Down Expand Up @@ -332,10 +346,15 @@ int wc_CmacFinalNoFree(Cmac* cmac, byte* out, word32* outSz)
}
xorbuf(cmac->buffer, cmac->digest, WC_AES_BLOCK_SIZE);
xorbuf(cmac->buffer, subKey, WC_AES_BLOCK_SIZE);
#ifndef HAVE_SELFTEST
ret = wc_AesEncryptDirect(&cmac->aes, cmac->digest, cmac->buffer);
if (ret == 0) {
XMEMCPY(out, cmac->digest, *outSz);
}
#else
wc_AesEncryptDirect(&cmac->aes, cmac->digest, cmac->buffer);
XMEMCPY(out, cmac->digest, *outSz);
#endif
}; break;
#endif /* !NO_AES && WOLFSSL_AES_DIRECT */
default:
Expand Down