diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2018-06-19 18:34:33 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2018-06-19 19:29:25 +0300 |
commit | ca21a24808efa5d562ac91f683504ae0d6dfa69f (patch) | |
tree | b0088b2bfbe08948d4275e9036e7fdce9adbb8e4 /cipher/arcfour.c | |
parent | b6e6ace324440f564df664e27f8276ef01f76795 (diff) | |
download | libgcrypt-ca21a24808efa5d562ac91f683504ae0d6dfa69f.tar.gz |
Pass cipher object pointer to setkey functions
* cipher/cipher.c (cipher_setkey): Pass cipher object pointer to
cipher's setkey function.
* cipher/arcfour.c: Add gcry_cipher_hd_t parameter for setkey
functions and update selftests to pass NULL pointer.
* cipher/blowfish.c: Ditto.
* cipher/camellia-glue.c: Ditto.
* cipher/cast5.c: Ditto.
* cipher/chacha20.c: Ditto.
* cipher/cipher-selftest.c: Ditto.
* cipher/des.c: Ditto.
* cipher/gost28147.c: Ditto.
* cipher/idea.c: Ditto.
* cipher/rfc2268.c: Ditto.
* cipher/rijndael.c: Ditto.
* cipher/salsa20.c: Ditto.
* cipher/seed.c: Ditto.
* cipher/serpent.c: Ditto.
* cipher/twofish.c: Ditto.
* src/cipher-proto.h: Ditto.
--
This allows setkey function to replace bulk cipher operations
with faster alternative.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/arcfour.c')
-rw-r--r-- | cipher/arcfour.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cipher/arcfour.c b/cipher/arcfour.c index 085df9bb..72decf08 100644 --- a/cipher/arcfour.c +++ b/cipher/arcfour.c @@ -170,10 +170,12 @@ do_arcfour_setkey (void *context, const byte *key, unsigned int keylen) } static gcry_err_code_t -arcfour_setkey ( void *context, const byte *key, unsigned int keylen ) +arcfour_setkey ( void *context, const byte *key, unsigned int keylen, + gcry_cipher_hd_t hd ) { ARCFOUR_context *ctx = (ARCFOUR_context *) context; gcry_err_code_t rc = do_arcfour_setkey (ctx, key, keylen ); + (void)hd; return rc; } @@ -193,11 +195,11 @@ selftest(void) static const byte ciphertext_1[] = { 0xF1, 0x38, 0x29, 0xC9, 0xDE }; - arcfour_setkey( &ctx, key_1, sizeof(key_1)); + arcfour_setkey( &ctx, key_1, sizeof(key_1), NULL); 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)); + arcfour_setkey( &ctx, key_1, sizeof(key_1), NULL); encrypt_stream(&ctx, scratch, scratch, sizeof(plaintext_1)); /* decrypt */ if ( memcmp (scratch, plaintext_1, sizeof (plaintext_1))) return "Arcfour decryption test 1 failed."; |