diff options
author | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 11:00:56 +0000 |
---|---|---|
committer | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 11:00:56 +0000 |
commit | dfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c (patch) | |
tree | 2f74e0cfd76a9e092548a9bf52e579aef984299b /crypto/bn/bn_word.c | |
parent | 58964a492275ca9a59a0cd9c8155cb2491b4b909 (diff) |
Import of old SSLeay release: SSLeay 0.9.1b (unreleased)SSLeay
Diffstat (limited to 'crypto/bn/bn_word.c')
-rw-r--r-- | crypto/bn/bn_word.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crypto/bn/bn_word.c b/crypto/bn/bn_word.c index 4b3d0f011d..9c168e4f48 100644 --- a/crypto/bn/bn_word.c +++ b/crypto/bn/bn_word.c @@ -62,7 +62,7 @@ BN_ULONG BN_mod_word(a, w) BIGNUM *a; -unsigned long w; +BN_ULONG w; { #ifndef BN_LLONG BN_ULONG ret=0; @@ -75,8 +75,8 @@ unsigned long w; for (i=a->top-1; i>=0; i--) { #ifndef BN_LLONG - ret=((ret<<BN_BITS4)|((a->d[i]>>BN_BITS4)&BN_MASK2l))%(unsigned long)w; - ret=((ret<<BN_BITS4)|(a->d[i]&BN_MASK2l))%(unsigned long)w; + ret=((ret<<BN_BITS4)|((a->d[i]>>BN_BITS4)&BN_MASK2l))%w; + ret=((ret<<BN_BITS4)|(a->d[i]&BN_MASK2l))%w; #else ret=(BN_ULLONG)(((ret<<(BN_ULLONG)BN_BITS2)|a->d[i])% (BN_ULLONG)w); @@ -87,7 +87,7 @@ unsigned long w; BN_ULONG BN_div_word(a, w) BIGNUM *a; -unsigned long w; +BN_ULONG w; { BN_ULONG ret; int i; @@ -100,18 +100,18 @@ unsigned long w; BN_ULONG l,d; l=a->d[i]; - d=bn_div64(ret,l,w); + d=bn_div_words(ret,l,w); ret=(l-((d*w)&BN_MASK2))&BN_MASK2; a->d[i]=d; } - if (a->d[a->top-1] == 0) + if ((a->top > 0) && (a->d[a->top-1] == 0)) a->top--; return(ret); } int BN_add_word(a, w) BIGNUM *a; -unsigned long w; +BN_ULONG w; { BN_ULONG l; int i; @@ -144,7 +144,7 @@ unsigned long w; int BN_sub_word(a, w) BIGNUM *a; -unsigned long w; +BN_ULONG w; { int i; @@ -185,7 +185,7 @@ unsigned long w; int BN_mul_word(a,w) BIGNUM *a; -unsigned long w; +BN_ULONG w; { BN_ULONG ll; @@ -199,6 +199,6 @@ unsigned long w; a->d[a->top++]=ll; } } - return(0); + return(1); } |