Skip to content

Commit

Permalink
SCP11: Fix decrypting empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Nov 18, 2024
1 parent ed2031f commit 7758295
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/aes_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ ykpiv_rc
aesecb_decrypt_data(uint8_t *key, uint8_t counter, uint8_t *enc, size_t enc_len, uint8_t *data, size_t *data_len) {
ykpiv_rc rc = YKPIV_OK;
#if (OPENSSL_VERSION_NUMBER > 0x10100000L)
if(enc_len == 0) {
DBG("No data to decrypt");
*data_len = 0;
return YKPIV_OK;
}

uint8_t iv[SCP11_BLOCK_SIZE] = {0};
if ((rc = scp11_get_iv(key, counter, iv, true)) != YKPIV_OK) {
DBG("Failed to calculate decryption IV");
Expand Down

0 comments on commit 7758295

Please sign in to comment.