projects
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6859bb1
)
This improves the placement of check_top() macros in a couple of bn_lib
author
Geoff Thorpe
<geoff@openssl.org>
Sat, 29 Nov 2003 20:34:07 +0000
(20:34 +0000)
committer
Geoff Thorpe
<geoff@openssl.org>
Sat, 29 Nov 2003 20:34:07 +0000
(20:34 +0000)
functions.
crypto/bn/bn_lib.c
patch
|
blob
|
history
diff --git
a/crypto/bn/bn_lib.c
b/crypto/bn/bn_lib.c
index 43c336f526091718796d81e16b69843e3fff79de..b499292884ad6b51f9744a4ac1d27880be2f0d5d 100644
(file)
--- a/
crypto/bn/bn_lib.c
+++ b/
crypto/bn/bn_lib.c
@@
-579,6
+579,9
@@
void BN_swap(BIGNUM *a, BIGNUM *b)
BN_ULONG *tmp_d;
int tmp_top, tmp_dmax, tmp_neg;
BN_ULONG *tmp_d;
int tmp_top, tmp_dmax, tmp_neg;
+ bn_check_top(a);
+ bn_check_top(b);
+
flags_old_a = a->flags;
flags_old_b = b->flags;
flags_old_a = a->flags;
flags_old_b = b->flags;
@@
-606,11
+609,11
@@
void BN_swap(BIGNUM *a, BIGNUM *b)
void BN_clear(BIGNUM *a)
{
void BN_clear(BIGNUM *a)
{
+ bn_check_top(a);
if (a->d != NULL)
memset(a->d,0,a->dmax*sizeof(a->d[0]));
a->top=0;
a->neg=0;
if (a->d != NULL)
memset(a->d,0,a->dmax*sizeof(a->d[0]));
a->top=0;
a->neg=0;
- bn_check_top(a);
}
BN_ULONG BN_get_word(const BIGNUM *a)
}
BN_ULONG BN_get_word(const BIGNUM *a)
@@
-637,6
+640,7
@@
BN_ULONG BN_get_word(const BIGNUM *a)
int BN_set_word(BIGNUM *a, BN_ULONG w)
{
int i,n;
int BN_set_word(BIGNUM *a, BN_ULONG w)
{
int i,n;
+ bn_check_top(a);
if (bn_expand(a,(int)sizeof(BN_ULONG)*8) == NULL) return(0);
n=sizeof(BN_ULONG)/BN_BYTES;
if (bn_expand(a,(int)sizeof(BN_ULONG)*8) == NULL) return(0);
n=sizeof(BN_ULONG)/BN_BYTES;
@@
-670,6
+674,7
@@
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
if (ret == NULL) ret=BN_new();
if (ret == NULL) return(NULL);
if (ret == NULL) ret=BN_new();
if (ret == NULL) return(NULL);
+ bn_check_top(ret);
l=0;
n=len;
if (n == 0)
l=0;
n=len;
if (n == 0)
@@
-705,13
+710,13
@@
int BN_bn2bin(const BIGNUM *a, unsigned char *to)
int n,i;
BN_ULONG l;
int n,i;
BN_ULONG l;
+ bn_check_top(a);
n=i=BN_num_bytes(a);
while (i-- > 0)
{
l=a->d[i/BN_BYTES];
*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
}
n=i=BN_num_bytes(a);
while (i-- > 0)
{
l=a->d[i/BN_BYTES];
*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
}
- bn_check_top(a);
return(n);
}
return(n);
}