diff options
author | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:56:39 +0000 |
---|---|---|
committer | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:56:39 +0000 |
commit | 58964a492275ca9a59a0cd9c8155cb2491b4b909 (patch) | |
tree | c7b16876a5789463bbbb468ef4829c8129b3d718 /crypto/bn/bn_sub.c | |
parent | d02b48c63a58ea4367a0e905979f140b7d090f86 (diff) | |
download | openssl-58964a492275ca9a59a0cd9c8155cb2491b4b909.tar.gz |
Import of old SSLeay release: SSLeay 0.9.0b
Diffstat (limited to 'crypto/bn/bn_sub.c')
-rw-r--r-- | crypto/bn/bn_sub.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crypto/bn/bn_sub.c b/crypto/bn/bn_sub.c index b0febc3421..bba80f8afb 100644 --- a/crypto/bn/bn_sub.c +++ b/crypto/bn/bn_sub.c @@ -1,5 +1,5 @@ /* crypto/bn/bn_sub.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -87,12 +87,12 @@ BIGNUM *b; if (carry) { carry=(t1 <= t2); - t1=(t1-t2-1); + t1=(t1-t2-1)&BN_MASK2; } else { carry=(t1 < t2); - t1=(t1-t2); + t1=(t1-t2)&BN_MASK2; } #if defined(IRIX_CC_BUG) && !defined(LINT) dummy=t1; @@ -110,9 +110,12 @@ BIGNUM *b; if (t1 > t2) break; } } +#if 0 memcpy(rp,ap,sizeof(*rp)*(max-i)); -/* for (; i<max; i++) - *(rp++)= *(ap++);*/ +#else + for (; i<max; i++) + *(rp++)= *(ap++); +#endif r->top=max; bn_fix_top(r); @@ -146,8 +149,9 @@ BIGNUM *b; if (add) { - i=(a->top > b->top); - if (bn_expand(r,(((i)?a->top:b->top)+1)*BN_BITS2) == NULL) + /* As a fast max size, do a a->top | b->top */ + i=(a->top | b->top)+1; + if (bn_wexpand(r,i) == NULL) return(0); if (i) bn_qadd(r,a,b); @@ -160,7 +164,7 @@ BIGNUM *b; /* We are actually doing a - b :-) */ max=(a->top > b->top)?a->top:b->top; - if (bn_expand(r,max*BN_BITS2) == NULL) return(0); + if (bn_wexpand(r,max) == NULL) return(0); if (BN_ucmp(a,b) < 0) { bn_qsub(r,b,a); |