diff options
author | otto <> | 2003-09-25 19:54:46 +0000 |
---|---|---|
committer | otto <> | 2003-09-25 19:54:46 +0000 |
commit | cff7518117b7df6884d44414f64caaf7687f2e9b (patch) | |
tree | cf024dde8d420bddb1a9963054de10ad7b047e7c /src/lib | |
parent | b2faba93ca8a0634c3af02d30651d3d4e81b019a (diff) | |
download | openbsd-cff7518117b7df6884d44414f64caaf7687f2e9b.tar.gz openbsd-cff7518117b7df6884d44414f64caaf7687f2e9b.tar.bz2 openbsd-cff7518117b7df6884d44414f64caaf7687f2e9b.zip |
Use BN_is_zero(), not x->top == 0 to test if a BN is zero.
ok markus@ deraadt@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/bn/bn_print.c | 6 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bn/bn_print.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index e3b6aa235b..ad80dab325 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
@@ -79,7 +79,7 @@ char *BN_bn2hex(const BIGNUM *a) | |||
79 | } | 79 | } |
80 | p=buf; | 80 | p=buf; |
81 | if (a->neg) *(p++)='-'; | 81 | if (a->neg) *(p++)='-'; |
82 | if (a->top == 0) *(p++)='0'; | 82 | if (BN_is_zero(a)) *(p++)='0'; |
83 | for (i=a->top-1; i >=0; i--) | 83 | for (i=a->top-1; i >=0; i--) |
84 | { | 84 | { |
85 | for (j=BN_BITS2-8; j >= 0; j-=8) | 85 | for (j=BN_BITS2-8; j >= 0; j-=8) |
@@ -123,7 +123,7 @@ char *BN_bn2dec(const BIGNUM *a) | |||
123 | p=buf; | 123 | p=buf; |
124 | lp=bn_data; | 124 | lp=bn_data; |
125 | if (t->neg) *(p++)='-'; | 125 | if (t->neg) *(p++)='-'; |
126 | if (t->top == 0) | 126 | if (BN_is_zero(t)) |
127 | { | 127 | { |
128 | *(p++)='0'; | 128 | *(p++)='0'; |
129 | *(p++)='\0'; | 129 | *(p++)='\0'; |
@@ -300,7 +300,7 @@ int BN_print(BIO *bp, const BIGNUM *a) | |||
300 | int ret=0; | 300 | int ret=0; |
301 | 301 | ||
302 | if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end; | 302 | if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end; |
303 | if ((a->top == 0) && (BIO_write(bp,"0",1) != 1)) goto end; | 303 | if ((BN_is_zero(a)) && (BIO_write(bp,"0",1) != 1)) goto end; |
304 | for (i=a->top-1; i >=0; i--) | 304 | for (i=a->top-1; i >=0; i--) |
305 | { | 305 | { |
306 | for (j=BN_BITS2-4; j >= 0; j-=4) | 306 | for (j=BN_BITS2-4; j >= 0; j-=4) |
diff --git a/src/lib/libssl/src/crypto/bn/bn_print.c b/src/lib/libssl/src/crypto/bn/bn_print.c index e3b6aa235b..ad80dab325 100644 --- a/src/lib/libssl/src/crypto/bn/bn_print.c +++ b/src/lib/libssl/src/crypto/bn/bn_print.c | |||
@@ -79,7 +79,7 @@ char *BN_bn2hex(const BIGNUM *a) | |||
79 | } | 79 | } |
80 | p=buf; | 80 | p=buf; |
81 | if (a->neg) *(p++)='-'; | 81 | if (a->neg) *(p++)='-'; |
82 | if (a->top == 0) *(p++)='0'; | 82 | if (BN_is_zero(a)) *(p++)='0'; |
83 | for (i=a->top-1; i >=0; i--) | 83 | for (i=a->top-1; i >=0; i--) |
84 | { | 84 | { |
85 | for (j=BN_BITS2-8; j >= 0; j-=8) | 85 | for (j=BN_BITS2-8; j >= 0; j-=8) |
@@ -123,7 +123,7 @@ char *BN_bn2dec(const BIGNUM *a) | |||
123 | p=buf; | 123 | p=buf; |
124 | lp=bn_data; | 124 | lp=bn_data; |
125 | if (t->neg) *(p++)='-'; | 125 | if (t->neg) *(p++)='-'; |
126 | if (t->top == 0) | 126 | if (BN_is_zero(t)) |
127 | { | 127 | { |
128 | *(p++)='0'; | 128 | *(p++)='0'; |
129 | *(p++)='\0'; | 129 | *(p++)='\0'; |
@@ -300,7 +300,7 @@ int BN_print(BIO *bp, const BIGNUM *a) | |||
300 | int ret=0; | 300 | int ret=0; |
301 | 301 | ||
302 | if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end; | 302 | if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end; |
303 | if ((a->top == 0) && (BIO_write(bp,"0",1) != 1)) goto end; | 303 | if ((BN_is_zero(a)) && (BIO_write(bp,"0",1) != 1)) goto end; |
304 | for (i=a->top-1; i >=0; i--) | 304 | for (i=a->top-1; i >=0; i--) |
305 | { | 305 | { |
306 | for (j=BN_BITS2-4; j >= 0; j-=4) | 306 | for (j=BN_BITS2-4; j >= 0; j-=4) |