summaryrefslogtreecommitdiff
path: root/cipher/arcfour.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-08-02 09:48:40 +0000
committerWerner Koch <wk@gnupg.org>2001-08-02 09:48:40 +0000
commit442e7215fb0b7455d31587bd6ad9ccb5d5a64dd7 (patch)
tree380d77dfc75aa345a3b8b196ef388c927d989f88 /cipher/arcfour.c
parent8bfa2df2135a1bd9823067debf0c8799bac4a936 (diff)
downloadlibgcrypt-442e7215fb0b7455d31587bd6ad9ccb5d5a64dd7.tar.gz
Made Arcfour work
Diffstat (limited to 'cipher/arcfour.c')
-rw-r--r--cipher/arcfour.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/cipher/arcfour.c b/cipher/arcfour.c
index a915cb79..c19d282d 100644
--- a/cipher/arcfour.c
+++ b/cipher/arcfour.c
@@ -78,8 +78,8 @@ arcfour_setkey( ARCFOUR_context *ctx, const byte *key, unsigned int keylen )
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 @@ selftest(void)
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 @@ _gcry_arcfour_get_info( int algo, size_t *keylen, size_t *blocksize,
return "ARCFOUR";
return NULL;
}
-
-
-
-