Skip to content

Commit

Permalink
Remove aad_len check on NULL out buffer (#6820)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtropets authored Feb 10, 2025
1 parent 8b274d4 commit 6866055
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/crypto/openssl/symmetric_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ namespace ccf::crypto
{
int aad_outl{0};
CHECK1(EVP_EncryptUpdate(ctx, NULL, &aad_outl, aad.data(), aad.size()));

// As we set out buffer to NULL, we expect the output length to be 0.
// However, openssl 1.1.1 sets it to the input length, which doesn't break
// the encryption, but still looks wrong.
#if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3
assert(aad_outl == 0);
#endif
}

std::vector<uint8_t> ciphertext(plain.size());
Expand Down Expand Up @@ -124,13 +117,6 @@ namespace ccf::crypto
{
int aad_outl{0};
CHECK1(EVP_DecryptUpdate(ctx, NULL, &aad_outl, aad.data(), aad.size()));

// As we set out buffer to NULL, we expect the output length to be 0.
// However, openssl 1.1.1 sets it to the input length, which doesn't break
// the encryption, but still looks wrong.
#if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3
assert(aad_outl == 0);
#endif
}

std::vector<uint8_t> plaintext(cipher.size());
Expand Down

0 comments on commit 6866055

Please sign in to comment.