summaryrefslogtreecommitdiff
path: root/cipher/seed.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2018-06-19 18:34:33 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2018-06-19 19:29:25 +0300
commitca21a24808efa5d562ac91f683504ae0d6dfa69f (patch)
treeb0088b2bfbe08948d4275e9036e7fdce9adbb8e4 /cipher/seed.c
parentb6e6ace324440f564df664e27f8276ef01f76795 (diff)
downloadlibgcrypt-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/seed.c')
-rw-r--r--cipher/seed.c7
1 files changed, 4 insertions, 3 deletions
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.";