Hi,

first of all: could you please reassign this bug to libgnutls11?
Thanks.

I found the reason for the errors after checking newer versions of
gnutls (newer than the sarge version, which is based on 1.0.16).
Version 1.0.20 solved the problem:

http://lists.gnupg.org/pipermail/gnutls-dev/2004-August/000719.html
http://lists.gnupg.org/pipermail/gnutls-dev/2004-August/000712.html

The fix in 1.0.20 was not backported into the sarge gnutls package. I
append it for simplicity.

It would be nice if this fix could be incorporated somehow into sarge
since libgnutls11 in sarge is broken without it.

regards,

        Daniel

-- 
-----------------------------------------------------------------
Daniel Hermann,   Institut fuer Theorie der Kondensierten Materie
Universitaet Karlsruhe                  Tel: ++49 (0)721 608-7328
Postfach 6980                           Fax: ++49 (0)721 608-7779
76128 Karlsruhe, Germany      email: [EMAIL PROTECTED]
-----------------------------------------------------------------
--- lib/gnutls_pk.c     2004-08-04 23:36:02.000000000 +0200
+++ lib/gnutls_pk.c     2004-08-17 11:13:29.000000000 +0200
@@ -95,33 +95,15 @@
                        gnutls_afree(edata);
                        return ret;
                }
-               for (i = 0; i < psize; i++) {
-                       opaque rnd[3];
-
-                       /* Read three random bytes that will be
-                        * used to replace the zeros.
-                        */
-                       if ( (ret=_gnutls_get_random( rnd, 3, 
GNUTLS_STRONG_RANDOM)) < 0) {
-                               gnutls_assert();
-                               gnutls_afree(edata);
-                               return ret;
-                       }
-                       /* use non zero values for 
-                        * the first two.
-                        */
-                       if (rnd[0]==0) rnd[0] = 0xaf;
-                       if (rnd[1]==0) rnd[1] = 0xae;
-
-                       if (ps[i] == 0) {
-                               /* If the first one is zero then set it to 
rnd[0].
-                                * If the second one is zero then set it to 
rnd[1].
-                                * Otherwise add (mod 256) the two previous 
ones plus rnd[2], or use
-                                * rnd[1] if the value == 0.
-                                */
-                               if (i<2) ps[i] = rnd[i];
-                               else ps[i] = GMAX( rnd[2] + ps[i-1] + ps[i-2], 
rnd[1]);
-                       }
-               }
+               for (i = 0; i < psize; i++)
+                 while (ps[i] == 0) {
+                   if ((ret =
+                        _gnutls_get_random(&ps[i], 1, GNUTLS_STRONG_RANDOM)) < 
0) {
+                     gnutls_assert();
+                     gnutls_afree(edata);
+                     return ret;
+                   }
+                 }
                break;
        case 1:
                /* using private key */

Reply via email to