From: Daiki Ueno dueno@redhat.com
The struct was defined in testutils.h as the interface was not stable. This generalizes the interface to cover all defined MAC algorithms in nettle.
Signed-off-by: Daiki Ueno dueno@redhat.com --- nettle-meta.h | 22 ++++++++++++++++++++++ testsuite/testutils.h | 29 ----------------------------- 2 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/nettle-meta.h b/nettle-meta.h index 74e50e59..b03da208 100644 --- a/nettle-meta.h +++ b/nettle-meta.h @@ -238,6 +238,28 @@ extern const struct nettle_armor nettle_base64; extern const struct nettle_armor nettle_base64url; extern const struct nettle_armor nettle_base16;
+struct nettle_mac +{ + const char *name; + + /* Size of the context struct */ + unsigned context_size; + + /* Size of digests */ + unsigned digest_size; + + /* Suggested key size; other sizes are sometimes possible */ + unsigned key_size; + + /* Suggested nonce size; 0 if nonce is not used */ + unsigned nonce_size; + + nettle_set_key_func *set_key; + nettle_set_key_func *set_nonce; + nettle_hash_update_func *update; + nettle_hash_digest_func *digest; +}; + #ifdef __cplusplus } #endif diff --git a/testsuite/testutils.h b/testsuite/testutils.h index f4ea38da..78daf62b 100644 --- a/testsuite/testutils.h +++ b/testsuite/testutils.h @@ -79,35 +79,6 @@ test_main(void);
extern int verbose;
-/* FIXME: When interface stabilizes, move to nettle-meta.h */ -struct nettle_mac -{ - const char *name; - - /* Size of the context struct */ - unsigned context_size; - - /* Size of digests */ - unsigned digest_size; - - /* Suggested key size; other sizes are sometimes possible. */ - unsigned key_size; - - nettle_set_key_func *set_key; - nettle_hash_update_func *update; - nettle_hash_digest_func *digest; -}; - -#define _NETTLE_HMAC(name, NAME, keysize) { \ - #name, \ - sizeof(struct hmac_##name##_ctx), \ - NAME##_DIGEST_SIZE, \ - NAME##_DIGEST_SIZE, \ - hmac_##name##_set_key, \ - hmac_##name##_update, \ - hmac_##name##_digest, \ -} - /* Test functions deallocate their inputs when finished.*/ void test_cipher(const struct nettle_cipher *cipher,