mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-10 05:20:52 +02:00
fc1bb6395d
The generic wc_AesEncrypt/wc_AesDecrypt (aes.c) reject an AES object whose key schedule was never set (rounds outside 1..7 after halving) with KEYUSAGE_E, and every mode inherits that through their int return. The RISC-V port's block helpers are void, so nothing reported unkeyed use: wc_AesEncryptDirect and wc_AesCcmEncrypt/Decrypt silently processed with a garbage schedule, and wc_AesCtrEncrypt classified it as BAD_FUNC_ARG instead of KEYUSAGE_E. Align the port with the generic error contract: * wc_AesEncryptDirect / wc_AesDecryptDirect: add the generic rounds check (also fixes wc_CmacUpdate error reporting, which goes through wc_AesEncryptDirect on this port) * wc_AesCcmEncrypt / wc_AesCcmDecrypt: same check after the argument sanity block * wc_AesCtrEncrypt (both variants): the existing rounds switch now returns KEYUSAGE_E instead of BAD_FUNC_ARG Found by the ISO 26262 MC/DC campaign argument-matrix tests (test_wc_AesSetKeyArgMcdc, test_wc_AesModesArgMcdc, test_wc_AesCcmArgMcdc, test_wc_CmacArgMcdc) under qemu-riscv64.