Add SHA512/224 and SHA512/256 algorithms
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Fri, 5 Apr 2019 17:10:32 +0000 (20:10 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Fri, 5 Apr 2019 17:10:32 +0000 (20:10 +0300)
commita3683b6f623189a4b65bb584bb9e65e3ad7b3139
tree78b33be41807cd928b2115b8a88da219e9d00768
parentc6055aaccac86e1ca8a9d35c980d7abbacf2a9ff
Add SHA512/224 and SHA512/256 algorithms

* cipher/mac-hmac.c (map_mac_algo_to_md): Add mapping for SHA512/224
and SHA512/256.
(_gcry_mac_type_spec_hmac_sha512_256)
(_gcry_mac_type_spec_hmac_sha512_224): New.
* cipher/mac-internal.h (_gcry_mac_type_spec_hmac_sha512_256)
(_gcry_mac_type_spec_hmac_sha512_224): New.
* cipher/mac.c (mac_list, mac_list_algo101): Add SHA512/224 and
SHA512/256.
* cipher/md.c (digest_list, digest_list_algo301)
(prepare_macpads): Ditto.
* cipher/sha512.c (run_selftests): Ditto.
(sha512_init_common): Move common initialization here.
(sha512_init, sha384_init): Use common initialization function.
(sha512_224_init, sha512_256_init, _gcry_sha512_224_hash_buffer)
(_gcry_sha512_224_hash_buffers, _gcry_sha512_256_hash_buffer)
(_gcry_sha512_256_hash_buffers, selftests_sha512_224)
(selftests_sha512_256, sha512_224_asn, oid_spec_sha512_224)
(_gcry_digest_spec_sha512_224, sha512_256_asn, oid_spec_sha512_256)
(_gcry_digest_spec_sha512_256): New.
* doc/gcrypt.texi: Add SHA512/224 and SHA512/256; Add missing
HMAC-BLAKE2s and HMAC-BLAKE2b.
* src/cipher.h (_gcry_digest_spec_sha512_224)
(_gcry_digest_spec_sha512_256): New.
* src/gcrypt.h.in (GCRY_MD_SHA512_256, GCRY_MD_SHA512_224): New.
(GCRY_MAC_HMAC_SHA512_256, GCRY_MAC_HMAC_SHA512_224): New.
* tests/basic.c (check_digests): Add SHA512/224 and SHA512/256
test vectors.
--

This change adds truncated SHA512/224 and SHA512/256 algorithms
specified in FIPS 180-4.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/mac-hmac.c
cipher/mac-internal.h
cipher/mac.c
cipher/md.c
cipher/sha512.c
doc/gcrypt.texi
src/cipher.h
src/gcrypt.h.in
tests/basic.c