diff options
author | Werner Koch <wk@gnupg.org> | 2001-08-02 09:48:40 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2001-08-02 09:48:40 +0000 |
commit | 442e7215fb0b7455d31587bd6ad9ccb5d5a64dd7 (patch) | |
tree | 380d77dfc75aa345a3b8b196ef388c927d989f88 /cipher | |
parent | 8bfa2df2135a1bd9823067debf0c8799bac4a936 (diff) | |
download | libgcrypt-442e7215fb0b7455d31587bd6ad9ccb5d5a64dd7.tar.gz |
Made Arcfour work
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/ChangeLog | 6 | ||||
-rw-r--r-- | cipher/arcfour.c | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog index fa42f7fa..e96ce481 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,9 @@ +2001-08-02 Werner Koch <wk@gnupg.org> + + * arcfour.c (arcfour_setkey): Check the minimim keylength against + bytes and not bits. + (selftest): Must reset the key before decryption. + 2001-05-31 Werner Koch <wk@gnupg.org> * sha1.c (sha1_init): Made static. 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; } - - - - |