Note, this does change ABI of these functions, as context size changes.
Signed-off-by: Dmitry Eremin-Solenikov dbaryshkov@gmail.com --- hmac-md5.c | 4 ++-- hmac-ripemd160.c | 4 ++-- hmac-sha1.c | 4 ++-- hmac-sha224.c | 4 ++-- hmac-sha256.c | 4 ++-- hmac-sha384.c | 4 ++-- hmac-sha512.c | 4 ++-- hmac.h | 11 ++++++----- 8 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/hmac-md5.c b/hmac-md5.c index a27e64f6f61b..01670af88f2d 100644 --- a/hmac-md5.c +++ b/hmac-md5.c @@ -41,7 +41,7 @@ void hmac_md5_set_key(struct hmac_md5_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_md5, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_md5, key_length, key); }
void @@ -55,5 +55,5 @@ void hmac_md5_digest(struct hmac_md5_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_md5, length, digest); + HMAC2_DIGEST(ctx, &nettle_md5, length, digest); } diff --git a/hmac-ripemd160.c b/hmac-ripemd160.c index 24e2cbe7a578..376d66822a6b 100644 --- a/hmac-ripemd160.c +++ b/hmac-ripemd160.c @@ -41,7 +41,7 @@ void hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_ripemd160, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_ripemd160, key_length, key); }
void @@ -55,5 +55,5 @@ void hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_ripemd160, length, digest); + HMAC2_DIGEST(ctx, &nettle_ripemd160, length, digest); } diff --git a/hmac-sha1.c b/hmac-sha1.c index 5e7188f92cf2..e696f608b25f 100644 --- a/hmac-sha1.c +++ b/hmac-sha1.c @@ -41,7 +41,7 @@ void hmac_sha1_set_key(struct hmac_sha1_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_sha1, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_sha1, key_length, key); }
void @@ -55,5 +55,5 @@ void hmac_sha1_digest(struct hmac_sha1_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_sha1, length, digest); + HMAC2_DIGEST(ctx, &nettle_sha1, length, digest); } diff --git a/hmac-sha224.c b/hmac-sha224.c index c5bc8750a054..74ad061a6bd2 100644 --- a/hmac-sha224.c +++ b/hmac-sha224.c @@ -41,12 +41,12 @@ void hmac_sha224_set_key(struct hmac_sha224_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_sha224, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_sha224, key_length, key); }
void hmac_sha224_digest(struct hmac_sha224_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_sha224, length, digest); + HMAC2_DIGEST(ctx, &nettle_sha224, length, digest); } diff --git a/hmac-sha256.c b/hmac-sha256.c index af5cc0f1cbef..25e69deb44f8 100644 --- a/hmac-sha256.c +++ b/hmac-sha256.c @@ -41,7 +41,7 @@ void hmac_sha256_set_key(struct hmac_sha256_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_sha256, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_sha256, key_length, key); }
void @@ -55,5 +55,5 @@ void hmac_sha256_digest(struct hmac_sha256_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_sha256, length, digest); + HMAC2_DIGEST(ctx, &nettle_sha256, length, digest); } diff --git a/hmac-sha384.c b/hmac-sha384.c index 30008b5f85c1..2ab8430e11e7 100644 --- a/hmac-sha384.c +++ b/hmac-sha384.c @@ -41,12 +41,12 @@ void hmac_sha384_set_key(struct hmac_sha512_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_sha384, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_sha384, key_length, key); }
void hmac_sha384_digest(struct hmac_sha512_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_sha384, length, digest); + HMAC2_DIGEST(ctx, &nettle_sha384, length, digest); } diff --git a/hmac-sha512.c b/hmac-sha512.c index de64637a8216..325b2d8a8642 100644 --- a/hmac-sha512.c +++ b/hmac-sha512.c @@ -41,7 +41,7 @@ void hmac_sha512_set_key(struct hmac_sha512_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_sha512, key_length, key); + HMAC2_SET_KEY(ctx, &nettle_sha512, key_length, key); }
void @@ -55,5 +55,5 @@ void hmac_sha512_digest(struct hmac_sha512_ctx *ctx, size_t length, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_sha512, length, digest); + HMAC2_DIGEST(ctx, &nettle_sha512, length, digest); } diff --git a/hmac.h b/hmac.h index 29a2798ffc21..50daa401100b 100644 --- a/hmac.h +++ b/hmac.h @@ -77,6 +77,7 @@ hmac_set_key(void *outer, void *inner, void *state, const struct nettle_hash *hash, size_t length, const uint8_t *key);
+ /* This function is not strictly needed, it's s just the same as the * hash update function. */ void @@ -133,7 +134,7 @@ hmac2_digest(void *state, void *derived_key, /* HMAC using specific hash functions */
/* hmac-md5 */ -struct hmac_md5_ctx HMAC_CTX(struct md5_ctx); +struct hmac_md5_ctx HMAC2_CTX(struct md5_ctx, MD5_BLOCK_SIZE);
void hmac_md5_set_key(struct hmac_md5_ctx *ctx, @@ -149,7 +150,7 @@ hmac_md5_digest(struct hmac_md5_ctx *ctx,
/* hmac-ripemd160 */ -struct hmac_ripemd160_ctx HMAC_CTX(struct ripemd160_ctx); +struct hmac_ripemd160_ctx HMAC2_CTX(struct ripemd160_ctx, RIPEMD160_BLOCK_SIZE);
void hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx, @@ -165,7 +166,7 @@ hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx,
/* hmac-sha1 */ -struct hmac_sha1_ctx HMAC_CTX(struct sha1_ctx); +struct hmac_sha1_ctx HMAC2_CTX(struct sha1_ctx, SHA1_BLOCK_SIZE);
void hmac_sha1_set_key(struct hmac_sha1_ctx *ctx, @@ -180,7 +181,7 @@ hmac_sha1_digest(struct hmac_sha1_ctx *ctx, size_t length, uint8_t *digest);
/* hmac-sha256 */ -struct hmac_sha256_ctx HMAC_CTX(struct sha256_ctx); +struct hmac_sha256_ctx HMAC2_CTX(struct sha256_ctx, SHA256_BLOCK_SIZE);
void hmac_sha256_set_key(struct hmac_sha256_ctx *ctx, @@ -208,7 +209,7 @@ hmac_sha224_digest(struct hmac_sha224_ctx *ctx, size_t length, uint8_t *digest);
/* hmac-sha512 */ -struct hmac_sha512_ctx HMAC_CTX(struct sha512_ctx); +struct hmac_sha512_ctx HMAC2_CTX(struct sha512_ctx, SHA512_BLOCK_SIZE);
void hmac_sha512_set_key(struct hmac_sha512_ctx *ctx,