Skip to content

Commit

Permalink
Merge branch 'fix/mbedtls_null_pointer_dereference' into 'master'
Browse files Browse the repository at this point in the history
mbedtls: fix null pointer dereference of variable iv_off

See merge request espressif/esp-idf!22122
  • Loading branch information
mahavirj committed Jan 25, 2023
2 parents ef242ed + 7589975 commit d825753
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/mbedtls/port/aes/block/esp_aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,6 @@ int esp_aes_crypt_cfb128(esp_aes_context *ctx,
const unsigned char *input,
unsigned char *output )
{
int c;
size_t n = *iv_off;

if (esp_aes_validate_input(ctx, input, output)) {
return MBEDTLS_ERR_AES_BAD_INPUT_DATA;
}
Expand All @@ -335,6 +332,8 @@ int esp_aes_crypt_cfb128(esp_aes_context *ctx,
return MBEDTLS_ERR_AES_INVALID_KEY_LENGTH;
}

int c;
size_t n = *iv_off;
esp_aes_acquire_hardware();
ctx->key_in_hardware = 0;
ctx->key_in_hardware = aes_hal_setkey(ctx->key, ctx->key_bytes, ESP_AES_ENCRYPT);
Expand Down

0 comments on commit d825753

Please sign in to comment.