ECDSA genkey w GCRY_VERY_STRONG_RANDOM is painfully slow

Werner Koch wk at gnupg.org
Thu Jun 10 11:07:14 CEST 2010


On Wed,  9 Jun 2010 20:40, n3npq at mac.com said:
> Attached is a patch to decrease random strength if "(transient-key)"
> is in the S-expr (just like RSA/DSA).

Applied.  Thanks.

> BTW, I'm also seeing this building from gcrypt SVN trunk on RHEL6 beta
> using this malloc voo-doo in ~/.bash_profile:

Fixed.  Here is a patch which can also be used for 1.4:

2010-06-10  Werner Koch  <wk at g10code.com>

	* t-mpi-bit.c (mpi2bitstr_nlz): Handle case for LENGTH==0.


--- tests/t-mpi-bit.c	(revision 1429)
+++ tests/t-mpi-bit.c	(working copy)
@@ -108,13 +108,20 @@
 {
   char *p, *buf;
   size_t length = gcry_mpi_get_nbits (a);
-  
-  buf = p = xmalloc (length + 1);
-  while (length-- > 1)
-    *p++ = gcry_mpi_test_bit (a, length) ? '1':'0';
-  *p++ = gcry_mpi_test_bit (a, 0) ? '1':'0';
+
+  if (!length)
+    {
+      buf = p = xmalloc (2);
+      *p++ = '0';
+    }
+  else
+    {
+      buf = p = xmalloc (length + 1);
+      while (length-- > 1)
+        *p++ = gcry_mpi_test_bit (a, length) ? '1':'0';
+      *p++ = gcry_mpi_test_bit (a, 0) ? '1':'0';
+    }
   *p = 0;
-
   return buf;
 }
 


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gcrypt-devel mailing list