aboutsummaryrefslogtreecommitdiffstats
path: root/test/ectest.c
Commit message (Collapse)AuthorAgeFilesLines
* tests: Check the return value of BN_hex2bn()Norbert Pocs2026-07-201-10/+12
| | | | | | | | | | | | | Fixes coverity issues 1398635, 1696548, 1696549. Signed-off-by: Norbert Pocs <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Eugene Syromiatnikov <[email protected]> MergeDate: Mon Jul 20 09:04:13 2026 (Merged from https://github.com/openssl/openssl/pull/31943)
* EC: make the group the single source of the point conversion formViktor Dukhovni2026-07-101-43/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The point conversion form (compressed, uncompressed, or hybrid) was kept both on the key and on the group, and the two could disagree -- a key imported as compressed could re-encode as uncompressed. The group is now the single source of truth: encoding, parameter output, and the legacy lookup all read it from the group, and decoding (PEM, DER, or raw parameters) records it there, so the form round-trips faithfully. Generated keys are always uncompressed; the point-format option at key generation is now a documented no-op (it had had no effect for several releases), and the unused form field on the keygen context is dropped. Imported keys still keep their form, and the deprecated EC_KEY_get_conv_form()/EC_KEY_set_conv_form() still work. EVP_PKEY_fromdata() and openssl pkey -text now report the form a loaded EC key actually has, and re-encoding via PEM or DER preserves it. Docs drop a stale note about a compile-time macro for compressed points on binary curves, and the EC tests now exercise both the affine and the compressed/hybrid binary formats unconditionally (fixing a latent bug in the compressed/hybrid form tests that were never exercised by CI). Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Matt Caswell <[email protected]> MergeDate: Fri Jul 10 09:21:29 2026 (Merged from https://github.com/openssl/openssl/pull/30940)
* Fix broken hex data by reformattingNorbert Pocs2026-06-031-462/+47
| | | | | | | | | | | | | | | | The clang format broke some data in hexadecimal format. To make the tool obedient, the trailing comma needs to be removed, then it interpretes the data differently and therefore does not reformat it. The format can then be changed to the correct form. Fixes: https://github.com/openssl/project/issues/1959 Signed-off-by: Norbert Pocs <[email protected]> Reviewed-by: Milan Broz <[email protected]> Reviewed-by: Eugene Syromiatnikov <[email protected]> MergeDate: Wed Jun 3 07:46:14 2026 (Merged from https://github.com/openssl/openssl/pull/31350)
* Copyright year updatesopenssl-machine2026-03-101-1/+1
| | | | | | | Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Eugene Syromiatnikov <[email protected]> MergeDate: Tue Mar 10 14:37:54 2026 Release: yes
* Disabling explicit EC curves encodingDmitry Belyavskiy2026-01-171-6/+41
| | | | | | | | In case the parameters don't exactly match the well-known ones Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Simo Sorce <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29639)
* Expose and report EC curve field degreesViktor Dukhovni2026-01-151-13/+38
| | | | | | | | | | | | | | | | | | | | | | | Expose the EC field degree as a gettable parameter for both provided and legacy EC keys. In the latter case, drop a spurious assertion, since even in debug builds an application may try to get an unknown parameter, and this should return an error rather than abort. In the EC `TEXT` encoding format, instead of reporting the bit count of the group order, report the field degree (which matches the size number in the curve's name when present) and also the symmetric-equivalent security-bits (adjusted down the the standard numbers (80, 112, 128, 192, 256). Along the way, add a missing getter method for the EC_GROUP security bits. Reviewed-by: Kurt Roeckx <[email protected]> Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> MergeDate: Thu Jan 15 16:10:26 2026 (Merged from https://github.com/openssl/openssl/pull/29539)
* 4.0-POST-CLANG-FORMAT-WEBKIT4.0-POST-CLANG-FORMAT-WEBKITBob Beck2025-12-091-717/+1109
| | | | | | | Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29242)
* test/: Remove ENGINEsNorbert Pocs2025-12-041-3/+0
| | | | | | | | | | | | Signed-off-by: Norbert Pocs <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Eugene Syromiatnikov <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29305)
* Copyright year updatesopenssl-machine2025-09-021-1/+1
| | | | | | Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Release: yes
* Implement EVP_PKEY_derive_SKEYDmitry Belyavskiy2025-08-311-0/+16
| | | | | | | | | | Signed-off-by: Dmitry Belyavskiy <[email protected]> Signed-off-by: Simo Sorce <[email protected]> Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28369)
* test: use array memory (re)allocation routinesEugene Syromiatnikov2025-08-081-1/+1
| | | | | | | | | | Signed-off-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28059)
* test: Silence warnings on Win64 buildsTomas Mraz2025-07-021-71/+72
| | | | | | Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/27806)
* Fix EVP_PKEY_CTX_dup() so that it copies the keymanager.slontis2025-04-151-4/+6
| | | | | | | | | | | | | | | | A call to EVP_PKEY_CTX_new() creates a keymgmt pointer internally, but EVP_PKEY_CTX_dup() does not copy this field. Calling EVP_PKEY_derive_set_peer_ex() after EVP_PKEY_CTX_dup() resulted in a segfault because it tried to access this pointer. EVP_PKEY_CTX_dup() has been updated to copy the keymanager (and upref it). Reported by Eamon ODea (Oracle). Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/27304)
* "foo * bar" should be "foo *bar"Dimitri Papadopoulos2023-09-111-1/+1
| | | | | | | | Found by running the checkpatch.pl Linux script to enforce coding style. Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/21468)
* Copyright year updatesMatt Caswell2023-09-071-1/+1
| | | | | Reviewed-by: Richard Levitte <[email protected]> Release: yes
* New function EC_GROUP_to_params to convert an EC_GROUP to an array of ↵Oliver Mihatsch2023-02-081-0/+113
| | | | | | | | | OSSL_PARAM. Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Todd Short <[email protected]> (Merged from https://github.com/openssl/openssl/pull/20205)
* Potential null pointer referenceyangyangtiantianlonglong2022-11-021-7/+7
| | | | | | Reviewed-by: Shane Lontis <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/19429)
* d2i_PublicKey: Make it work with EC parameters in a provided keyTomas Mraz2021-11-221-0/+42
| | | | | | | Fixes #16989 Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/17065)
* Fix tests to check for negative results when calling EVP_PKEY_fromdata_initslontis2021-11-051-5/+5
| | | | | Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/16801)
* fix some code with obvious wrong coding stylex20182021-10-281-2/+2
| | | | | | | Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/16918)
* Use <> for #include openssl/xxxRich Salz2021-05-271-3/+3
| | | | | | Reviewed-by: Shane Lontis <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/15468)
* Test oct2point for hybrid point encoding of (0, y)Theo Buehler2021-05-091-0/+50
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/15108)
* Replace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free().Shane Lontis2021-04-121-3/+3
| | | | | Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/14785)
* Simplify the EVP_PKEY_XXX_fromdata_XX methods.Shane Lontis2021-02-081-5/+8
| | | | | | | | | | | | | | | | | | The existing names such as EVP_PKEY_param_fromdata_settable were a bit confusing since the 'param' referred to key params not OSSL_PARAM. To simplify the interface a 'selection' parameter will be passed instead. The changes are: (1) EVP_PKEY_fromdata_init() replaces both EVP_PKEY_key_fromdata_init() and EVP_PKEY_param_fromdata_init(). (2) EVP_PKEY_fromdata() has an additional selection parameter. (3) EVP_PKEY_fromdata_settable() replaces EVP_PKEY_key_fromdata_settable() and EVP_PKEY_param_fromdata_settable(). EVP_PKEY_fromdata_settable() also uses a selection parameter. Fixes #12989 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/14076)
* Disable the test-ec completely when building with no-ecTomas Mraz2021-01-261-58/+51
| | | | | Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/13139)
* Deprecate EC_KEY + Update ec apps to use EVP_PKEYShane Lontis2021-01-261-6/+3
| | | | | | | | | Co-author: Richard Levitte <[email protected]> Co-author: Tomas Mraz <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/13139)
* Add Explicit EC parameter support to providers.Shane Lontis2020-08-221-1/+223
| | | | | | | | | | This was added for backward compatability. Added EC_GROUP_new_from_params() that supports explicit curve parameters. This fixes the 15-test_genec.t TODO. Reviewed-by: Richard Levitte <[email protected]> (Merged from https://github.com/openssl/openssl/pull/12604)
* [test][ectest] Minor touches to custom_generator_testNicola Tuveri2020-07-291-4/+2
| | | | | | | | | | | | Minor changes to `custom_generator_test`: - this is to align to the 1.1.1 version of the test (simplify the code as there is no need to use `EC_GROUP_get_field_type()`) - add comment to explain how the buffer size is computed Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/12507)
* [test] Vertically test explicit EC params API patternsNicola Tuveri2020-07-291-1/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new test (run on all the built-in curves) to create `EC_GROUP` with **unknown** *explicit parameters*: from a built-in group we create an alternative group from scratch that differs in the generator used. At the `EC_GROUP` layer we perform a basic math check to ensure that the math on the alternative group still makes sense, using comparable results from the origin group. We then create two `EC_KEY` objects on top of this alternative group and run key generation from the `EC_KEY` layer. Then we promote these two `EC_KEY`s to `EVP_PKEY` objects and try to run the derive operation at the highest abstraction layer, comparing results in both directions. Finally, we create provider-native keys using `EVP_PKEY_fromdata` and data derived from the previous objects, we compute an equivalent shared secret from these provider keys, and compare it to the result obtained from the previous steps. Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/12507)
* [test] ectest: check custom generatorsBilly Brumley2020-07-121-0/+84
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> (Merged from https://github.com/openssl/openssl/pull/12096)
* Move EC_METHOD to internal-onlyBilly Brumley2020-06-021-83/+31
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/11928)
* deprecate EC precomputation functionalityBilly Brumley2020-05-191-9/+10
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> (Merged from https://github.com/openssl/openssl/pull/11851)
* deprecate EC_POINTs_mul functionBilly Brumley2020-05-161-10/+26
| | | | | | Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/11807)
* Update copyright yearMatt Caswell2020-04-231-1/+1
| | | | | Reviewed-by: Richard Levitte <[email protected]> (Merged from https://github.com/openssl/openssl/pull/11616)
* [crypto/ec] deprecate Jprojective_coordinates_GFp functionsBilly Brumley2020-04-221-79/+0
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/11527)
* Add self-test for EC_POINT_hex2pointNicola Tuveri2019-11-131-0/+101
| | | | | | | | | Adds tests for each curve to ensure that encodings obtained through EC_POINT_hex2point() can be fed to EC_POINT_point2hex() yielding a point identical to the one from which the encoding is generated. Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/10329)
* Add BN_check_prime()Kurt Roeckx2019-10-141-7/+7
| | | | | | | | | | Add a new API to test for primes that can't be misused, deprecated the old APIs. Suggested by Jake Massimo and Kenneth Paterson Reviewed-by: Paul Dale <[email protected]> GH: #9272
* [test] ECC: check the bounds for auto computing cofactorBilly Brumley2019-09-091-0/+91
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Nicola Tuveri <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9821)
* Uniform TEST_*() check usage in test/ectest.cNicola Tuveri2019-09-091-13/+13
| | | | | | | | | | | | - Replace a `TEST_true()` with `!TEST_false()` to avoid reporting confusing errors - We tend to use `if (!TEST_foo() || !TEST_bar())` and it's a bit confusing to switch to `if(!(TEST_foo() && TEST_bar()))`: replace it with the more common style Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Bernd Edlinger <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9813)
* Fix spacing nit in test/ectest.cNicola Tuveri2019-09-091-1/+1
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Bernd Edlinger <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9813)
* [ec] Match built-in curves on EC_GROUP_new_from_ecparametersNicola Tuveri2019-09-091-0/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description ----------- Upon `EC_GROUP_new_from_ecparameters()` check if the parameters match any of the built-in curves. If that is the case, return a new `EC_GROUP_new_by_curve_name()` object instead of the explicit parameters `EC_GROUP`. This affects all users of `EC_GROUP_new_from_ecparameters()`: - direct calls to `EC_GROUP_new_from_ecparameters()` - direct calls to `EC_GROUP_new_from_ecpkparameters()` with an explicit parameters argument - ASN.1 parsing of explicit parameters keys (as it eventually ends up calling `EC_GROUP_new_from_ecpkparameters()`) A parsed explicit parameter key will still be marked with the `OPENSSL_EC_EXPLICIT_CURVE` ASN.1 flag on load, so, unless programmatically forced otherwise, if the key is eventually serialized the output will still be encoded with explicit parameters, even if internally it is treated as a named curve `EC_GROUP`. Before this change, creating any `EC_GROUP` object using `EC_GROUP_new_from_ecparameters()`, yielded an object associated with the default generic `EC_METHOD`, but this was never guaranteed in the documentation. After this commit, users of the library that intentionally want to create an `EC_GROUP` object using a specific `EC_METHOD` can still explicitly call `EC_GROUP_new(foo_method)` and then manually set the curve parameters using `EC_GROUP_set_*()`. Motivation ---------- This has obvious performance benefits for the built-in curves with specialized `EC_METHOD`s and subtle but important security benefits: - the specialized methods have better security hardening than the generic implementations - optional fields in the parameter encoding, like the `cofactor`, cannot be leveraged by an attacker to force execution of the less secure code-paths for single point scalar multiplication - in general, this leads to reducing the attack surface Check the manuscript at https://arxiv.org/abs/1909.01785 for an in depth analysis of the issues related to this commit. It should be noted that `libssl` does not allow to negotiate explicit parameters (as per RFC 8422), so it is not directly affected by the consequences of using explicit parameters that this commit fixes. On the other hand, we detected external applications and users in the wild that use explicit parameters by default (and sometimes using 0 as the cofactor value, which is technically not a valid value per the specification, but is tolerated by parsers for wider compatibility given that the field is optional). These external users of `libcrypto` are exposed to these vulnerabilities and their security will benefit from this commit. Related commits --------------- While this commit is beneficial for users using built-in curves and explicit parameters encoding for serialized keys, commit b783beeadf6b80bc431e6f3230b5d5585c87ef87 (and its equivalents for the 1.0.2, 1.1.0 and 1.1.1 stable branches) fixes the consequences of the invalid cofactor values more in general also for other curves (CVE-2019-1547). The following list covers commits in `master` that are related to the vulnerabilities presented in the manuscript motivating this commit: - d2baf88c43 [crypto/rsa] Set the constant-time flag in multi-prime RSA too - 311e903d84 [crypto/asn1] Fix multiple SCA vulnerabilities during RSA key validation. - b783beeadf [crypto/ec] for ECC parameters with NULL or zero cofactor, compute it - 724339ff44 Fix SCA vulnerability when using PVK and MSBLOB key formats Note that the PRs that contributed the listed commits also include other commits providing related testing and documentation, in addition to links to PRs and commits backporting the fixes to the 1.0.2, 1.1.0 and 1.1.1 branches. Responsible Disclosure ---------------------- This and the other issues presented in https://arxiv.org/abs/1909.01785 were reported by Cesar Pereida García, Sohaib ul Hassan, Nicola Tuveri, Iaroslav Gridin, Alejandro Cabrera Aldaya and Billy Bob Brumley from the NISEC group at Tampere University, FINLAND. The OpenSSL Security Team evaluated the security risk for this vulnerability as low, and encouraged to propose fixes using public Pull Requests. _______________________________________________________________________________ Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9808)
* [test] computing ECC cofactors: regression testBilly Brumley2019-09-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | This is a forward port from https://github.com/openssl/openssl/pull/9781 for the test logic introduced by https://github.com/openssl/openssl/pull/9727 As @mattcaswell commented (https://github.com/openssl/openssl/pull/9781#discussion_r321621541): > These `TEST_true` calls should be `!TEST_false` because we are > *expecting* a failure. > The difference is that the test framework will print error details if > the test doesn't give the expected answer. > So by using `TEST_true` instead of `!TEST_false` we'll get error > details printed, but the test will succeed anyway. (cherry picked from commit e8aafc891d9bd7fa1cce0401d858ef842f09b49e) Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9797)
* [test] computing ECC cofactors: regression testBilly Brumley2019-09-051-3/+86
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9827)
* Make the EC code available from inside the FIPS providerMatt Caswell2019-08-061-19/+19
| | | | | Reviewed-by: Nicola Tuveri <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9380)
* Temporary workaround for ectest.c for [extended tests]Nicola Tuveri2019-07-311-1/+1
| | | | | | | | | | | | | | | | | [extended tests] This is a temporary workaround for issue #9251, which contains a full discussion of the real problem. As a temporary workaround, we test `EC_GROUP_new_from_ecparameters()` against a curve that does not currently have alternative implementations. The proper fix is dependant on resolution of issue #8615 Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Shane Lontis <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9474)
* EC only uses approved curves in FIPS mode.Shane Lontis2019-06-251-1/+1
| | | | | | | | | | | | | | Once there are buildable fips tests, some tests that are data driven from files will need to be modified to exclude non approved curves in fips mode. These changes were tested by temporarily adding #define FIPS_MODE 1 to all the modified source files. Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/9081)
* Fix no-ec2mMatt Caswell2019-04-231-1/+4
| | | | | Reviewed-by: Paul Yang <[email protected]> (Merged from https://github.com/openssl/openssl/pull/8792)
* ec key validation checks updatedShane Lontis2019-04-111-2/+55
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/8564)
* doc fixupsShane Lontis2019-04-111-3/+3
| | | | | | Reviewed-by: Nicola Tuveri <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/8555)
* Separate the lookup testNicola Tuveri2019-04-111-33/+84
| | | | | | | | | | | | | | | | | | | | | | | | This fixes the "verifying the alias" case. Actually, while working on it, I realized that conceptually we were testing the 2 different behaviours of `EC_GROUP_check_named_curve()` at the same time, and actually not in the proper way. I think it's fair to assume that overwriting the curve name for an existing group with `NID_undef` could lead to the unexpected behaviour we were observing and working around. Thus I decided to separate the lookup test in a dedicated simpler test that does what the documentation of `EC_GROUP_check_named_curve()` suggests: the lookup functionality is meant to find a name for a group generated with explicit parameters. In case an alternative alias is returned by the lookup instead of the expected nid, to avoid doing comparisons between `EC_GROUP`s with different `EC_METHOD`s, the workaround is to retrieve the `ECPARAMETERS` of the "alias group" and create a new explicit parameters group to use in `EC_GROUP_cmp()`. Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/8555)