mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-10-24 04:09:07 +03:00
tests: WC_NO_ERR_TRACE error-code operands + uppercase literal suffixes
Two check-source-text / clang-tidy fixes on the MC/DC test files: * Wrap error-code comparison operands in WC_NO_ERR_TRACE() (check-source-text check I). Code comparisons (blake2b/blake2s/hpke white-boxes and the logging global-queue pull check) are wrapped; the pseudo-code in doc comments and the WB_CHECK message strings (mcdc_fault_alloc.h, dsa/mlkem fault white-boxes, logging white-box) are reworded so an error code is no longer adjacent to == / != . * Uppercase the integer-literal suffixes in test_sakke.c (384u -> 384U, etc.) for clang-tidy readability-uppercase-literal-suffix. No behavioral change.
This commit is contained in:
@@ -231,13 +231,13 @@ int test_wc_Sakke_DecisionCoverage(void)
|
||||
/* data == NULL: length-only query. */
|
||||
ExpectIntEQ(wc_ExportSakkeKey(&key, NULL, &sz),
|
||||
WC_NO_ERR_TRACE(LENGTH_ONLY_E));
|
||||
ExpectIntEQ(sz, 384u);
|
||||
ExpectIntEQ(sz, 384U);
|
||||
sz = 383; /* one byte short of 3*128 */
|
||||
ExpectIntEQ(wc_ExportSakkeKey(&key, data, &sz),
|
||||
WC_NO_ERR_TRACE(BUFFER_E));
|
||||
sz = sizeof(data);
|
||||
ExpectIntEQ(wc_ExportSakkeKey(&key, data, &sz), 0);
|
||||
ExpectIntEQ(sz, 384u);
|
||||
ExpectIntEQ(sz, 384U);
|
||||
|
||||
/* --- wc_ImportSakkeKey() --- */
|
||||
ExpectIntEQ(wc_ImportSakkeKey(NULL, data, sz),
|
||||
@@ -258,13 +258,13 @@ int test_wc_Sakke_DecisionCoverage(void)
|
||||
sz = 0;
|
||||
ExpectIntEQ(wc_ExportSakkePrivateKey(&key, NULL, &sz),
|
||||
WC_NO_ERR_TRACE(LENGTH_ONLY_E));
|
||||
ExpectIntEQ(sz, 128u);
|
||||
ExpectIntEQ(sz, 128U);
|
||||
sz = 127;
|
||||
ExpectIntEQ(wc_ExportSakkePrivateKey(&key, data, &sz),
|
||||
WC_NO_ERR_TRACE(BUFFER_E));
|
||||
sz = sizeof(data);
|
||||
ExpectIntEQ(wc_ExportSakkePrivateKey(&key, data, &sz), 0);
|
||||
ExpectIntEQ(sz, 128u);
|
||||
ExpectIntEQ(sz, 128U);
|
||||
|
||||
/* --- wc_ImportSakkePrivateKey() --- */
|
||||
ExpectIntEQ(wc_ImportSakkePrivateKey(NULL, data, sz),
|
||||
@@ -284,24 +284,24 @@ int test_wc_Sakke_DecisionCoverage(void)
|
||||
/* data == NULL: skips sakke_z_from_mont(), length-only query. */
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, NULL, &sz, 1),
|
||||
WC_NO_ERR_TRACE(LENGTH_ONLY_E));
|
||||
ExpectIntEQ(sz, 256u);
|
||||
ExpectIntEQ(sz, 256U);
|
||||
sz = 255;
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, data, &sz, 1),
|
||||
WC_NO_ERR_TRACE(BUFFER_E));
|
||||
sz = sizeof(data);
|
||||
/* data != NULL: drives the sakke_z_from_mont() call. */
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, data, &sz, 1), 0);
|
||||
ExpectIntEQ(sz, 256u);
|
||||
ExpectIntEQ(sz, 256U);
|
||||
sz = 0;
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, NULL, &sz, 0),
|
||||
WC_NO_ERR_TRACE(LENGTH_ONLY_E));
|
||||
ExpectIntEQ(sz, 257u);
|
||||
ExpectIntEQ(sz, 257U);
|
||||
sz = 256;
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, data, &sz, 0),
|
||||
WC_NO_ERR_TRACE(BUFFER_E));
|
||||
sz = sizeof(data);
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, data, &sz, 0), 0);
|
||||
ExpectIntEQ(sz, 257u);
|
||||
ExpectIntEQ(sz, 257U);
|
||||
|
||||
/* --- wc_EncodeSakkeRsk() --- */
|
||||
sz = sizeof(data);
|
||||
@@ -312,7 +312,7 @@ int test_wc_Sakke_DecisionCoverage(void)
|
||||
ExpectIntEQ(wc_EncodeSakkeRsk(&key, rsk, data, NULL, 1),
|
||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||
ExpectIntEQ(wc_EncodeSakkeRsk(&key, rsk, data, &sz, 1), 0);
|
||||
ExpectIntEQ(sz, 256u);
|
||||
ExpectIntEQ(sz, 256U);
|
||||
|
||||
/* --- wc_DecodeSakkeRsk() --- */
|
||||
ExpectIntEQ(wc_DecodeSakkeRsk(NULL, data, sz, rsk),
|
||||
@@ -427,13 +427,13 @@ int test_wc_Sakke_DecisionCoverage(void)
|
||||
sz = 0;
|
||||
ExpectIntEQ(wc_GetSakkePointI(&key, NULL, &sz),
|
||||
WC_NO_ERR_TRACE(LENGTH_ONLY_E));
|
||||
ExpectIntEQ(sz, 256u);
|
||||
ExpectIntEQ(sz, 256U);
|
||||
sz = 255;
|
||||
ExpectIntEQ(wc_GetSakkePointI(&key, data, &sz),
|
||||
WC_NO_ERR_TRACE(BUFFER_E));
|
||||
sz = sizeof(data);
|
||||
ExpectIntEQ(wc_GetSakkePointI(&key, data, &sz), 0);
|
||||
ExpectIntEQ(sz, 256u);
|
||||
ExpectIntEQ(sz, 256U);
|
||||
|
||||
/* --- wc_SetSakkePointI() --- */
|
||||
ExpectIntEQ(wc_SetSakkePointI(NULL, id, 1, data, sz),
|
||||
@@ -770,7 +770,7 @@ int test_wc_Sakke_FeatureCoverage(void)
|
||||
* to the same bytes. */
|
||||
pubKeySz = sizeof(pubKeyData);
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, pubKeyData, &pubKeySz, 1), 0);
|
||||
ExpectIntEQ(pubKeySz, 256u);
|
||||
ExpectIntEQ(pubKeySz, 256U);
|
||||
ExpectIntEQ(wc_InitSakkeKey_ex(&key2, 128, ECC_SAKKE_1, NULL,
|
||||
INVALID_DEVID), 0);
|
||||
ExpectIntEQ(wc_ImportSakkePublicKey(&key2, pubKeyData, pubKeySz, 0), 0);
|
||||
@@ -784,7 +784,7 @@ int test_wc_Sakke_FeatureCoverage(void)
|
||||
|
||||
pubKeySz = sizeof(pubKeyData);
|
||||
ExpectIntEQ(wc_ExportSakkePublicKey(&key, pubKeyData, &pubKeySz, 0), 0);
|
||||
ExpectIntEQ(pubKeySz, 257u);
|
||||
ExpectIntEQ(pubKeySz, 257U);
|
||||
ExpectIntEQ(pubKeyData[0], 0x04);
|
||||
ExpectIntEQ(wc_InitSakkeKey_ex(&key2, 128, ECC_SAKKE_1, NULL,
|
||||
INVALID_DEVID), 0);
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
*
|
||||
* if ((err == MP_OKAY) && <next step>) ... (drive on FALSE)
|
||||
* if ((tmp = XMALLOC(...)) == NULL || ...) ... (drive each operand)
|
||||
* if ((ret != MP_INIT_E) && (ret != MEMORY_E)) ... (drive the MEMORY_E half)
|
||||
* if ((ret not MP_INIT_E) && (ret not MEMORY_E)) ... (drive the MEMORY_E half)
|
||||
*
|
||||
* In normal execution every allocation succeeds, so err/ret stays MP_OKAY and
|
||||
* these decisions never take the failure branch. The only way to exercise the
|
||||
* failure half is to make an EARLIER allocation/init fail so the success chain
|
||||
* is broken with ret == MEMORY_E.
|
||||
* is broken with ret is MEMORY_E.
|
||||
*
|
||||
* wolfSSL routes ALL heap traffic through XMALLOC/XREALLOC/XFREE, which in a
|
||||
* default (non-static, non-debug) build dispatch to the process-wide allocator
|
||||
|
||||
@@ -54,24 +54,24 @@ int main(void)
|
||||
XMEMSET(key, 0, sizeof(key));
|
||||
|
||||
/* blake2b_init(): !outlen || outlen > BLAKE2B_OUTBYTES */
|
||||
if (blake2b_init(&bs, 0) != BAD_FUNC_ARG) wb_fail = 1;
|
||||
if (blake2b_init(&bs, BLAKE2B_OUTBYTES + 1) != BAD_FUNC_ARG) wb_fail = 1;
|
||||
if (blake2b_init(&bs, 0) != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
if (blake2b_init(&bs, BLAKE2B_OUTBYTES + 1) != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
if (blake2b_init(&bs, BLAKE2B_OUTBYTES) != 0) wb_fail = 1;
|
||||
|
||||
/* blake2b_init_key(): outlen bound, key/keylen held valid to isolate it. */
|
||||
if (blake2b_init_key(&bs, 0, key, BLAKE2B_KEYBYTES) != BAD_FUNC_ARG)
|
||||
if (blake2b_init_key(&bs, 0, key, BLAKE2B_KEYBYTES) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (blake2b_init_key(&bs, BLAKE2B_OUTBYTES + 1, key, BLAKE2B_KEYBYTES)
|
||||
!= BAD_FUNC_ARG) wb_fail = 1;
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
|
||||
/* blake2b_init_key(): !key || !keylen || keylen > BLAKE2B_KEYBYTES,
|
||||
* outlen held valid to isolate this decision. */
|
||||
if (blake2b_init_key(&bs, BLAKE2B_OUTBYTES, NULL, BLAKE2B_KEYBYTES)
|
||||
!= BAD_FUNC_ARG) wb_fail = 1;
|
||||
if (blake2b_init_key(&bs, BLAKE2B_OUTBYTES, key, 0) != BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
if (blake2b_init_key(&bs, BLAKE2B_OUTBYTES, key, 0) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (blake2b_init_key(&bs, BLAKE2B_OUTBYTES, key, BLAKE2B_KEYBYTES + 1)
|
||||
!= BAD_FUNC_ARG) wb_fail = 1;
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
/* Baseline: both decisions false on both lines. */
|
||||
if (blake2b_init_key(&bs, BLAKE2B_OUTBYTES, key, BLAKE2B_KEYBYTES) != 0)
|
||||
wb_fail = 1;
|
||||
|
||||
@@ -46,24 +46,24 @@ int main(void)
|
||||
XMEMSET(key, 0, sizeof(key));
|
||||
|
||||
/* blake2s_init(): !outlen || outlen > BLAKE2S_OUTBYTES */
|
||||
if (blake2s_init(&bs, 0) != BAD_FUNC_ARG) wb_fail = 1;
|
||||
if (blake2s_init(&bs, BLAKE2S_OUTBYTES + 1) != BAD_FUNC_ARG) wb_fail = 1;
|
||||
if (blake2s_init(&bs, 0) != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
if (blake2s_init(&bs, BLAKE2S_OUTBYTES + 1) != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
if (blake2s_init(&bs, BLAKE2S_OUTBYTES) != 0) wb_fail = 1;
|
||||
|
||||
/* blake2s_init_key(): outlen bound, key/keylen held valid to isolate it. */
|
||||
if (blake2s_init_key(&bs, 0, key, BLAKE2S_KEYBYTES) != BAD_FUNC_ARG)
|
||||
if (blake2s_init_key(&bs, 0, key, BLAKE2S_KEYBYTES) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (blake2s_init_key(&bs, BLAKE2S_OUTBYTES + 1, key, BLAKE2S_KEYBYTES)
|
||||
!= BAD_FUNC_ARG) wb_fail = 1;
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
|
||||
/* blake2s_init_key(): !key || !keylen || keylen > BLAKE2S_KEYBYTES,
|
||||
* outlen held valid to isolate this decision. */
|
||||
if (blake2s_init_key(&bs, BLAKE2S_OUTBYTES, NULL, BLAKE2S_KEYBYTES)
|
||||
!= BAD_FUNC_ARG) wb_fail = 1;
|
||||
if (blake2s_init_key(&bs, BLAKE2S_OUTBYTES, key, 0) != BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
if (blake2s_init_key(&bs, BLAKE2S_OUTBYTES, key, 0) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (blake2s_init_key(&bs, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES + 1)
|
||||
!= BAD_FUNC_ARG) wb_fail = 1;
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG)) wb_fail = 1;
|
||||
/* Baseline: both decisions false on both lines. */
|
||||
if (blake2s_init_key(&bs, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES) != 0)
|
||||
wb_fail = 1;
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
* chains that only diverge when an EARLIER heap allocation fails, e.g.
|
||||
*
|
||||
* wc_MakeDsaParameters: if (((tmp=XMALLOC(..))==NULL) || ((tmp2=XMALLOC..)==NULL))
|
||||
* if ((err != MP_INIT_E) && (err != MEMORY_E)) mp_clear(tmp);
|
||||
* if ((err not MP_INIT_E) && (err not MEMORY_E)) mp_clear(tmp);
|
||||
* wc_DsaSign_ex: if ((k==NULL)||(kInv==NULL)||...||(buffer==NULL))
|
||||
* if ((ret != MP_INIT_E) && (ret != MEMORY_E)) mp_forcezero(k);
|
||||
* if ((ret not MP_INIT_E) && (ret not MEMORY_E)) mp_forcezero(k);
|
||||
* wc_DsaVerify_ex: if ((w==NULL)||(u1==NULL)||...||(s==NULL))
|
||||
* if (ret != MP_INIT_E && ret != MEMORY_E) mp_clear(s);
|
||||
* if (ret not MP_INIT_E && ret not MEMORY_E) mp_clear(s);
|
||||
*
|
||||
* In normal execution every XMALLOC succeeds, so these decisions never take the
|
||||
* failure branch. This white-box installs the generic heap-fault injector
|
||||
|
||||
@@ -84,17 +84,17 @@ int main(void)
|
||||
XMEMSET(buf, 0, sizeof(buf));
|
||||
|
||||
/* I2OSP() (hpke.c:86): w <= 0 || w > 32 || n < 0 */
|
||||
if (I2OSP(0, 0, buf) != MP_VAL) /* w <= 0 true, short-circuits */
|
||||
if (I2OSP(0, 0, buf) != WC_NO_ERR_TRACE(MP_VAL)) /* w <= 0 true, short-circuits */
|
||||
wb_fail = 1;
|
||||
if (I2OSP(0, 33, buf) != MP_VAL) /* w <= 0 false, w > 32 true */
|
||||
if (I2OSP(0, 33, buf) != WC_NO_ERR_TRACE(MP_VAL)) /* w <= 0 false, w > 32 true */
|
||||
wb_fail = 1;
|
||||
if (I2OSP(-1, 4, buf) != MP_VAL) /* w<=0, w>32 false, n < 0 true */
|
||||
if (I2OSP(-1, 4, buf) != WC_NO_ERR_TRACE(MP_VAL)) /* w<=0, w>32 false, n < 0 true */
|
||||
wb_fail = 1;
|
||||
if (I2OSP(1, 4, buf) != 0) /* all three false -> valid path */
|
||||
wb_fail = 1;
|
||||
|
||||
/* I2OSP() (hpke.c:91): w < 4 && n > ((1 << (w * 8)) - 1) */
|
||||
if (I2OSP(256, 1, buf) != MP_VAL) /* w<4 true, n>max(255) true */
|
||||
if (I2OSP(256, 1, buf) != WC_NO_ERR_TRACE(MP_VAL)) /* w<4 true, n>max(255) true */
|
||||
wb_fail = 1;
|
||||
if (I2OSP(255, 1, buf) != 0) /* w<4 true, n>max false */
|
||||
wb_fail = 1;
|
||||
@@ -150,10 +150,10 @@ int main(void)
|
||||
/* wc_HpkeContextComputeNonce() (hpke.c:632):
|
||||
* hpke == NULL || context == NULL */
|
||||
if (wc_HpkeContextComputeNonce(NULL, &context, nonceOut)
|
||||
!= BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (wc_HpkeContextComputeNonce(&hpke, NULL, nonceOut)
|
||||
!= BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
context.seq = 0;
|
||||
XMEMSET(context.base_nonce, 0, sizeof(context.base_nonce));
|
||||
@@ -164,16 +164,16 @@ int main(void)
|
||||
* ephemeralKey == NULL || receiverKey == NULL ||
|
||||
* sharedSecret == NULL */
|
||||
if (wc_HpkeEncap(NULL, ephemeralKey, receiverKey, sharedSecretA)
|
||||
!= BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (wc_HpkeEncap(&hpke, NULL, receiverKey, sharedSecretA)
|
||||
!= BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (wc_HpkeEncap(&hpke, ephemeralKey, NULL, sharedSecretA)
|
||||
!= BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (wc_HpkeEncap(&hpke, ephemeralKey, receiverKey, NULL)
|
||||
!= BAD_FUNC_ARG)
|
||||
!= WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
/* baseline: all operands valid -> decision false, real DH+KDF */
|
||||
if (wc_HpkeEncap(&hpke, ephemeralKey, receiverKey, sharedSecretA)
|
||||
@@ -183,10 +183,10 @@ int main(void)
|
||||
/* wc_HpkeDecap() (hpke.c:1032): hpke == NULL ||
|
||||
* receiverKey == NULL */
|
||||
if (wc_HpkeDecap(NULL, receiverKey, ephemeralPubKey,
|
||||
ephemeralPubKeySz, sharedSecretB) != BAD_FUNC_ARG)
|
||||
ephemeralPubKeySz, sharedSecretB) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
if (wc_HpkeDecap(&hpke, NULL, ephemeralPubKey,
|
||||
ephemeralPubKeySz, sharedSecretB) != BAD_FUNC_ARG)
|
||||
ephemeralPubKeySz, sharedSecretB) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
wb_fail = 1;
|
||||
/* baseline: both operands valid -> decision false, real
|
||||
* receiver-side DH+KDF using the ephemeral's serialized public
|
||||
|
||||
@@ -145,28 +145,28 @@ static void wb_peek_line_data_ret_or(void)
|
||||
#if defined(WOLFSSL_HAVE_ERROR_QUEUE) && !defined(ERROR_QUEUE_PER_THREAD)
|
||||
unsigned long uret;
|
||||
|
||||
/* (1) ret == BAD_MUTEX_E -> 1st operand TRUE, decision TRUE, function
|
||||
/* (1) ret is BAD_MUTEX_E -> 1st operand TRUE, decision TRUE, function
|
||||
* returns 0 without ever reaching the ignore_err check. */
|
||||
wc_ClearErrorNodes();
|
||||
WB_CHECK(wc_AddErrorNode(BAD_MUTEX_E, 10, (char*)"bad mutex node",
|
||||
(char*)"synthetic.c") == 0, "AddErrorNode(BAD_MUTEX_E)");
|
||||
uret = wc_PeekErrorNodeLineData(NULL, NULL, NULL, NULL, NULL);
|
||||
WB_CHECK(uret == 0, ":1504 ret==BAD_MUTEX_E short-circuits to 0");
|
||||
WB_CHECK(uret == 0, ":1504 ret is BAD_MUTEX_E short-circuits to 0");
|
||||
|
||||
/* (2) ret == BAD_FUNC_ARG -> 1st operand FALSE, 2nd operand TRUE,
|
||||
/* (2) ret is BAD_FUNC_ARG -> 1st operand FALSE, 2nd operand TRUE,
|
||||
* decision TRUE via the 2nd operand. */
|
||||
wc_ClearErrorNodes();
|
||||
WB_CHECK(wc_AddErrorNode(BAD_FUNC_ARG, 20, (char*)"bad func arg node",
|
||||
(char*)"synthetic.c") == 0, "AddErrorNode(BAD_FUNC_ARG)");
|
||||
uret = wc_PeekErrorNodeLineData(NULL, NULL, NULL, NULL, NULL);
|
||||
WB_CHECK(uret == 0, ":1504 ret==BAD_FUNC_ARG short-circuits to 0");
|
||||
WB_CHECK(uret == 0, ":1504 ret is BAD_FUNC_ARG short-circuits to 0");
|
||||
|
||||
/* (3) ret == BAD_STATE_E via the *natural* empty-queue path (1st and
|
||||
/* (3) ret is BAD_STATE_E via the *natural* empty-queue path (1st and
|
||||
* 2nd operands FALSE, 3rd operand TRUE): peekErrorNode() returns
|
||||
* BAD_STATE_E itself when the queue has no nodes at all. */
|
||||
wc_ClearErrorNodes();
|
||||
uret = wc_PeekErrorNodeLineData(NULL, NULL, NULL, NULL, NULL);
|
||||
WB_CHECK(uret == 0, ":1504 empty queue -> ret==BAD_STATE_E -> 0");
|
||||
WB_CHECK(uret == 0, ":1504 empty queue -> ret is BAD_STATE_E -> 0");
|
||||
|
||||
/* (4) all three operands FALSE: a node whose stored value is a normal,
|
||||
* non-sentinel error code. Decision FALSE, execution falls through to
|
||||
@@ -181,7 +181,7 @@ static void wb_peek_line_data_ret_or(void)
|
||||
|
||||
wc_ClearErrorNodes();
|
||||
|
||||
WB_NOTE("wc_PeekErrorNodeLineData ret==BAD_MUTEX_E/BAD_FUNC_ARG/"
|
||||
WB_NOTE("wc_PeekErrorNodeLineData ret is BAD_MUTEX_E/BAD_FUNC_ARG/"
|
||||
"BAD_STATE_E OR (:1504) covered -- all 3 operands independently "
|
||||
"true, plus all-false");
|
||||
#else
|
||||
@@ -288,7 +288,7 @@ static void wb_get_error_node_current_idx(void)
|
||||
== 0, "AddErrorNode #1");
|
||||
WB_CHECK(wc_AddErrorNode(BUFFER_E, 61, (char*)"n2", (char*)"f2")
|
||||
== 0, "AddErrorNode #2");
|
||||
WB_CHECK(wc_PullErrorNode(NULL, NULL, NULL) == WC_KEY_SIZE_E,
|
||||
WB_CHECK(wc_PullErrorNode(NULL, NULL, NULL) == WC_NO_ERR_TRACE(WC_KEY_SIZE_E),
|
||||
":1340 setup pull #1");
|
||||
idx = getErrorNodeCurrentIdx();
|
||||
WB_CHECK(idx == 1,
|
||||
|
||||
@@ -24,19 +24,19 @@
|
||||
*
|
||||
* wc_mlkem.c's residual uncovered decisions are the FALSE half of allocation
|
||||
* success chains that only diverge when an EARLIER heap allocation fails,
|
||||
* leaving ret == MEMORY_E when the guard is reached:
|
||||
* leaving ret is MEMORY_E when the guard is reached:
|
||||
*
|
||||
* wc_MlKemKey_Encapsulate (WOLFSSL_MLKEM_CACHE_A arm):
|
||||
* if ((ret == 0) && ((key->flags & MLKEM_FLAG_A_SET) != 0)) { ... }
|
||||
* -- the ret==0 FALSE half (wc_mlkem.c:1226) needs the up-front working
|
||||
* buffer y (XMALLOC, wc_mlkem.c:1198) to fail so ret==MEMORY_E reaches
|
||||
* buffer y (XMALLOC, wc_mlkem.c:1198) to fail so ret is MEMORY_E reaches
|
||||
* the cached-matrix transpose guard.
|
||||
*
|
||||
* wc_mlkemkey_check_h (called by Encapsulate/Decapsulate):
|
||||
* if ((ret == 0) && ((key->flags & MLKEM_FLAG_H_SET) == 0)) ret=BAD_STATE_E;
|
||||
* -- the ret==0 FALSE half (wc_mlkem.c:1373:...:0) needs the encoded-
|
||||
* public-key buffer pubKey (XMALLOC, wc_mlkem.c:1357) to fail so the
|
||||
* re-check sees ret==MEMORY_E. (The SECOND condition, MLKEM_FLAG_H_SET,
|
||||
* re-check sees ret is MEMORY_E. (The SECOND condition, MLKEM_FLAG_H_SET,
|
||||
* is a defensive/impossible-state check -- reaching it True with ret==0
|
||||
* means EncodePublicKey succeeded yet left the h flag unset, which the
|
||||
* working encode never does -- so 1373:...:1 is NOT alloc-closable and
|
||||
@@ -218,7 +218,7 @@ int main(int argc, char** argv)
|
||||
|
||||
/* --- wc_MlKemKey_Encapsulate: the up-front working buffer y
|
||||
* (wc_mlkem.c:1198) is the first allocation, so a low fail-index makes
|
||||
* ret==MEMORY_E before the noise/matrix/maths steps. Under the
|
||||
* ret is MEMORY_E before the noise/matrix/maths steps. Under the
|
||||
* WOLFSSL_MLKEM_CACHE_A arm this drives the ret==0 FALSE half of the
|
||||
* cached-matrix transpose guard (wc_mlkem.c:1226:...:0); under the other
|
||||
* arms it drives encapsulate's own alloc-cleanup halves. Encapsulate
|
||||
@@ -243,7 +243,7 @@ int main(int argc, char** argv)
|
||||
/* --- wc_mlkemkey_check_h standalone: its single XMALLOC is the encoded
|
||||
* public-key buffer pubKey (wc_mlkem.c:1357). Clearing MLKEM_FLAG_H_SET
|
||||
* each iteration re-enters the encode-and-hash body; faulting pubKey
|
||||
* (n=1) leaves ret==MEMORY_E at the re-check (wc_mlkem.c:1373:...:0
|
||||
* (n=1) leaves ret is MEMORY_E at the re-check (wc_mlkem.c:1373:...:0
|
||||
* FALSE half). K=6 covers the one site with margin. --- */
|
||||
for (n = 1; n <= 6; n++) {
|
||||
key.flags &= ~(int)MLKEM_FLAG_H_SET;
|
||||
|
||||
Reference in New Issue
Block a user