diff options
author | Niels Möller <nisse@lysator.liu.se> | 2020-02-09 09:57:34 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2020-02-09 09:57:34 +0100 |
commit | f67dd4f0ed34c9e41cde119b0b28c7a4342d37df (patch) | |
tree | 6530ae21d180f47b8cbd1dadb8b6132276e5694e /nettle-meta.h | |
parent | 9c04199d7faef69b63f7d53b9f1ef1c85e37a76e (diff) | |
download | nettle-f67dd4f0ed34c9e41cde119b0b28c7a4342d37df.tar.gz |
Add meta interface for HMAC functions.
Based on patches by Daiki Ueno.
Diffstat (limited to 'nettle-meta.h')
-rw-r--r-- | nettle-meta.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/nettle-meta.h b/nettle-meta.h index 42f8a863..d5a009f4 100644 --- a/nettle-meta.h +++ b/nettle-meta.h @@ -2,7 +2,7 @@ Information about algorithms. - Copyright (C) 2002, 2014 Niels Möller + Copyright (C) 2002, 2014, 2020 Niels Möller This file is part of GNU Nettle. @@ -257,9 +257,28 @@ extern const struct nettle_armor nettle_base64; extern const struct nettle_armor nettle_base64url; extern const struct nettle_armor nettle_base16; +#define _NETTLE_HMAC(name, HASH) { \ + #name, \ + sizeof(struct name##_ctx), \ + HASH##_DIGEST_SIZE, \ + HASH##_DIGEST_SIZE, \ + name##_set_key_wrapper, \ + (nettle_hash_update_func *) name##_update, \ + (nettle_hash_digest_func *) name##_digest, \ +} + extern const struct nettle_mac nettle_cmac_aes128; extern const struct nettle_mac nettle_cmac_aes256; +/* HMAC variants with key size = digest size */ +extern const struct nettle_mac nettle_hmac_md5; +extern const struct nettle_mac nettle_hmac_ripemd160; +extern const struct nettle_mac nettle_hmac_sha1; +extern const struct nettle_mac nettle_hmac_sha224; +extern const struct nettle_mac nettle_hmac_sha256; +extern const struct nettle_mac nettle_hmac_sha384; +extern const struct nettle_mac nettle_hmac_sha512; + #ifdef __cplusplus } #endif |