Skip to content

Commit 05c29df

Browse files
committed
fix(esp32c3/xts_aes): Fix shadowed declaration of a variable
1 parent 03a7ee3 commit 05c29df

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hw/misc/esp32c3_xts_aes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,17 @@ static void esp32c3_xts_aes_decrypt(ESP32C3XtsAesState *s, uint32_t physical_add
161161
memset(tweak + 4, 0, 12);
162162

163163
memcpy(input_ciphertext, data + i, ESP32C3_XTS_AES_DATA_UNIT_SIZE);
164-
for (int i = 0; i < ESP32C3_XTS_AES_DATA_UNIT_SIZE; i++) {
165-
input_ciphertext_reversed[i] = input_ciphertext[ESP32C3_XTS_AES_DATA_UNIT_SIZE-i-1];
164+
for (int j = 0; j < ESP32C3_XTS_AES_DATA_UNIT_SIZE; j++) {
165+
input_ciphertext_reversed[j] = input_ciphertext[ESP32C3_XTS_AES_DATA_UNIT_SIZE-j-1];
166166
}
167167

168168
xts_decrypt(&aesdata, &aestweak,
169169
xts_aes_encrypt,
170170
xts_aes_decrypt,
171171
tweak, ESP32C3_XTS_AES_DATA_UNIT_SIZE, output_plaintext_reversed, input_ciphertext_reversed);
172172

173-
for (int i = 0; i < ESP32C3_XTS_AES_DATA_UNIT_SIZE; i++) {
174-
output_plaintext[i] = output_plaintext_reversed[ESP32C3_XTS_AES_DATA_UNIT_SIZE-i-1];
173+
for (int j = 0; j < ESP32C3_XTS_AES_DATA_UNIT_SIZE; j++) {
174+
output_plaintext[j] = output_plaintext_reversed[ESP32C3_XTS_AES_DATA_UNIT_SIZE-j-1];
175175
}
176176

177177
memcpy(data + i, output_plaintext, ESP32C3_XTS_AES_DATA_UNIT_SIZE);

0 commit comments

Comments
 (0)