diff options
author | tb <> | 2023-06-27 07:32:29 +0000 |
---|---|---|
committer | tb <> | 2023-06-27 07:32:29 +0000 |
commit | 476172a658127f035fb52c0834a423aab8363fc4 (patch) | |
tree | ca96c75343de5decf69564defabc1ba6abc4627a | |
parent | 21a3389ff1105bddb45283f5d32980bc6a261715 (diff) | |
download | openbsd-476172a658127f035fb52c0834a423aab8363fc4.tar.gz openbsd-476172a658127f035fb52c0834a423aab8363fc4.tar.bz2 openbsd-476172a658127f035fb52c0834a423aab8363fc4.zip |
Remove some dead code from ECPKParameters_print()
This code is unreachable since binary curve support was removed.
There is a lot more to clean up in here...
ok jsing
-rw-r--r-- | src/lib/libcrypto/ec/eck_prn.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/lib/libcrypto/ec/eck_prn.c b/src/lib/libcrypto/ec/eck_prn.c index f7ce8debb0..e1f734cbe7 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.20 2022/11/19 07:29:29 tb Exp $ */ | 1 | /* $OpenBSD: eck_prn.c,v 1.21 2023/06/27 07:32:29 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -163,6 +163,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | |||
163 | unsigned char *buffer = NULL; | 163 | unsigned char *buffer = NULL; |
164 | size_t buf_len = 0, i; | 164 | size_t buf_len = 0, i; |
165 | int ret = 0, reason = ERR_R_BIO_LIB; | 165 | int ret = 0, reason = ERR_R_BIO_LIB; |
166 | int nid; | ||
166 | BN_CTX *ctx = NULL; | 167 | BN_CTX *ctx = NULL; |
167 | const EC_POINT *point = NULL; | 168 | const EC_POINT *point = NULL; |
168 | BIGNUM *p = NULL, *a = NULL, *b = NULL, *gen = NULL, *order = NULL, | 169 | BIGNUM *p = NULL, *a = NULL, *b = NULL, *gen = NULL, *order = NULL, |
@@ -186,8 +187,6 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | |||
186 | } | 187 | } |
187 | if (EC_GROUP_get_asn1_flag(x)) { | 188 | if (EC_GROUP_get_asn1_flag(x)) { |
188 | /* the curve parameter are given by an asn1 OID */ | 189 | /* the curve parameter are given by an asn1 OID */ |
189 | int nid; | ||
190 | |||
191 | if (!BIO_indent(bp, off, 128)) | 190 | if (!BIO_indent(bp, off, 128)) |
192 | goto err; | 191 | goto err; |
193 | 192 | ||
@@ -209,12 +208,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | |||
209 | } | 208 | } |
210 | } else { | 209 | } else { |
211 | /* explicit parameters */ | 210 | /* explicit parameters */ |
212 | int is_char_two = 0; | ||
213 | point_conversion_form_t form; | 211 | point_conversion_form_t form; |
214 | int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x)); | ||
215 | |||
216 | if (tmp_nid == NID_X9_62_characteristic_two_field) | ||
217 | is_char_two = 1; | ||
218 | 212 | ||
219 | if ((p = BN_new()) == NULL || (a = BN_new()) == NULL || | 213 | if ((p = BN_new()) == NULL || (a = BN_new()) == NULL || |
220 | (b = BN_new()) == NULL || (order = BN_new()) == NULL || | 214 | (b = BN_new()) == NULL || (order = BN_new()) == NULL || |
@@ -266,32 +260,13 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | |||
266 | if (!BIO_indent(bp, off, 128)) | 260 | if (!BIO_indent(bp, off, 128)) |
267 | goto err; | 261 | goto err; |
268 | 262 | ||
263 | nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x)); | ||
269 | /* print the 'short name' of the field type */ | 264 | /* print the 'short name' of the field type */ |
270 | if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid)) | 265 | if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(nid)) <= 0) |
271 | <= 0) | ||
272 | goto err; | 266 | goto err; |
273 | 267 | ||
274 | if (is_char_two) { | 268 | if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off)) |
275 | /* print the 'short name' of the base type OID */ | 269 | goto err; |
276 | int basis_type = EC_GROUP_get_basis_type(x); | ||
277 | if (basis_type == 0) | ||
278 | goto err; | ||
279 | |||
280 | if (!BIO_indent(bp, off, 128)) | ||
281 | goto err; | ||
282 | |||
283 | if (BIO_printf(bp, "Basis Type: %s\n", | ||
284 | OBJ_nid2sn(basis_type)) <= 0) | ||
285 | goto err; | ||
286 | |||
287 | /* print the polynomial */ | ||
288 | if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, buffer, | ||
289 | off)) | ||
290 | goto err; | ||
291 | } else { | ||
292 | if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off)) | ||
293 | goto err; | ||
294 | } | ||
295 | if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off)) | 270 | if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off)) |
296 | goto err; | 271 | goto err; |
297 | if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off)) | 272 | if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off)) |