From 9161672950b6408a025833ed7a3d84b3e0ba9944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodo=20M=C3=B6ller?= Date: Wed, 29 Nov 2000 12:53:41 +0000 Subject: BN_bin2bn did *not* contain an off-by-one error; I'm still investigating what caused the segementation fault (maybe "make clean; make" will cure it ...). But BN_bin2bn should always reset ret->neg. --- crypto/bn/bn_lib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crypto/bn/bn_lib.c') diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index f0dc7d52dc..d7a54d5fb5 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -585,7 +585,6 @@ int BN_set_word(BIGNUM *a, BN_ULONG w) return(1); } -/* ignore negative */ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) { unsigned int i,m; @@ -605,7 +604,8 @@ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) return(NULL); i=((n-1)/BN_BYTES)+1; m=((n-1)%(BN_BYTES)); - ret->top=i-1; + ret->top=i; + ret->neg=0; while (n-- > 0) { l=(l<<8L)| *(s++); @@ -776,4 +776,3 @@ int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) } return(0); } - -- cgit v1.2.3