summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/asn1/x_bignum.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/x_bignum.c b/src/lib/libcrypto/asn1/x_bignum.c
index a5a307eff7..fab8fc212d 100644
--- a/src/lib/libcrypto/asn1/x_bignum.c
+++ b/src/lib/libcrypto/asn1/x_bignum.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_bignum.c,v 1.9 2019/03/31 14:39:15 jsing Exp $ */ 1/* $OpenBSD: x_bignum.c,v 1.10 2019/04/01 15:49:22 jsing 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 2000. 3 * project 2000.
4 */ 4 */
@@ -75,6 +75,8 @@ static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
75 const ASN1_ITEM *it); 75 const ASN1_ITEM *it);
76static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, 76static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
77 int utype, char *free_cont, const ASN1_ITEM *it); 77 int utype, char *free_cont, const ASN1_ITEM *it);
78static int bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
79 int indent, const ASN1_PCTX *pctx);
78 80
79static ASN1_PRIMITIVE_FUNCS bignum_pf = { 81static ASN1_PRIMITIVE_FUNCS bignum_pf = {
80 .app_data = NULL, 82 .app_data = NULL,
@@ -84,7 +86,7 @@ static ASN1_PRIMITIVE_FUNCS bignum_pf = {
84 .prim_clear = NULL, /* XXX */ 86 .prim_clear = NULL, /* XXX */
85 .prim_c2i = bn_c2i, 87 .prim_c2i = bn_c2i,
86 .prim_i2c = bn_i2c, 88 .prim_i2c = bn_i2c,
87 .prim_print = NULL, 89 .prim_print = bn_print,
88}; 90};
89 91
90const ASN1_ITEM BIGNUM_it = { 92const ASN1_ITEM BIGNUM_it = {
@@ -166,3 +168,17 @@ bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype,
166 } 168 }
167 return 1; 169 return 1;
168} 170}
171
172static int
173bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent,
174 const ASN1_PCTX *pctx)
175{
176 BIGNUM *bn = (BIGNUM *)*pval;
177
178 if (!BN_print(out, bn))
179 return 0;
180 if (BIO_printf(out, "\n") <= 0)
181 return 0;
182
183 return 1;
184}