summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-08-21 08:14:20 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-08-21 08:14:20 +0000
commit47c10a7a25eef46729d8abffdb6e8450a65f96f2 (patch)
tree468ba8b480a8c3f4a48be126e1c369495375223e /lib/libcrypto
parentfa0078ee81b77dd854163a6a3450f176b1026135 (diff)
Do not produce a corrupt BIGNUM when adding 0 to 0 using BN_add_word().
ok markus@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/bn/bn_word.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libcrypto/bn/bn_word.c b/lib/libcrypto/bn/bn_word.c
index 988e0ca7b37..ab858d70ff6 100644
--- a/lib/libcrypto/bn/bn_word.c
+++ b/lib/libcrypto/bn/bn_word.c
@@ -110,6 +110,9 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
BN_ULONG l;
int i;
+ if ((w & BN_MASK2) == 0)
+ return(1);
+
if (a->neg)
{
a->neg=0;