Fw: Arcfour fixed

Nikos Mavroyanopoulos nmav at ovrimos.com
Thu Aug 2 14:26:02 CEST 2001


With this fix gnutls can be used with arcfour too.

Begin forwarded message:

Date: 02 Aug 2001 11:53:13 +0200
From: Werner Koch <wk at gnupg.org>
To: gcrypt-devel at gnupg.org
Subject: Arcfour fixed


Hi,

2 silly bugs stopped us from using Arcfour in Libgcrypt.
Here is the fix against 1.1.3:

Index: arcfour.c
===================================================================
RCS file: /cvs/gnupg/libgcrypt/cipher/arcfour.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- arcfour.c	2001/05/31 14:16:54	1.3
+++ arcfour.c	2001/08/02 09:48:40	1.4
@@ -78,8 +78,8 @@
     if( selftest_failed )
 	return GCRYERR_SELFTEST;
 
-    if( keylen < 40 )
-	return GCRYERR_INV_KEYLEN;
+    if( keylen < 40/8 ) /* we want at least 40 bits */
+        return GCRYERR_INV_KEYLEN; 
 
     ctx->idx_i = ctx->idx_j = 0;
     for (i=0; i < 256; i++ )
@@ -118,6 +118,7 @@
     encrypt_stream( &ctx, scratch, plaintext_1, sizeof(plaintext_1));
     if (memcmp (scratch, ciphertext_1, sizeof (ciphertext_1)))
         return "Arcfour encryption test 1 failed.";
+    arcfour_setkey( &ctx, key_1, sizeof(key_1));
     encrypt_stream(&ctx, scratch, scratch, sizeof(plaintext_1)); /* decrypt */
     if ( memcmp (scratch, plaintext_1, sizeof (plaintext_1)))
         return "Arcfour decryption test 1 failed.";
@@ -159,7 +160,3 @@
 	return "ARCFOUR";
     return NULL;
 }
-
-
-
-


-- 
Werner Koch        Omnis enim res, quae dando non deficit, dum habetur
g10 Code GmbH      et non datur, nondum habetur, quomodo habenda est.
Privacy Solutions                                        -- Augustinus


-- 
Nikos Mavroyanopoulos




More information about the Gnutls-devel mailing list