Add a test that arbitrary curves can be wrapped in EVP_PKEY#3055
Merged
Add a test that arbitrary curves can be wrapped in EVP_PKEY#3055
Conversation
Cherry-picked from BoringSSL 4d48736c2acd6878caa93ac0a628b46bda1227b0. Conscrypt relies on both this working at the EC_KEY level, but also EVP_PKEY. Make sure this keeps working, even as we mess around with EVP_PKEY's EC bits to separate the curves out. While I'm here, move the common HexToBIGNUM wrapper into test_util.h. Adapted for AWS-LC: - File paths differ (crypto/evp_extra/ vs crypto/evp/) - Replaced bssl::StringAsBytes with plain uint8_t array (not available in AWS-LC) - Renamed bn_test.cc's different-signature HexToBIGNUM to HexToBIGNUMWithReturn to avoid conflict with the shared one
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3055 +/- ##
==========================================
+ Coverage 78.38% 78.55% +0.16%
==========================================
Files 689 689
Lines 121129 121149 +20
Branches 16968 16973 +5
==========================================
+ Hits 94948 95165 +217
+ Misses 25287 25084 -203
- Partials 894 900 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
justsmth
approved these changes
Mar 4, 2026
| // compatibility with one legacy application, and supported in only a limited | ||
| // form. (E.g. such keys cannot be serialized.) | ||
| TEST(EVPExtraTest, CustomCurve) { | ||
| // Coefficients for brainpoolp256r1, not supported by BoringSSL. |
Contributor
There was a problem hiding this comment.
NP: "..., not supported by AWS-LC."?
|
|
||
| // HexToBIGNUM decodes |hex| as a hexadecimal, big-endian, unsigned integer and | ||
| // returns it as a |BIGNUM|, or nullptr on error. | ||
| bssl::UniquePtr<BIGNUM> HexToBIGNUM(const char *hex); |
Contributor
There was a problem hiding this comment.
NP: We should also add #include <openssl/bn.h> to this header since we're referencing BIGNUM.
sgmenda
approved these changes
Mar 6, 2026
WillChilds-Klein
pushed a commit
to WillChilds-Klein/aws-lc
that referenced
this pull request
Mar 11, 2026
### Description of changes: BoringSSL commit google/boringssl@4d48736: "Add a test that arbitrary curves can be wrapped in EVP_PKEY" Changes made (6 files): 1. crypto/test/test_util.h / test_util.cc — Added shared `HexToBIGNUM(const char*)` helper (declaration + implementation + #include <openssl/bn.h>) 2. crypto/fipsmodule/ec/ec_test.cc — Removed duplicate local `HexToBIGNUM` (now uses the shared one from test_util.h, already included) 3. crypto/fipsmodule/ecdsa/ecdsa_test.cc — Same removal of duplicate 4. crypto/fipsmodule/bn/bn_test.cc — Renamed the different-signature `HexToBIGNUM(UniquePtr<BIGNUM>*, const char*)` → `HexToBIGNUMWithReturn` to avoid conflict (this one returns the BN_hex2bn return value, so it's a distinct function) 5. crypto/evp_extra/evp_extra_test.cc — Added the new `TEST(EVPExtraTest, CustomCurve)` test ### Adaptations for AWS-LC: - Path: crypto/evp_extra/ instead of BoringSSL's crypto/evp/ - Replaced `bssl::StringAsBytes("hello")` (doesn't exist in AWS-LC) with a plain `static const uint8_t msg[] = "hello" + sizeof(msg) - 1` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. Co-authored-by: David Benjamin <davidben@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
BoringSSL commit google/boringssl@4d48736:
"Add a test that arbitrary curves can be wrapped in EVP_PKEY"
Changes made (6 files):
crypto/test/test_util.h / test_util.cc — Added shared
HexToBIGNUM(const char*)helper (declaration + implementation + #include <openssl/bn.h>)crypto/fipsmodule/ec/ec_test.cc — Removed duplicate local
HexToBIGNUM(now uses the shared one from test_util.h, already included)crypto/fipsmodule/ecdsa/ecdsa_test.cc — Same removal of duplicate
crypto/fipsmodule/bn/bn_test.cc — Renamed the different-signature
HexToBIGNUM(UniquePtr<BIGNUM>*, const char*)→HexToBIGNUMWithReturnto avoid conflict (this one returns theBN_hex2bn return value, so it's a distinct function)
crypto/evp_extra/evp_extra_test.cc — Added the new
TEST(EVPExtraTest, CustomCurve)testAdaptations for AWS-LC:
bssl::StringAsBytes("hello")(doesn't exist in AWS-LC) with a plainstatic const uint8_t msg[] = "hello" + sizeof(msg) - 1By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.