From ca21a24808efa5d562ac91f683504ae0d6dfa69f Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Tue, 19 Jun 2018 18:34:33 +0300 Subject: 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 --- cipher/seed.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cipher/seed.c') diff --git a/cipher/seed.c b/cipher/seed.c index 9f87c055..e36d3cf9 100644 --- a/cipher/seed.c +++ b/cipher/seed.c @@ -309,11 +309,12 @@ do_setkey (SEED_context *ctx, const byte *key, const unsigned keylen) } static gcry_err_code_t -seed_setkey (void *context, const byte *key, const unsigned keylen) +seed_setkey (void *context, const byte *key, const unsigned keylen, + gcry_cipher_hd_t hd) { SEED_context *ctx = context; - int rc = do_setkey (ctx, key, keylen); + (void)hd; _gcry_burn_stack (4*6 + sizeof(void*)*2 + sizeof(int)*2); return rc; } @@ -446,7 +447,7 @@ selftest (void) 0x22, 0x6B, 0xC3, 0x14, 0x2C, 0xD4, 0x0D, 0x4A, }; - seed_setkey (&ctx, key, sizeof(key)); + seed_setkey (&ctx, key, sizeof(key), NULL); seed_encrypt (&ctx, scratch, plaintext); if (memcmp (scratch, ciphertext, sizeof (ciphertext))) return "SEED test encryption failed."; -- cgit v1.2.1