Skip to content
Draft
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
126 changes: 90 additions & 36 deletions wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -50626,7 +50626,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
byte info1[10] ={ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9 };
#endif
#ifndef NO_SHA
/* SHA-1 HKDF is refused by the v7 module when the approved-mode gates are
* active (HkdfDigestAllowed() in fips.c). */
#if !defined(NO_SHA) && !(defined(HAVE_FIPS) && \
FIPS_VERSION3_GE(7,0,0) && defined(WC_HAVE_FIPS_INDICATOR))
byte res1[42] = { 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61,
0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06,
0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06,
Expand Down Expand Up @@ -50663,7 +50666,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
XMEMSET(okm1, 0, sizeof(okm1));
L = (int)sizeof(okm1);

#ifndef NO_SHA
#if !defined(NO_SHA) && !(defined(HAVE_FIPS) && \
FIPS_VERSION3_GE(7,0,0) && defined(WC_HAVE_FIPS_INDICATOR))
PRIVATE_KEY_UNLOCK();
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION_GE(7,0))
ret = wc_HKDF_ex(WC_SHA, ikm1, (word32)sizeof(ikm1), NULL, 0, NULL, 0,
Expand Down Expand Up @@ -50736,7 +50740,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
#endif /* !HAVE_FIPS */
#endif /* !NO_SHA256 */

#ifndef NO_SHA
#if !defined(NO_SHA) && !(defined(HAVE_FIPS) && \
FIPS_VERSION3_GE(7,0,0) && defined(WC_HAVE_FIPS_INDICATOR))
PRIVATE_KEY_UNLOCK();
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION_GE(7,0))
ret = wc_HKDF_Extract_ex(WC_SHA, NULL, 0, ikm1, (word32)sizeof(ikm1),
Expand Down Expand Up @@ -67598,8 +67603,9 @@ static wc_test_ret_t mlkem512_kat(void)
#ifndef WOLFSSL_MLKEM_NO_ENCAPSULATE
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, kyber512enc_rand,
sizeof(kyber512enc_rand));
if (ret != 0)
if (ret != SEED_OK)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = 0;

if (XMEMCMP(ct, kyber512_ct, sizeof(kyber512_ct)) != 0)
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
Expand Down Expand Up @@ -67666,8 +67672,9 @@ static wc_test_ret_t mlkem512_kat(void)
#ifndef WOLFSSL_MLKEM_NO_ENCAPSULATE
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, kyber512enc_rand,
sizeof(kyber512enc_rand));
if (ret != 0)
if (ret != SEED_OK)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = 0;

if (XMEMCMP(ct, ml_kem_512_ct, sizeof(ml_kem_512_ct)) != 0)
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
Expand Down Expand Up @@ -69072,8 +69079,9 @@ static wc_test_ret_t mlkem768_kat(void)
#ifndef WOLFSSL_MLKEM_NO_ENCAPSULATE
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, kyber768enc_rand,
sizeof(kyber768enc_rand));
if (ret != 0)
if (ret != SEED_OK)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = 0;

if (XMEMCMP(ct, kyber768_ct, sizeof(kyber768_ct)) != 0)
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
Expand Down Expand Up @@ -69140,8 +69148,9 @@ static wc_test_ret_t mlkem768_kat(void)
#ifndef WOLFSSL_MLKEM_NO_ENCAPSULATE
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, kyber768enc_rand,
sizeof(kyber768enc_rand));
if (ret != 0)
if (ret != SEED_OK)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = 0;

if (XMEMCMP(ct, ml_kem_768_ct, sizeof(ml_kem_768_ct)) != 0)
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
Expand Down Expand Up @@ -70928,8 +70937,9 @@ static wc_test_ret_t mlkem1024_kat(void)
#ifndef WOLFSSL_MLKEM_NO_ENCAPSULATE
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, kyber1024enc_rand,
sizeof(kyber1024enc_rand));
if (ret != 0)
if (ret != SEED_OK)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = 0;

if (XMEMCMP(ct, kyber1024_ct, sizeof(kyber1024_ct)) != 0)
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
Expand Down Expand Up @@ -70996,8 +71006,9 @@ static wc_test_ret_t mlkem1024_kat(void)
#ifndef WOLFSSL_MLKEM_NO_ENCAPSULATE
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, kyber1024enc_rand,
sizeof(kyber1024enc_rand));
if (ret != 0)
if (ret != SEED_OK)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
ret = 0;

