This is my current attempt to rework hash/HMAC internal API to use separate block buffer from main hash state and thus decrease HMAC context data size by removing byte buffer duplication. Unfortunately this breaks GnuTLS accelerated implementations. Patch for GnuTLS will be provided, if this approach is going to be accepted to Nettle.
The following changes since commit ee5d62898cf070f08beedc410a8d7c418588bd95:
Fixes for Nettle 3.5.1 (2019-06-26 21:51:36 +0200)
are available in the Git repository at:
https://gitlab.com/GostCrypt/nettle.git gitlab/hmac-3
for you to fetch changes up to dda00a07d26dbdb6647186c778febe870c30cafc:
hmac-sha512/hmac-sha384: use new hmac and hash split state/buffer interface (2019-07-02 16:21:48 +0300)
---------------------------------------------------------------- Dmitry Eremin-Solenikov (14): sha512-224,-256: use _NETTLE_HASH_US instead of hand-coding structure definitions hash: start separating state and block contexts macros: add interface for working with separate hash state and buffer md5: split context into hash state and byte buffer hmac: add interface for working with separate hash state and buffer hmac-md5: use new hmac and hash split state/buffer interface ripemd160: split context into hash state and byte buffer hmac-ripemd160: use new hmac and hash split state/buffer interface sha1: split context into hash state and byte buffer hmac-sha1: use new hmac and hash split state/buffer interface sha256/sha224: split context into hash state and byte buffer hmac-sha256/hmac-sha224: use new hmac and hash split state/buffer interface sha512/sha384: split context into hash state and byte buffer hmac-sha512/hmac-sha384: use new hmac and hash split state/buffer interface
hmac-md5.c | 6 +-- hmac-ripemd160.c | 6 +-- hmac-sha1.c | 6 +-- hmac-sha224.c | 4 +- hmac-sha256.c | 6 +-- hmac-sha384.c | 4 +- hmac-sha512.c | 6 +-- hmac.c | 62 ++++++++++++++++++++++++++ hmac.h | 37 +++++++++++++--- macros.h | 66 ++++++++++++++++++++++++++++ md5-meta.c | 3 ++ md5.c | 52 ++++++++++++++++------ md5.h | 29 ++++++++++-- nettle-meta.h | 56 ++++++++++++++++++++++++ nettle-types.h | 15 +++++++ ripemd160-meta.c | 3 ++ ripemd160.c | 50 ++++++++++++++++----- ripemd160.h | 29 ++++++++++-- sha1-meta.c | 3 ++ sha1.c | 56 +++++++++++++++++------- sha1.h | 29 ++++++++++-- sha2.h | 87 +++++++++++++++++++++++++++++++++--- sha224-meta.c | 3 ++ sha256-meta.c | 3 ++ sha256.c | 76 +++++++++++++++++++++++++------- sha384-meta.c | 3 ++ sha512-224-meta.c | 12 +---- sha512-256-meta.c | 12 +---- sha512-meta.c | 3 ++ sha512.c | 129 +++++++++++++++++++++++++++++++++++++++--------------- 30 files changed, 701 insertions(+), 155 deletions(-)