Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sw/device/lib/crypto/impl/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ static otcrypto_status_t otcrypto_aes_impl(
// Construct the IV and check its length. ECB mode will ignore the IV, so in
// this case it is left uninitialized.
aes_block_t aes_iv;
if (aes_mode == kAesCipherModeEcb) {
HARDENED_CHECK_EQ(launder32(aes_mode), kAesCipherModeEcb);
if (aes_mode == kOtcryptoAesModeEcb) {
HARDENED_CHECK_EQ(launder32(aes_mode), kOtcryptoAesModeEcb);
} else {
HARDENED_CHECK_NE(launder32(aes_mode), kAesCipherModeEcb);
HARDENED_CHECK_NE(launder32(aes_mode), kOtcryptoAesModeEcb);

// The IV must be exactly one block long.
if (iv->len != kAesBlockNumWords) {
Expand Down Expand Up @@ -457,7 +457,7 @@ static otcrypto_status_t otcrypto_aes_impl(
HARDENED_TRY(aes_verify_ctrl_aux_reg());

// Deinitialize the AES block and update the IV (in ECB mode, skip the IV).
if (aes_mode == kAesCipherModeEcb) {
if (aes_mode == kOtcryptoAesModeEcb) {
HARDENED_TRY(aes_end(NULL));
} else {
HARDENED_TRY(aes_end(&aes_iv));
Expand Down
Loading