refactor: use feature probe for AEAD gate logic instead of AWS-LC/BoringSSL macros #4642
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolved issues:
Resolves #4575
Description of changes:
S2N_LIBCRYPTO_SUPPORTS_EVP_AEAD_TLS
Call-outs:
I also tried to update this macro:
s2n-tls/crypto/s2n_cipher.h
Lines 29 to 31 in 03f9301
But there is a case when
S2N_CHACHA20_POLY1305_AVAILABLE_BSSL_AWSLC
is on, andS2N_LIBCRYPTO_SUPPORTS_EVP_AEAD_TLS
is off (failed job: S2NGeneralBatch, s2nUnitCRT).s2n-tls/crypto/s2n_aead_cipher_chacha20_poly1305.c
Lines 31 to 32 in 03f9301
This causes compile error because when
S2N_CHACHA20_POLY1305_AVAILABLE_BSSL_AWSLC
is on, it useskey->evp_aead_ctx
to set encryption key:s2n-tls/crypto/s2n_aead_cipher_chacha20_poly1305.c
Line 201 in 03f9301
But
key->evp_aead_ctx
is not defined becauseS2N_LIBCRYPTO_SUPPORTS_EVP_AEAD_TLS
is off:s2n-tls/crypto/s2n_cipher.h
Lines 33 to 38 in 03f9301
Not exactly sure if
S2N_LIBCRYPTO_SUPPORTS_EVP_AEAD_TLS
would implyS2N_CHACHA20_POLY1305_AVAILABLE_BSSL_AWSLC
I assume it doesn't since non-BSSL or non-AWSLC could enable AEAD? but I could be wrong and wanted to double check. If it does, we can also useS2N_LIBCRYPTO_SUPPORTS_EVP_AEAD_TLS
to defineS2N_CHACHA20_POLY1305_AVAILABLE_BSSL_AWSLC
macro, andS2N_CIPHER_AEAD_API_AVAILABLE
could potentially also be defined withS2N_LIBCRYPTO_SUPPORTS_EVP_AEAD_TLS
for further cleanupTesting:
Confirmed all unit tests pass. Will address any CI failures.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.