Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions src/crypto/libgcrypt/cryptography_interface_libgcrypt.template.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ static int32_t cryptography_authenticate(
}
// Using to fix warning
len_data_out = len_data_out;
iv = iv;
iv_len = iv_len;
ecs = ecs;
cam_cookies = cam_cookies;

Expand Down Expand Up @@ -168,19 +170,6 @@ static int32_t cryptography_authenticate(
return status;
}

// If MAC needs IV, set it (only for certain ciphers)
if (iv_len > 0)
{
gcry_error = gcry_mac_setiv(tmp_mac_hd, iv, iv_len);
if ((gcry_error & GPG_ERR_CODE_MASK) != GPG_ERR_NO_ERROR)
{
printf(KRED "ERROR: gcry_mac_setiv error code %d\n" RESET, gcry_error & GPG_ERR_CODE_MASK);
printf(KRED "Failure: %s/%s\n", gcry_strsource(gcry_error), gcry_strerror(gcry_error));
status = CRYPTO_LIB_ERROR;
gcry_mac_close(tmp_mac_hd);
return status;
}
}

gcry_error = gcry_mac_write(tmp_mac_hd,
aad, // additional authenticated data
Expand Down Expand Up @@ -240,6 +229,8 @@ static int32_t cryptography_validate_authentication(uint8_t *data_out, size_t le
return CRYPTO_LIB_ERR_NULL_BUFFER;
}
// Using to fix warning
iv = iv;
iv_len = iv_len;
ecs = ecs;
cam_cookies = cam_cookies;

Expand Down Expand Up @@ -277,19 +268,6 @@ static int32_t cryptography_validate_authentication(uint8_t *data_out, size_t le
status = CRYPTO_LIB_ERR_LIBGCRYPT_ERROR;
return status;
}
// If MAC needs IV, set it (only for certain ciphers)
if (iv_len > 0)
{
gcry_error = gcry_mac_setiv(tmp_mac_hd, iv, iv_len);
if ((gcry_error & GPG_ERR_CODE_MASK) != GPG_ERR_NO_ERROR)
{
printf(KRED "ERROR: gcry_mac_setiv error code %d\n" RESET, gcry_error & GPG_ERR_CODE_MASK);
printf(KRED "Failure: %s/%s\n" RESET, gcry_strsource(gcry_error), gcry_strerror(gcry_error));
gcry_mac_close(tmp_mac_hd);
status = CRYPTO_LIB_ERROR;
return status;
}
}
gcry_error = gcry_mac_write(tmp_mac_hd,
aad, // additional authenticated data
aad_len // length of AAD
Expand Down