Fix CI: reject no-key AES-CBC on RISC-V backend (F-6151)

The RISC-V assembly CBC encrypt/decrypt paths return before the generic
keyInstalled guard, so wc_AesCbcEncrypt/Decrypt accepted a call with no
key set. aes_no_key_set_test caught this on the riscv64-o0 config. Add
the guard to the RISC-V dispatch, matching the other backends.
pull/10762/head
Juliusz Sosinowicz 2026-07-20 02:21:54 +00:00
parent 44965314ae
commit aaf9c7e2cb
1 changed files with 8 additions and 0 deletions

View File

@ -7220,6 +7220,10 @@ int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
#endif
#if defined(WOLFSSL_RISCV_ASM)
if (aes->keyInstalled == 0) {
WOLFSSL_MSG("AES key not set");
return BAD_FUNC_ARG;
}
AES_CBC_encrypt_RISCV64(in, out, sz, (byte*)aes->reg, (byte*)aes->key,
(int)aes->rounds);
(void)blocks;
@ -7466,6 +7470,10 @@ int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
}
#if defined(WOLFSSL_RISCV_ASM)
if (aes->keyInstalled == 0) {
WOLFSSL_MSG("AES key not set");
return BAD_FUNC_ARG;
}
AES_CBC_decrypt_RISCV64(in, out, sz, (byte*)aes->reg, (byte*)aes->key,
(int)aes->rounds);
(void)blocks;