projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT2163: Remove some unneeded #include's
[openssl.git]
/
crypto
/
bn
/
bn_word.c
diff --git
a/crypto/bn/bn_word.c
b/crypto/bn/bn_word.c
index d83032c66ca01438e8f35d0b21d4d19d4e429eaf..8809d0714aa07394de44df3d0f639c664b6a17bc 100644
(file)
--- a/
crypto/bn/bn_word.c
+++ b/
crypto/bn/bn_word.c
@@
-56,7
+56,6
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
-#include <stdio.h>
#include "cryptlib.h"
#include "bn_lcl.h"
#include "cryptlib.h"
#include "bn_lcl.h"
@@
-144,37
+143,21
@@
int BN_add_word(BIGNUM *a, BN_ULONG w)
a->neg=!(a->neg);
return(i);
}
a->neg=!(a->neg);
return(i);
}
- /* Only expand (and risk failing) if it's possibly necessary */
- if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) &&
- (bn_wexpand(a,a->top+1) == NULL))
- return(0);
- i=0;
- for (;;)
+ for (i=0;w!=0 && i<a->top;i++)
{
{
- if (i >= a->top)
- l=w;
- else
- l=(a->d[i]+w)&BN_MASK2;
- a->d[i]=l;
- if (w > l)
- w=1;
- else
- break;
- i++;
+ a->d[i] = l = (a->d[i]+w)&BN_MASK2;
+ w = (w>l)?1:0;
}
}
- if (i >= a->top)
+ if (w && i==a->top)
+ {
+ if (bn_wexpand(a,a->top+1) == NULL) return 0;
a->top++;
a->top++;
+ a->d[i]=w;
+ }
bn_check_top(a);
return(1);
}
bn_check_top(a);
return(1);
}
-int BN_add_signed_word(BIGNUM *a, BN_LONG w)
- {
- if(w < 0)
- return 0;
- return BN_add_word(a, (BN_ULONG)w);
- }
-
int BN_sub_word(BIGNUM *a, BN_ULONG w)
{
int i;
int BN_sub_word(BIGNUM *a, BN_ULONG w)
{
int i;