HI,

as requested by Nil Larschs, i'm sending this diff to [EMAIL PROTECTED]

For a discussion of these bugs and fixes, see the thread
http://www.mail-archive.com/[EMAIL PROTECTED]/msg16241.html

        -Otto

Index: bn_lib.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_lib.c,v
retrieving revision 1.9
diff -u -r1.9 bn_lib.c
--- bn_lib.c    12 May 2003 02:18:36 -0000      1.9
+++ bn_lib.c    24 Sep 2003 18:29:57 -0000
@@ -702,6 +702,9 @@
                { gt=1; lt= -1; }
        else    { gt= -1; lt=1; }
 
+       bn_fix_top(a);
+       bn_fix_top(b);
+
        if (a->top > b->top) return(gt);
        if (a->top < b->top) return(lt);
        for (i=a->top-1; i>=0; i--)
Index: bn_print.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_print.c,v
retrieving revision 1.6
diff -u -r1.6 bn_print.c
--- bn_print.c  6 Apr 2003 09:22:53 -0000       1.6
+++ bn_print.c  24 Sep 2003 18:20:08 -0000
@@ -79,7 +79,7 @@
                }
        p=buf;
        if (a->neg) *(p++)='-';
-       if (a->top == 0) *(p++)='0';
+       if (BN_is_zero(a)) *(p++)='0';
        for (i=a->top-1; i >=0; i--)
                {
                for (j=BN_BITS2-8; j >= 0; j-=8)
@@ -123,7 +123,7 @@
        p=buf;
        lp=bn_data;
        if (t->neg) *(p++)='-';
-       if (t->top == 0)
+       if (BN_is_zero(t))
                {
                *(p++)='0';
                *(p++)='\0';
@@ -300,7 +300,7 @@
        int ret=0;
 
        if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end;
-       if ((a->top == 0) && (BIO_write(bp,"0",1) != 1)) goto end;
+       if ((BN_is_zero(a)) && (BIO_write(bp,"0",1) != 1)) goto end;
        for (i=a->top-1; i >=0; i--)
                {
                for (j=BN_BITS2-4; j >= 0; j-=4)
Index: bn_word.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_word.c,v
retrieving revision 1.5
diff -u -r1.5 bn_word.c
--- bn_word.c   12 May 2003 02:18:36 -0000      1.5
+++ bn_word.c   24 Sep 2003 18:31:25 -0000
@@ -110,6 +110,9 @@
        BN_ULONG l;
        int i;
 
+       if ((w & BN_MASK2) == 0)
+               return(1);
+
        if (a->neg)
                {
                a->neg=0;
@@ -142,6 +145,9 @@
 int BN_sub_word(BIGNUM *a, BN_ULONG w)
        {
        int i;
+
+       if ((w & BN_MASK2) == 0)
+               return(1);
 
        if (BN_is_zero(a) || a->neg)
                {

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to