summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-11-25 06:51:39 +0000
committertb <>2024-11-25 06:51:39 +0000
commit05a50d0f2fa123333e4c07cc68de4816f3194f55 (patch)
treec538c6d04f98723eabc7002148b5b0c899de84da /src
parentff56d47bbc99ed7ac64ae73eaacbc02525a11b04 (diff)
downloadopenbsd-05a50d0f2fa123333e4c07cc68de4816f3194f55.tar.gz
openbsd-05a50d0f2fa123333e4c07cc68de4816f3194f55.tar.bz2
openbsd-05a50d0f2fa123333e4c07cc68de4816f3194f55.zip
Unify checking for the asn1_flag
There are only two flag values that libcrypto understands and the default value is 1 while, helpfully, the undesirable non-default is 0. The few existing callers set OPENSSL_EC_NAMED_CURVE or OPENSSL_EC_EXPLICIT_CURVE. Nevertheless, the flag should be checked properly as a flag. The recent upstream checks for EC_GROUP_get_asn1_flag(group) == OPENSSL_EC_NAMED_CURVE don't look right either... ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c4
-rw-r--r--src/lib/libcrypto/ec/eck_prn.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index 754fabfb4d..903b18a8db 100644
--- a/src/lib/libcrypto/ec/ec_ameth.c
+++ b/src/lib/libcrypto/ec/ec_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_ameth.c,v 1.72 2024/10/29 06:36:58 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.73 2024/11/25 06:51:39 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -104,7 +104,7 @@ eckey_get_curve_name(const EC_KEY *eckey, int *nid)
104 ECerror(EC_R_MISSING_PARAMETERS); 104 ECerror(EC_R_MISSING_PARAMETERS);
105 return 0; 105 return 0;
106 } 106 }
107 if (EC_GROUP_get_asn1_flag(group) != 0) 107 if ((EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE) != 0)
108 *nid = EC_GROUP_get_curve_name(group); 108 *nid = EC_GROUP_get_curve_name(group);
109 109
110 return 1; 110 return 1;
diff --git a/src/lib/libcrypto/ec/eck_prn.c b/src/lib/libcrypto/ec/eck_prn.c
index 012391c803..98e1a7e7bd 100644
--- a/src/lib/libcrypto/ec/eck_prn.c
+++ b/src/lib/libcrypto/ec/eck_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eck_prn.c,v 1.39 2024/11/14 10:27:59 tb Exp $ */ 1/* $OpenBSD: eck_prn.c,v 1.40 2024/11/25 06:51:39 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -330,7 +330,7 @@ ECPKParameters_print(BIO *bio, const EC_GROUP *group, int off)
330 return 0; 330 return 0;
331 } 331 }
332 332
333 if (EC_GROUP_get_asn1_flag(group)) 333 if ((EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE) != 0)
334 return ecpk_print_asn1_parameters(bio, group, off); 334 return ecpk_print_asn1_parameters(bio, group, off);
335 335
336 return ecpk_print_explicit_parameters(bio, group, off); 336 return ecpk_print_explicit_parameters(bio, group, off);