diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-12-14 09:14:50 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-12-14 09:14:50 +0100 |
commit | c1416e9865a498fa102987310f30c00dfecf524e (patch) | |
tree | d89db5611d20e866958acb451dc0f6e86fbe800c | |
parent | 45f27ac81df24dc030305a57f62b3c9730ffebe1 (diff) | |
download | gnutls-c1416e9865a498fa102987310f30c00dfecf524e.tar.gz |
Utilize the optimized SHA functions in Padlock HMAC.
-rw-r--r-- | lib/accelerated/x86/sha-padlock.c | 11 | ||||
-rw-r--r-- | lib/accelerated/x86/x86.h | 11 |
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/accelerated/x86/sha-padlock.c b/lib/accelerated/x86/sha-padlock.c index bafe637184..f568ab1039 100644 --- a/lib/accelerated/x86/sha-padlock.c +++ b/lib/accelerated/x86/sha-padlock.c @@ -30,6 +30,7 @@ #include <aes-padlock.h> #include <assert.h> #include <sha-padlock.h> +#include <x86.h> #ifdef HAVE_LIBNETTLE @@ -351,11 +352,11 @@ int wrap_padlock_hash_fast(gnutls_digest_algorithm_t algo, return 0; } -const struct nettle_hash padlock_sha1 = _NETTLE_HASH(sha1, SHA1); -const struct nettle_hash padlock_sha224 = _NETTLE_HASH(sha224, SHA224); -const struct nettle_hash padlock_sha256 = _NETTLE_HASH(sha256, SHA256); -const struct nettle_hash padlock_sha384 = _NETTLE_HASH(sha384, SHA384); -const struct nettle_hash padlock_sha512 = _NETTLE_HASH(sha512, SHA512); +const struct nettle_hash padlock_sha1 = NN_HASH(sha1, padlock_sha1_update, padlock_sha1_digest, SHA1); +const struct nettle_hash padlock_sha224 = NN_HASH(sha224, padlock_sha256_update, padlock_sha256_digest, SHA224); +const struct nettle_hash padlock_sha256 = NN_HASH(sha256, padlock_sha256_update, padlock_sha256_digest, SHA256); +const struct nettle_hash padlock_sha384 = NN_HASH(sha384, padlock_sha512_update, padlock_sha512_digest, SHA384); +const struct nettle_hash padlock_sha512 = NN_HASH(sha512, padlock_sha512_update, padlock_sha512_digest, SHA512); const gnutls_crypto_digest_st sha_padlock_struct = { .init = NULL, diff --git a/lib/accelerated/x86/x86.h b/lib/accelerated/x86/x86.h index cfa03fe377..ae04d32499 100644 --- a/lib/accelerated/x86/x86.h +++ b/lib/accelerated/x86/x86.h @@ -33,4 +33,15 @@ unsigned int gnutls_have_cpuid(void); #define gnutls_have_cpuid() 1 #endif /* ASM_X86_32 */ +#define NN_HASH(name, update_func, digest_func, NAME) { \ + #name, \ + sizeof(struct name##_ctx), \ + NAME##_DIGEST_SIZE, \ + NAME##_DATA_SIZE, \ + (nettle_hash_init_func *) name##_init, \ + (nettle_hash_update_func *) update_func, \ + (nettle_hash_digest_func *) digest_func \ +} + + #endif |