1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15576 from Hxinrong/aes_encryptBranch

add error check of aes_encrypt()
This commit is contained in:
Teufelchen 2024-01-30 19:19:34 +00:00 committed by GitHub
commit 0d04b730e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,6 +53,7 @@ static void fortuna_reseed(fortuna_state_t *state, const uint8_t *seed,
/*
* Corresponds to section 9.4.3.
* Returns 0 on success; A negative value otherwise
*/
static int fortuna_generate_blocks(fortuna_state_t *state, uint8_t *out,
size_t blocks)
@ -75,7 +76,10 @@ static int fortuna_generate_blocks(fortuna_state_t *state, uint8_t *out,
}
for (size_t i = 0; i < blocks; i++) {
aes_encrypt(&cipher, state->gen.counter.bytes, out + (i * 16));
res = aes_encrypt(&cipher, state->gen.counter.bytes, out + (i * 16));
if (res != 1) {
return -3;
}
fortuna_increment_counter(state);
}