Signed-off-by: Dmitry Eremin-Solenikov dbaryshkov@gmail.com --- examples/nettle-openssl.c | 2 ++ nettle-meta.h | 13 +++++++++++++ sha512-224-meta.c | 1 + sha512-256-meta.c | 1 + 4 files changed, 17 insertions(+)
diff --git a/examples/nettle-openssl.c b/examples/nettle-openssl.c index bb2e6627514a..fc48a10c40b3 100644 --- a/examples/nettle-openssl.c +++ b/examples/nettle-openssl.c @@ -413,6 +413,7 @@ openssl_md5_digest(void *ctx, const struct nettle_hash nettle_openssl_md5 = { "openssl md5", sizeof(SHA_CTX), + sizeof(SHA_CTX), SHA_DIGEST_LENGTH, SHA_CBLOCK, openssl_md5_init, openssl_md5_update, @@ -449,6 +450,7 @@ openssl_sha1_digest(void *ctx, const struct nettle_hash nettle_openssl_sha1 = { "openssl sha1", sizeof(SHA_CTX), + sizeof(SHA_CTX), SHA_DIGEST_LENGTH, SHA_CBLOCK, openssl_sha1_init, openssl_sha1_update, diff --git a/nettle-meta.h b/nettle-meta.h index 8fe1cf84651b..366bd801b55c 100644 --- a/nettle-meta.h +++ b/nettle-meta.h @@ -98,6 +98,7 @@ struct nettle_hash
/* Size of the context struct */ unsigned context_size; + unsigned state_size;
/* Size of digests */ unsigned digest_size; @@ -113,6 +114,7 @@ struct nettle_hash #define _NETTLE_HASH(name, NAME) { \ #name, \ sizeof(struct name##_ctx), \ + sizeof(struct name##_ctx), \ NAME##_DIGEST_SIZE, \ NAME##_BLOCK_SIZE, \ (nettle_hash_init_func *) name##_init, \ @@ -120,6 +122,17 @@ struct nettle_hash (nettle_hash_digest_func *) name##_digest \ }
+#define _NETTLE_HASH_STATE(name, NAME) { \ + #name, \ + sizeof(struct name##_ctx), \ + sizeof(struct name##_state), \ + NAME##_DIGEST_SIZE, \ + NAME##_BLOCK_SIZE, \ + (nettle_hash_init_func *) name##_init, \ + (nettle_hash_update_func *) name##_update, \ + (nettle_hash_digest_func *) name##_digest \ +} + /* null-terminated list of digests implemented by this version of nettle */ const struct nettle_hash * const * #ifdef __GNUC__ diff --git a/sha512-224-meta.c b/sha512-224-meta.c index 24c42bfc23d9..c134ead0cedd 100644 --- a/sha512-224-meta.c +++ b/sha512-224-meta.c @@ -40,6 +40,7 @@ const struct nettle_hash nettle_sha512_224 = { "sha512-224", sizeof(struct sha512_ctx), + sizeof(struct sha512_ctx), SHA512_224_DIGEST_SIZE, SHA512_224_BLOCK_SIZE, (nettle_hash_init_func *) sha512_224_init, diff --git a/sha512-256-meta.c b/sha512-256-meta.c index 37d17c351878..458aa53ae47b 100644 --- a/sha512-256-meta.c +++ b/sha512-256-meta.c @@ -40,6 +40,7 @@ const struct nettle_hash nettle_sha512_256 = { "sha512-256", sizeof(struct sha512_ctx), + sizeof(struct sha512_ctx), SHA512_256_DIGEST_SIZE, SHA512_256_BLOCK_SIZE, (nettle_hash_init_func *) sha512_256_init,