diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-07-18 17:52:56 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-07-18 19:42:12 +0100 |
commit | 1a2e1334a200d62d3e7841b08583a7859795148b (patch) | |
tree | 7141206d8a895911bc63ab304f7cf10049251d21 /crypto | |
parent | 25dfe50b518952350f3f89de1954bcbfdd5365e9 (diff) |
Fix print of ASN.1 BIGNUM type.
The ASN.1 BIGNUM type needs to be handled in a custom way as it is
not a generic ASN1_STRING type.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 3cea73a7fcaaada1ea0ee4b4353ed0176fee1112)
Conflicts:
crypto/asn1/x_bignum.c
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/x_bignum.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/crypto/asn1/x_bignum.c b/crypto/asn1/x_bignum.c index eaf046639d..c644199c9f 100644 --- a/crypto/asn1/x_bignum.c +++ b/crypto/asn1/x_bignum.c @@ -78,6 +78,8 @@ static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); +static int bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, + int indent, const ASN1_PCTX *pctx); static ASN1_PRIMITIVE_FUNCS bignum_pf = { NULL, 0, @@ -85,7 +87,8 @@ static ASN1_PRIMITIVE_FUNCS bignum_pf = { bn_free, 0, bn_c2i, - bn_i2c + bn_i2c, + bn_print }; ASN1_ITEM_start(BIGNUM) @@ -151,3 +154,13 @@ static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, } return 1; } + +static int bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, + int indent, const ASN1_PCTX *pctx) +{ + if (!BN_print(out, *(BIGNUM **)pval)) + return 0; + if (BIO_puts(out, "\n") <= 0) + return 0; + return 1; +} |