sync
This commit is contained in:
parent
3751effe59
commit
29ec20d7b2
33 changed files with 213 additions and 288 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: eck_prn.c,v 1.20 2022/11/19 07:29:29 tb Exp $ */
|
||||
/* $OpenBSD: eck_prn.c,v 1.21 2023/06/27 07:32:29 tb Exp $ */
|
||||
/*
|
||||
* Written by Nils Larsch for the OpenSSL project.
|
||||
*/
|
||||
|
@ -163,6 +163,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
|
|||
unsigned char *buffer = NULL;
|
||||
size_t buf_len = 0, i;
|
||||
int ret = 0, reason = ERR_R_BIO_LIB;
|
||||
int nid;
|
||||
BN_CTX *ctx = NULL;
|
||||
const EC_POINT *point = NULL;
|
||||
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)
|
|||
}
|
||||
if (EC_GROUP_get_asn1_flag(x)) {
|
||||
/* the curve parameter are given by an asn1 OID */
|
||||
int nid;
|
||||
|
||||
if (!BIO_indent(bp, off, 128))
|
||||
goto err;
|
||||
|
||||
|
@ -209,12 +208,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
|
|||
}
|
||||
} else {
|
||||
/* explicit parameters */
|
||||
int is_char_two = 0;
|
||||
point_conversion_form_t form;
|
||||
int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
|
||||
|
||||
if (tmp_nid == NID_X9_62_characteristic_two_field)
|
||||
is_char_two = 1;
|
||||
|
||||
if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||
|
||||
(b = BN_new()) == NULL || (order = BN_new()) == NULL ||
|
||||
|
@ -266,32 +260,13 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
|
|||
if (!BIO_indent(bp, off, 128))
|
||||
goto err;
|
||||
|
||||
nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
|
||||
/* print the 'short name' of the field type */
|
||||
if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
|
||||
<= 0)
|
||||
if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(nid)) <= 0)
|
||||
goto err;
|
||||
|
||||
if (is_char_two) {
|
||||
/* print the 'short name' of the base type OID */
|
||||
int basis_type = EC_GROUP_get_basis_type(x);
|
||||
if (basis_type == 0)
|
||||
goto err;
|
||||
|
||||
if (!BIO_indent(bp, off, 128))
|
||||
goto err;
|
||||
|
||||
if (BIO_printf(bp, "Basis Type: %s\n",
|
||||
OBJ_nid2sn(basis_type)) <= 0)
|
||||
goto err;
|
||||
|
||||
/* print the polynomial */
|
||||
if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, buffer,
|
||||
off))
|
||||
goto err;
|
||||
} else {
|
||||
if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off))
|
||||
goto err;
|
||||
}
|
||||
if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off))
|
||||
goto err;
|
||||
if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off))
|
||||
goto err;
|
||||
if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue