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.
Description of changes:
This PR attempts to fix the places where potentially confusing libcrypto error codes are used.
Changes to the following s2n-tls errors were made:
S2N_ERR_NO_SUPPORTED_LIBCRYPTO_API
This error is mostly being used in PQ functions when the libcrypto doesn't support PQ. This error should never be raised in this case, since these functions shouldn't be called if the libcrypto doesn't support PQ.
S2N_ERR_UNIMPLEMENTED
is typically used for this purpose, soS2N_ERR_NO_SUPPORTED_LIBCRYPTO_API
was replaced with this error instead.There were also a couple of places where
S2N_ERR_NO_SUPPORTED_LIBCRYPTO_API
was raised if the peer unexpectedly indicated a PQ algorithm when the libcrypto doesn't support PQ. These errors were switched to protocol errors.S2N_ERR_INTERNAL_LIBCRYPTO_ERROR
This error is being used in cases where the libcrypto is erroring unexpectedly. However,
S2N_ERR_INTERNAL_LIBCRYPTO_ERROR
is a usage error, which doesn't make sense for this purpose. The error type ofS2N_ERR_INTERNAL_LIBCRYPTO_ERROR
was changed to internal.This error was also being used to gate the
s2n_config_set_cert_authorities_from_trust_store()
API behind a supported libcrypto, which should be a usage error. This was switched to a newS2N_ERR_API_UNSUPPORTED
usage error instead.Call-outs:
None
Testing:
I updated a test in s2n_server_key_share_extension_test to test the success case when PQ is enabled, since the new error code is less specific.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.