summaryrefslogtreecommitdiff
path: root/Cryptlib/OpenSSL/crypto/bn/bn_word.c
diff options
context:
space:
mode:
authorMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2015-05-06 09:49:30 -0400
committerMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2015-05-06 09:49:30 -0400
commit2283f5e85dbc78dd10810cb6ebfa39e61ab6759e (patch)
tree88017c6acfa326ebaab2d7a4935534f65a36db9b /Cryptlib/OpenSSL/crypto/bn/bn_word.c
parent3967dc652453e47ecd5f21a55bb687be15c59e9c (diff)
downloadefi-boot-shim-2283f5e85dbc78dd10810cb6ebfa39e61ab6759e.tar.gz
efi-boot-shim-2283f5e85dbc78dd10810cb6ebfa39e61ab6759e.zip
Unapplying patches to prevent spurious conflicts.
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/bn/bn_word.c')
-rwxr-xr-xCryptlib/OpenSSL/crypto/bn/bn_word.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/Cryptlib/OpenSSL/crypto/bn/bn_word.c b/Cryptlib/OpenSSL/crypto/bn/bn_word.c
index de83a15b..ee7b87c4 100755
--- a/Cryptlib/OpenSSL/crypto/bn/bn_word.c
+++ b/Cryptlib/OpenSSL/crypto/bn/bn_word.c
@@ -144,17 +144,26 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
a->neg=!(a->neg);
return(i);
}
- for (i=0;w!=0 && i<a->top;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 (;;)
{
- a->d[i] = l = (a->d[i]+w)&BN_MASK2;
- w = (w>l)?1:0;
+ 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++;
}
- if (w && i==a->top)
- {
- if (bn_wexpand(a,a->top+1) == NULL) return 0;
+ if (i >= a->top)
a->top++;
- a->d[i]=w;
- }
bn_check_top(a);
return(1);
}