mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
hwcrypto aes: Fix bugs w/ ECB decrypt, CFB modes
This commit is contained in:
parent
d951ab2661
commit
2211759cc0
@ -124,7 +124,7 @@ static inline int esp_aes_setkey_hardware( esp_aes_context *ctx, int mode)
|
|||||||
if ( mode == ESP_AES_ENCRYPT ) {
|
if ( mode == ESP_AES_ENCRYPT ) {
|
||||||
ets_aes_setkey_enc(ctx->enc.key, ctx->enc.aesbits);
|
ets_aes_setkey_enc(ctx->enc.key, ctx->enc.aesbits);
|
||||||
} else {
|
} else {
|
||||||
ets_aes_setkey_dec(ctx->enc.key, ctx->enc.aesbits);
|
ets_aes_setkey_dec(ctx->dec.key, ctx->dec.aesbits);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ int esp_aes_crypt_cfb128( esp_aes_context *ctx,
|
|||||||
size_t n = *iv_off;
|
size_t n = *iv_off;
|
||||||
|
|
||||||
esp_aes_acquire_hardware();
|
esp_aes_acquire_hardware();
|
||||||
esp_aes_setkey_hardware(ctx, mode);
|
esp_aes_setkey_hardware(ctx, ESP_AES_ENCRYPT);
|
||||||
|
|
||||||
if ( mode == ESP_AES_DECRYPT ) {
|
if ( mode == ESP_AES_DECRYPT ) {
|
||||||
while ( length-- ) {
|
while ( length-- ) {
|
||||||
@ -290,7 +290,7 @@ int esp_aes_crypt_cfb8( esp_aes_context *ctx,
|
|||||||
unsigned char ov[17];
|
unsigned char ov[17];
|
||||||
|
|
||||||
esp_aes_acquire_hardware();
|
esp_aes_acquire_hardware();
|
||||||
esp_aes_setkey_hardware(ctx, mode);
|
esp_aes_setkey_hardware(ctx, ESP_AES_ENCRYPT);
|
||||||
|
|
||||||
while ( length-- ) {
|
while ( length-- ) {
|
||||||
memcpy( ov, iv, 16 );
|
memcpy( ov, iv, 16 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user