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
1 change: 1 addition & 0 deletions .github/workflows/os-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
'--enable-sessionexport --enable-dtls --enable-dtls13',
'--enable-cryptocb --enable-aesgcm CPPFLAGS="-DWOLF_CRYPTO_CB_AES_SETKEY -DWOLF_CRYPTO_CB_FREE"',
'--disable-tls --enable-cryptocb --enable-aesgcm CPPFLAGS="-DWOLF_CRYPTO_CB_AES_SETKEY -DWOLF_CRYPTO_CB_FREE"',
'--enable-cryptocb --enable-keygen CPPFLAGS="-DWOLF_CRYPTO_CB_FIND"',
'--disable-examples CPPFLAGS=-DWOLFSSL_NO_MALLOC',
'CPPFLAGS=-DNO_WOLFSSL_CLIENT',
'CPPFLAGS=-DNO_WOLFSSL_SERVER',
Expand Down
6 changes: 6 additions & 0 deletions wolfcrypt/src/sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,12 @@ static int InitSha3(wc_Sha3* sha3)
#ifdef WOLFSSL_HASH_FLAGS
sha3->flags = 0;
#endif
#ifdef WOLF_CRYPTO_CB
/* Cached hash variant is tied to sponge state; clear it whenever the
* state is reset so reuse for a different SHA3 variant dispatches
* correctly through the crypto callback. */
sha3->hashType = WC_HASH_TYPE_NONE;
#endif

#ifdef USE_INTEL_SPEEDUP
{
Expand Down
30 changes: 15 additions & 15 deletions wolfcrypt/src/wc_mlkem.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,11 @@ int wc_MlKemKey_MakeKey(MlKemKey* key, WC_RNG* rng)
}

#ifdef WOLF_CRYPTO_CB
if ((ret == 0)
#ifndef WOLF_CRYPTO_CB_FIND
&& (key->devId != INVALID_DEVID)
#endif
) {
#ifndef WOLF_CRYPTO_CB_FIND
if ((ret == 0) && (key->devId != INVALID_DEVID)) {
#else
if (ret == 0) {
#endif
ret = wc_CryptoCb_MakePqcKemKey(rng, WC_PQC_KEM_TYPE_KYBER,
key->type, key);
if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE))
Expand Down Expand Up @@ -1287,11 +1287,11 @@ int wc_MlKemKey_Encapsulate(MlKemKey* key, unsigned char* c, unsigned char* k,
if (ret == 0) {
ret = wc_MlKemKey_CipherTextSize(key, &ctlen);
}
if ((ret == 0)
#ifndef WOLF_CRYPTO_CB_FIND
&& (key->devId != INVALID_DEVID)
#endif
) {
#ifndef WOLF_CRYPTO_CB_FIND
if ((ret == 0) && (key->devId != INVALID_DEVID)) {
#else
if (ret == 0) {
#endif
ret = wc_CryptoCb_PqcEncapsulate(c, ctlen, k, KYBER_SS_SZ, rng,
WC_PQC_KEM_TYPE_KYBER, key);
if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE))
Expand Down Expand Up @@ -1767,11 +1767,11 @@ int wc_MlKemKey_Decapsulate(MlKemKey* key, unsigned char* ss,
}

#ifdef WOLF_CRYPTO_CB
if ((ret == 0)
#ifndef WOLF_CRYPTO_CB_FIND
&& (key->devId != INVALID_DEVID)
#endif
) {
#ifndef WOLF_CRYPTO_CB_FIND
if ((ret == 0) && (key->devId != INVALID_DEVID)) {
#else
if (ret == 0) {
#endif
ret = wc_CryptoCb_PqcDecapsulate(ct, ctSz, ss, KYBER_SS_SZ,
WC_PQC_KEM_TYPE_KYBER, key);
if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE))
Expand Down
Loading