Skip to content

Commit e7f708f

Browse files
committed
Keep the valid ARM32 AES CFB white-box baseline
1 parent f5027fc commit e7f708f

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

‎tests/unit-mcdc/test_aes_whitebox.c‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,13 +1931,11 @@ static void wb_gcm_setiv_carry(void)
19311931
#endif
19321932

19331933
/* ------------------------------------------------------------------------- *
1934-
* Class 15: AesCfbDecrypt_C()'s main loop ret guard (aes.c ~17963, idx0).
1934+
* Class 15: AesCfbDecrypt_C()'s two-block loop on ARM32.
19351935
*
19361936
* while ((ret == 0) && (sz >= 2 * WC_AES_BLOCK_SIZE))
1937-
* The loop compiles under USE_INTEL_SPEEDUP or WOLFSSL_ARMASM with
1938-
* HAVE_AES_ECB; only the ARMASM lane is in the matrix. A zero-round context
1939-
* makes the first block-cipher call fail (KEYUSAGE_E) with sz >= 2 blocks,
1940-
* so the loop's ret == 0 operand is false.
1937+
* The healthy two-block row exercises loop entry. The ARM32 NEON block
1938+
* encryption path does not report a key-usage error for zero rounds.
19411939
* ------------------------------------------------------------------------- */
19421940
#if defined(WOLFSSL_ARMASM) && !defined(__aarch64__) && \
19431941
defined(HAVE_AES_ECB) && defined(WOLFSSL_AES_CFB) && \
@@ -1961,19 +1959,15 @@ static void wb_cfb_decrypt_loop(void)
19611959
return;
19621960
}
19631961

1964-
/* idx0 T: a healthy key, two blocks. */
1965-
if (wc_AesSetKey(&aes, key, sizeof(key), iv, AES_DECRYPTION) == 0) {
1962+
ret = wc_AesSetKey(&aes, key, sizeof(key), iv, AES_ENCRYPTION);
1963+
WB_CHECK(ret == 0, "CFB decrypt baseline key setup expected 0");
1964+
if (ret == 0) {
19661965
ret = wc_AesCfbDecrypt(&aes, out, in, sizeof(in));
19671966
WB_CHECK(ret == 0, "CFB decrypt baseline expected 0");
1967+
WB_NOTE("CFB decrypt two-block baseline exercised");
19681968
}
1969-
/* idx0 F: a zero-round context fails the first block cipher call. */
1970-
aes.rounds = 0;
1971-
ret = wc_AesCfbDecrypt(&aes, out, in, sizeof(in));
1972-
WB_CHECK(ret == WC_NO_ERR_TRACE(KEYUSAGE_E),
1973-
"corrupt-rounds CFB decrypt row expected KEYUSAGE_E");
19741969

19751970
wc_AesFree(&aes);
1976-
WB_NOTE("CFB decrypt main-loop ret guard pair exercised");
19771971
}
19781972
#else
19791973
static void wb_cfb_decrypt_loop(void)

0 commit comments

Comments
 (0)