if (XMEMCMP(ct, ml_kem_1024_ct, sizeof(ml_kem_1024_ct)) != 0)
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
Expand Down Expand Up @@ -72383,6 +72394,23 @@ static wc_test_ret_t mlkem_decap_reject_test(int type, WC_RNG* rng)
else if ((ret == 0) && (yields < 1)) \
ret = WC_TEST_RET_ENC_NC; \
} while (0)
/* Variants of the above for caller-seeded calls, which return SEED_OK. */
#define NB_STEP_SEEDED(call) \
do { \
if (ret == 0) { \
rc = (call); \
if (rc != SEED_OK) \
ret = WC_TEST_RET_ENC_EC(rc); \
} \
} while (0)
#define NB_RUN_SEEDED(call) \
do { \
NB_DRIVE(call); \
if ((ret == 0) && (rc != SEED_OK)) \
ret = WC_TEST_RET_ENC_EC(rc); \
else if ((ret == 0) && (yields < 1)) \
ret = WC_TEST_RET_ENC_NC; \
} while (0)
/* Start an operation and leave it in flight: the call must yield. */
#define NB_START(call) \
do { \
Expand Down Expand Up @@ -72472,14 +72500,14 @@ static wc_test_ret_t mlkem_nonblock_test_type(int type, WC_RNG* rng)
NB_EXPECT(XMEMCMP(ss, ssDec, sizeof(ss)) == 0);

/* The same seeds give the same key, ciphertext and secret as blocking. */
NB_STEP(wc_MlKemKey_MakeKeyWithRandom(&ref, seed, (int)sizeof(seed)));
NB_STEP_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&ref, seed, (int)sizeof(seed)));
NB_STEP(wc_MlKemKey_EncodePublicKey(&ref, pubRef, pubSz));
NB_RUN(wc_MlKemKey_MakeKeyWithRandom(&key, seed, (int)sizeof(seed)));
NB_RUN_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&key, seed, (int)sizeof(seed)));
NB_STEP(wc_MlKemKey_EncodePublicKey(&key, pub, pubSz));
NB_EXPECT(XMEMCMP(pub, pubRef, pubSz) == 0);
NB_STEP(wc_MlKemKey_EncapsulateWithRandom(&ref, ct2, ssDec, m,
NB_STEP_SEEDED(wc_MlKemKey_EncapsulateWithRandom(&ref, ct2, ssDec, m,
(int)sizeof(m)));
NB_RUN(wc_MlKemKey_EncapsulateWithRandom(&key, ct, ss, m, (int)sizeof(m)));
NB_RUN_SEEDED(wc_MlKemKey_EncapsulateWithRandom(&key, ct, ss, m, (int)sizeof(m)));
NB_EXPECT(XMEMCMP(ct, ct2, ctSz) == 0);
NB_EXPECT(XMEMCMP(ss, ssDec, sizeof(ss)) == 0);
NB_STEP(wc_MlKemKey_Decapsulate(&ref, ssDec, ct, ctSz));
Expand All @@ -72503,26 +72531,26 @@ static wc_test_ret_t mlkem_nonblock_test_type(int type, WC_RNG* rng)
/* Without re-attaching: a decapsulation or encapsulation left in flight
* must not leak its state into a key generation, nor one key generation
* into the next. */
NB_STEP(wc_MlKemKey_MakeKeyWithRandom(&ref, seed2, (int)sizeof(seed2)));
NB_STEP_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&ref, seed2, (int)sizeof(seed2)));
NB_STEP(wc_MlKemKey_EncodePublicKey(&ref, pubRef, pubSz));
NB_START(wc_MlKemKey_Decapsulate(&key, ssDec, ct, ctSz));
NB_RUN(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_RUN_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_STEP(wc_MlKemKey_EncodePublicKey(&key, pub, pubSz));
NB_EXPECT(XMEMCMP(pub, pubRef, pubSz) == 0);
NB_START(wc_MlKemKey_EncapsulateWithRandom(&key, ct2, ssDec, m,
(int)sizeof(m)));
NB_RUN(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_RUN_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_STEP(wc_MlKemKey_EncodePublicKey(&key, pub, pubSz));
NB_EXPECT(XMEMCMP(pub, pubRef, pubSz) == 0);
NB_START(wc_MlKemKey_MakeKeyWithRandom(&key, seed, (int)sizeof(seed)));
NB_RUN(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_RUN_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_STEP(wc_MlKemKey_EncodePublicKey(&key, pub, pubSz));
NB_EXPECT(XMEMCMP(pub, pubRef, pubSz) == 0);

/* An encapsulation of a caller's m left in flight, then one from the RNG
* into the same buffer: it must not resume on that m. Likewise a key
* generation from a caller's seeds, then one from the RNG. */
NB_STEP(wc_MlKemKey_EncapsulateWithRandom(&ref, ct2, ssDec, m,
NB_STEP_SEEDED(wc_MlKemKey_EncapsulateWithRandom(&ref, ct2, ssDec, m,
(int)sizeof(m)));
NB_START(wc_MlKemKey_EncapsulateWithRandom(&key, ct, ss, m,
(int)sizeof(m)));
Expand All @@ -72534,10 +72562,10 @@ static wc_test_ret_t mlkem_nonblock_test_type(int type, WC_RNG* rng)
NB_RUN(wc_MlKemKey_MakeKey(&key, rng));
NB_STEP(wc_MlKemKey_EncodePublicKey(&key, pub, pubSz));
NB_EXPECT(XMEMCMP(pub, pubRef, pubSz) != 0);
NB_RUN(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));
NB_RUN_SEEDED(wc_MlKemKey_MakeKeyWithRandom(&key, seed2, (int)sizeof(seed2)));

/* A decapsulation left in flight, then one of a ciphertext elsewhere. */
NB_STEP(wc_MlKemKey_EncapsulateWithRandom(&ref, ct, ss, m,
NB_STEP_SEEDED(wc_MlKemKey_EncapsulateWithRandom(&ref, ct, ss, m,
(int)sizeof(m)));
if (ret == 0) {
XMEMCPY(ct2, ct, ctSz);
Expand Down Expand Up @@ -72802,6 +72830,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mlkem_test(void)
#else
ret = wc_MlKemKey_EncapsulateWithRandom(key, ct, ss, encap_rand,
sizeof(encap_rand));
if (ret == SEED_OK)
ret = 0;
#endif
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
Expand Down Expand Up @@ -78531,8 +78561,8 @@ static wc_test_ret_t mldsa_nonblock_test_level(int level, WC_RNG* rng)
NB_EXPECT((rc == 0) && (res == 0));

/* The same seeds give the same key and signature as blocking. */
NB_STEP(wc_MlDsaKey_MakeKeyFromSeed(&ref, seed));
NB_RUN(wc_MlDsaKey_MakeKeyFromSeed(&key, seed));
NB_STEP_SEEDED(wc_MlDsaKey_MakeKeyFromSeed(&ref, seed));
NB_RUN_SEEDED(wc_MlDsaKey_MakeKeyFromSeed(&key, seed));
#ifdef WOLFSSL_MLDSA_PUBLIC_KEY
len = (word32)pubSz;
NB_STEP(wc_MlDsaKey_ExportPubRaw(&ref, pubRef, &len));
Expand All @@ -78541,18 +78571,18 @@ static wc_test_ret_t mldsa_nonblock_test_level(int level, WC_RNG* rng)
NB_EXPECT(XMEMCMP(pub, pubRef, (size_t)pubSz) == 0);
#endif
sigLen2 = (word32)sigSz;
NB_STEP(wc_MlDsaKey_SignCtxWithSeed(&ref, ctx, (byte)sizeof(ctx), sig2,
NB_STEP_SEEDED(wc_MlDsaKey_SignCtxWithSeed(&ref, ctx, (byte)sizeof(ctx), sig2,
&sigLen2, msg, (word32)sizeof(msg), rnd));
sigLen = (word32)sigSz;
NB_RUN(wc_MlDsaKey_SignCtxWithSeed(&key, ctx, (byte)sizeof(ctx), sig,
NB_RUN_SEEDED(wc_MlDsaKey_SignCtxWithSeed(&key, ctx, (byte)sizeof(ctx), sig,
&sigLen, msg, (word32)sizeof(msg), rnd));
NB_EXPECT((sigLen == sigLen2) && (XMEMCMP(sig, sig2, sigLen) == 0));
#ifdef WOLFSSL_SHA512
sigLen2 = (word32)sigSz;
NB_STEP(wc_MlDsaKey_SignCtxHashWithSeed(&ref, ctx, (byte)sizeof(ctx), sig2,
NB_STEP_SEEDED(wc_MlDsaKey_SignCtxHashWithSeed(&ref, ctx, (byte)sizeof(ctx), sig2,
&sigLen2, hash, (word32)sizeof(hash), WC_HASH_TYPE_SHA512, rnd));
sigLen = (word32)sigSz;
NB_RUN(wc_MlDsaKey_SignCtxHashWithSeed(&key, ctx, (byte)sizeof(ctx), sig,
NB_RUN_SEEDED(wc_MlDsaKey_SignCtxHashWithSeed(&key, ctx, (byte)sizeof(ctx), sig,
&sigLen, hash, (word32)sizeof(hash), WC_HASH_TYPE_SHA512, rnd));
NB_EXPECT((sigLen == sigLen2) && (XMEMCMP(sig, sig2, sigLen) == 0));
/* A hedged pre-hash signature with a context verifies both ways. */
Expand Down Expand Up @@ -78673,7 +78703,7 @@ static wc_test_ret_t mldsa_nonblock_test_level(int level, WC_RNG* rng)
* Likewise a key generation from a caller's seed, then one from the
* RNG. */
sigLen = (word32)sigSz;
NB_STEP(wc_MlDsaKey_SignCtxWithSeed(&ref, NULL, 0, sig, &sigLen, msg,
NB_STEP_SEEDED(wc_MlDsaKey_SignCtxWithSeed(&ref, NULL, 0, sig, &sigLen, msg,
(word32)sizeof(msg), rnd));
sigLen2 = (word32)sigSz;
NB_START(wc_MlDsaKey_SignCtxWithSeed(&key, NULL, 0, sig2, &sigLen2, msg,
Expand All @@ -78691,7 +78721,7 @@ static wc_test_ret_t mldsa_nonblock_test_level(int level, WC_RNG* rng)
len = (word32)pubSz;
NB_STEP(wc_MlDsaKey_ExportPubRaw(&key, pub, &len));
NB_EXPECT(XMEMCMP(pub, pubRef, (size_t)pubSz) != 0);
NB_RUN(wc_MlDsaKey_MakeKeyFromSeed(&key, seed));
NB_RUN_SEEDED(wc_MlDsaKey_MakeKeyFromSeed(&key, seed));
#endif
/* A resumed call that fails before it picks up the working allocation
* still releases it. */
Expand All @@ -78707,7 +78737,7 @@ static wc_test_ret_t mldsa_nonblock_test_level(int level, WC_RNG* rng)
NB_EXPECT((rc == WC_NO_ERR_TRACE(BUFFER_E)) && (nb.work == NULL));
/* A key generation left in flight, then one from another seed. */
NB_START(wc_MlDsaKey_MakeKeyFromSeed(&key, seed2));
NB_RUN(wc_MlDsaKey_MakeKeyFromSeed(&key, seed));
NB_RUN_SEEDED(wc_MlDsaKey_MakeKeyFromSeed(&key, seed));
#ifdef WOLFSSL_MLDSA_PUBLIC_KEY
len = (word32)pubSz;
NB_STEP(wc_MlDsaKey_ExportPubRaw(&key, pub, &len));
Expand Down Expand Up @@ -78796,8 +78826,8 @@ static wc_test_ret_t mldsa_nonblock_match_test_level(int level)
nbInited = (ret == 0);
NB_STEP(wc_MlDsaKey_SetParams(nbKey, (byte)level));
NB_STEP(wc_MlDsaKey_set_nonblock(nbKey, &nb));
NB_STEP(wc_MlDsaKey_MakeKeyFromSeed(key, seed));
NB_RUN(wc_MlDsaKey_MakeKeyFromSeed(nbKey, seed));
NB_STEP_SEEDED(wc_MlDsaKey_MakeKeyFromSeed(key, seed));
NB_RUN_SEEDED(wc_MlDsaKey_MakeKeyFromSeed(nbKey, seed));
NB_STEP(wc_MlDsaKey_GetSigLen(key, &sigSz));
if (ret == 0) {
sig = (byte*)XMALLOC((size_t)sigSz, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
Expand All @@ -78810,11 +78840,11 @@ static wc_test_ret_t mldsa_nonblock_match_test_level(int level)
msg[0] = (byte)i;
sigLen = (word32)sigSz;
nbSigLen = (word32)sigSz;
NB_STEP(wc_MlDsaKey_SignCtxWithSeed(key, NULL, 0, sig, &sigLen, msg,
NB_STEP_SEEDED(wc_MlDsaKey_SignCtxWithSeed(key, NULL, 0, sig, &sigLen, msg,
(word32)sizeof(msg), seed));
NB_DRIVE(wc_MlDsaKey_SignCtxWithSeed(nbKey, NULL, 0, nbSig, &nbSigLen,
msg, (word32)sizeof(msg), seed));
if ((ret == 0) && (rc != 0))
if ((ret == 0) && (rc != SEED_OK))
ret = WC_TEST_RET_ENC_EC(rc);
if (ret == 0) {
if ((minYields < 0) || (yields < minYields))
Expand Down Expand Up @@ -80891,9 +80921,10 @@ static wc_test_ret_t slhdsa_keygen_kat(enum SlhDsaParam param,

ret = wc_SlhDsaKey_MakeKeyWithRandom(key,
sk_seed, sk_seed_sz, sk_prf, sk_prf_sz, pk_seed, pk_seed_sz);
if (ret != 0) {
if (ret != SEED_OK) {
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
}
ret = 0;

outLen = WC_SLHDSA_MAX_PRIV_LEN;
PRIVATE_KEY_UNLOCK();
Expand Down Expand Up @@ -82792,9 +82823,10 @@ wc_test_ret_t slhdsa_test(void)
sk_seed_shake128s, (word32)sizeof(sk_seed_shake128s),
sk_prf_shake128s, (word32)sizeof(sk_prf_shake128s),
pk_seed_shake128s, (word32)sizeof(pk_seed_shake128s));
if (ret != 0) {
if (ret != SEED_OK) {
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
}
ret = 0;

outLen = WC_SLHDSA_MAX_PRIV_LEN;
PRIVATE_KEY_UNLOCK();
Expand Down Expand Up @@ -82848,9 +82880,10 @@ wc_test_ret_t slhdsa_test(void)
ret = wc_SlhDsaKey_SignWithRandom(key, ctx, 0, msg, (word32)sizeof(msg),
sig, &outLen, pk_seed_shake128s);
PRIVATE_KEY_LOCK();
if (ret != 0) {
if (ret != SEED_OK) {
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
}
ret = 0;
if (outLen != (word32)sizeof(sig_shake128s)) {
ERROR_OUT(WC_TEST_RET_ENC_I(outLen), out);
}
Expand Down Expand Up @@ -102621,6 +102654,9 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
word32 n = info->pk.pqc_sig_kg.seedSz / 3;
ret = wc_SlhDsaKey_MakeKeyWithRandom(sk, seed, n,
seed + n, n, seed + 2 * n, n);
/* The callback contract has no indicator ride. */
if (ret == SEED_OK)
ret = 0;
}
else {
ret = wc_SlhDsaKey_MakeKey(sk, info->pk.pqc_sig_kg.rng);
Expand Down Expand Up @@ -102648,6 +102684,8 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
info->pk.pqc_sign.out,
info->pk.pqc_sign.outlen,
addRnd);
if (ret == SEED_OK)
ret = 0;
}
else {
ret = wc_SlhDsaKey_Sign(sk,
Expand All @@ -102671,6 +102709,8 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
info->pk.pqc_sign.out,
info->pk.pqc_sign.outlen,
addRnd);
if (ret == SEED_OK)
ret = 0;
}
else {
ret = wc_SlhDsaKey_SignHash(sk,
Expand Down Expand Up @@ -102700,6 +102740,8 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
info->pk.pqc_sign.out,
info->pk.pqc_sign.outlen,
info->pk.pqc_sign.addRnd);
if (ret == SEED_OK)
ret = 0;
sk->devId = devIdArg;
myCtx->exampleVar++;
}
Expand Down Expand Up @@ -106204,9 +106246,13 @@ static wc_test_ret_t cryptocb_pqc_mlkem_encap(MlKemKey* sw, MlKemKey* hw,
XMEMSET(rand, 0x6b, sizeof(rand));
ret = wc_MlKemKey_EncapsulateWithRandom(sw, ctSw, ssSw, rand,
(int)sizeof(rand));
if (ret == SEED_OK)
ret = 0;
if (ret == 0) {
ret = wc_MlKemKey_EncapsulateWithRandom(hw, ctHw, ssHw, rand,
(int)sizeof(rand));
if (ret == SEED_OK)
ret = 0;
}
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
Expand Down Expand Up @@ -106407,15 +106453,23 @@ static wc_test_ret_t cryptocb_pqc_mldsa_test(PqcHashDev* dev)
ret = wc_MlDsaKey_SetParams(hw, (byte)level);
if (ret == 0)
ret = wc_MlDsaKey_MakeKeyFromSeed(sw, seed);
if (ret == SEED_OK)
ret = 0;
if (ret == 0)
ret = wc_MlDsaKey_MakeKeyFromSeed(hw, seed);
if (ret == SEED_OK)
ret = 0;
if (ret == 0) {
ret = wc_MlDsaKey_SignCtxWithSeed(sw, NULL, 0, sigSw, &sigSzSw,
msg, sizeof(msg), rnd);
if (ret == SEED_OK)
ret = 0;
}
if (ret == 0) {
ret = wc_MlDsaKey_SignCtxWithSeed(hw, NULL, 0, sigHw, &sigSzHw,
msg, sizeof(msg), rnd);
if (ret == SEED_OK)
ret = 0;
}
if (ret == 0) {
ret = wc_MlDsaKey_VerifyCtx(hw, sigSw, sigSzSw, NULL, 0, msg,
Expand Down
Loading