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.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c
index 7251e4d831..7e0683b679 100644
--- a/src/lib/libcrypto/bn/bn_print.c
+++ b/src/lib/libcrypto/bn/bn_print.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_print.c,v 1.37 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: bn_print.c,v 1.38 2023/02/13 04:25:37 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -251,7 +251,8 @@ BN_hex2bn(BIGNUM **bn, const char *a)
251 } 251 }
252 ret->top = h; 252 ret->top = h;
253 bn_correct_top(ret); 253 bn_correct_top(ret);
254 ret->neg = neg; 254
255 BN_set_negative(ret, neg);
255 256
256 *bn = ret; 257 *bn = ret;
257 return (num); 258 return (num);
@@ -317,9 +318,11 @@ BN_dec2bn(BIGNUM **bn, const char *a)
317 j = 0; 318 j = 0;
318 } 319 }
319 } 320 }
320 ret->neg = neg;
321 321
322 bn_correct_top(ret); 322 bn_correct_top(ret);
323
324 BN_set_negative(ret, neg);
325
323 *bn = ret; 326 *bn = ret;
324 return (num); 327 return (num);
325 328
@@ -344,7 +347,7 @@ BN_asc2bn(BIGNUM **bn, const char *a)
344 return 0; 347 return 0;
345 } 348 }
346 if (*a == '-') 349 if (*a == '-')
347 (*bn)->neg = 1; 350 BN_set_negative(*bn, 1);
348 return 1; 351 return 1;
349} 352}
350 353