diff options
author | tb <> | 2024-11-08 13:55:45 +0000 |
---|---|---|
committer | tb <> | 2024-11-08 13:55:45 +0000 |
commit | 269c43df8ea33b942e8a43354b9b48fb60ba4ba7 (patch) | |
tree | 15461b9d3cf10fd9ae1208ef616b666b1da3c065 /src/lib/libcrypto/ec/ec_lib.c | |
parent | b0d9dbfb6f43ca4ff7a16ac1cf3b374342111ffa (diff) | |
download | openbsd-269c43df8ea33b942e8a43354b9b48fb60ba4ba7.tar.gz openbsd-269c43df8ea33b942e8a43354b9b48fb60ba4ba7.tar.bz2 openbsd-269c43df8ea33b942e8a43354b9b48fb60ba4ba7.zip |
Relocate ECParameters_dup() to ec_asn1
jsing rightly points out that this has nothing to do with ASN.1, but
ec_lib.c has no EC_KEY knowledge otherwise (it's about groups and points)
and moving it to ec_key.c is also not satisfactory since the weird
d2i/i2d for ECParameters don't belong there either.
no objection from jsing
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index f409df1a7b..d61dea9f12 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.84 2024/11/08 01:33:20 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.85 2024/11/08 13:55:45 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -1436,25 +1436,3 @@ ec_group_simple_order_bits(const EC_GROUP *group) | |||
1436 | #endif | 1436 | #endif |
1437 | return BN_num_bits(&group->order); | 1437 | return BN_num_bits(&group->order); |
1438 | } | 1438 | } |
1439 | |||
1440 | EC_KEY * | ||
1441 | ECParameters_dup(EC_KEY *key) | ||
1442 | { | ||
1443 | const unsigned char *p; | ||
1444 | unsigned char *der = NULL; | ||
1445 | EC_KEY *dup = NULL; | ||
1446 | int len; | ||
1447 | |||
1448 | if (key == NULL) | ||
1449 | return NULL; | ||
1450 | |||
1451 | if ((len = i2d_ECParameters(key, &der)) <= 0) | ||
1452 | return NULL; | ||
1453 | |||
1454 | p = der; | ||
1455 | dup = d2i_ECParameters(NULL, &p, len); | ||
1456 | freezero(der, len); | ||
1457 | |||
1458 | return dup; | ||
1459 | } | ||
1460 | LCRYPTO_ALIAS(ECParameters_dup); | ||