Skip to content

Commit

Permalink
Merge branch 'bugfix/supplicant_tls_fix' into 'master'
Browse files Browse the repository at this point in the history
fix(wpa_supplicant): Correct iv lenght passed in mbedtls_cipher_set_iv()

Closes WIFIBUG-212

See merge request espressif/esp-idf!26837
  • Loading branch information
jack0c committed Nov 2, 2023
2 parents 9570329 + 442f802 commit b10580f
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,16 +506,19 @@ static int crypto_init_cipher_ctx(mbedtls_cipher_context_t *ctx,
return -1;
}

if (mbedtls_cipher_setkey(ctx, key, key_len * 8, operation) != 0) {
wpa_printf(MSG_ERROR, "mbedtls_cipher_setkey returned error");
ret = mbedtls_cipher_setkey(ctx, key, key_len * 8, operation);
if (ret != 0) {
wpa_printf(MSG_ERROR, "mbedtls_cipher_setkey returned error=%d", ret);
return -1;
}
if (mbedtls_cipher_set_iv(ctx, iv, cipher_info->MBEDTLS_PRIVATE(iv_size)) != 0) {
wpa_printf(MSG_ERROR, "mbedtls_cipher_set_iv returned error");
ret = mbedtls_cipher_set_iv(ctx, iv, cipher_info->MBEDTLS_PRIVATE(iv_size) << MBEDTLS_IV_SIZE_SHIFT);
if (ret != 0) {
wpa_printf(MSG_ERROR, "mbedtls_cipher_set_iv returned error=%d", ret);
return -1;
}
if (mbedtls_cipher_reset(ctx) != 0) {
wpa_printf(MSG_ERROR, "mbedtls_cipher_reset() returned error");
ret = mbedtls_cipher_reset(ctx);
if (ret != 0) {
wpa_printf(MSG_ERROR, "mbedtls_cipher_reset() returned error=%d", ret);
return -1;
}

Expand Down

0 comments on commit b10580f

Please sign in to comment.