diff options
author | Bodo Möller <bodo@openssl.org> | 2002-08-26 11:25:54 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-08-26 11:25:54 +0000 |
commit | 7e31164ae08fdc00fb62f749f7b6d18aaa75523e (patch) | |
tree | ed4cdd4f23ae521bfa8eabe9f834d1ba49fd2b9b /crypto/asn1 | |
parent | ad55f581f93592705617039cd4b5ed8dc02b6192 (diff) |
ASN1 for binary curves
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/t_pkey.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/crypto/asn1/t_pkey.c b/crypto/asn1/t_pkey.c index 964fd914f7..0a20311c56 100644 --- a/crypto/asn1/t_pkey.c +++ b/crypto/asn1/t_pkey.c @@ -412,13 +412,32 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) if (BIO_write(bp, str, off) <= 0) goto err; } - + /* print the 'short name' of the field type */ if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_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, NULL, + NULL, NULL); + if (basis_type == 0) + goto err; + + if (off) + { + if (off > 128) off=128; + memset(str,' ',off); + if (BIO_write(bp, str, off) <= 0) + goto err; + } + + if (BIO_printf(bp, "Basis Type: %s\n", + OBJ_nid2sn(basis_type)) <= 0) + goto err; + + /* print the polynomial */ if ((p != NULL) && !print(bp, "Polynomial:", p, buffer, off)) goto err; @@ -565,6 +584,13 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf, if (BIO_write(bp,str,off) <= 0) return(0); } + if (BN_is_zero(num)) + { + if (BIO_printf(bp, "%s 0\n", number) <= 0) + return 0; + return 1; + } + if (BN_num_bytes(num) <= BN_BYTES) { if (BIO_printf(bp,"%s %s%lu (%s0x%lx)\n",number,neg, |