summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_print.c')
-rw-r--r--src/lib/libcrypto/bn/bn_print.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c
index 2f5ab2617b..782a96e7e0 100644
--- a/src/lib/libcrypto/bn/bn_print.c
+++ b/src/lib/libcrypto/bn/bn_print.c
@@ -137,7 +137,7 @@ char *BN_bn2dec(const BIGNUM *a)
137 } 137 }
138 lp--; 138 lp--;
139 /* We now have a series of blocks, BN_DEC_NUM chars 139 /* We now have a series of blocks, BN_DEC_NUM chars
140 * in length, where the last one needs trucation. 140 * in length, where the last one needs truncation.
141 * The blocks need to be reversed in order. */ 141 * The blocks need to be reversed in order. */
142 sprintf(p,BN_DEC_FMT1,*lp); 142 sprintf(p,BN_DEC_FMT1,*lp);
143 while (*p) p++; 143 while (*p) p++;
@@ -171,7 +171,7 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
171 num=i+neg; 171 num=i+neg;
172 if (bn == NULL) return(num); 172 if (bn == NULL) return(num);
173 173
174 /* a is the start of the hex digets, and it is 'i' long */ 174 /* a is the start of the hex digits, and it is 'i' long */
175 if (*bn == NULL) 175 if (*bn == NULL)
176 { 176 {
177 if ((ret=BN_new()) == NULL) return(0); 177 if ((ret=BN_new()) == NULL) return(0);
@@ -185,7 +185,7 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
185 /* i is the number of hex digests; */ 185 /* i is the number of hex digests; */
186 if (bn_expand(ret,i*4) == NULL) goto err; 186 if (bn_expand(ret,i*4) == NULL) goto err;
187 187
188 j=i; /* least significate 'hex' */ 188 j=i; /* least significant 'hex' */
189 m=0; 189 m=0;
190 h=0; 190 h=0;
191 while (j > 0) 191 while (j > 0)
@@ -236,8 +236,8 @@ int BN_dec2bn(BIGNUM **bn, const char *a)
236 num=i+neg; 236 num=i+neg;
237 if (bn == NULL) return(num); 237 if (bn == NULL) return(num);
238 238
239 /* a is the start of the digets, and it is 'i' long. 239 /* a is the start of the digits, and it is 'i' long.
240 * We chop it into BN_DEC_NUM digets at a time */ 240 * We chop it into BN_DEC_NUM digits at a time */
241 if (*bn == NULL) 241 if (*bn == NULL)
242 { 242 {
243 if ((ret=BN_new()) == NULL) return(0); 243 if ((ret=BN_new()) == NULL) return(0);
@@ -278,9 +278,8 @@ err:
278 } 278 }
279 279
280#ifndef NO_BIO 280#ifndef NO_BIO
281
282#ifndef NO_FP_API 281#ifndef NO_FP_API
283int BN_print_fp(FILE *fp, BIGNUM *a) 282int BN_print_fp(FILE *fp, const BIGNUM *a)
284 { 283 {
285 BIO *b; 284 BIO *b;
286 int ret; 285 int ret;
@@ -319,5 +318,15 @@ int BN_print(BIO *bp, const BIGNUM *a)
319end: 318end:
320 return(ret); 319 return(ret);
321 } 320 }
321#endif
322 322
323#ifdef BN_DEBUG
324void bn_dump1(FILE *o, const char *a, BN_ULONG *b,int n)
325 {
326 int i;
327 fprintf(o, "%s=", a);
328 for (i=n-1;i>=0;i--)
329 fprintf(o, "%08lX", b[i]); /* assumes 32-bit BN_ULONG */
330 fprintf(o, "\n");
331 }
323#endif 332#endif