keccak: add md_read support for SHAKE algorithms
* cipher/hash-common.c (_gcry_hash_selftest_check_one): Adjust for SHAKE algorithms now returning non-zero for digest length. * cipher/keccak.c (KECCAK_CONTEXT_S): Add 'shake_in_extract_mode' and 'shake_in_read_mode' flags. (keccak_init): Initialize new context fields; set output length for SHAKE algorithms. (keccak_extract): Rename to ... (do_keccak_extract): this and add return value. (keccak_extract): New with 'shake_in_???_mode' checks & setup. (keccak_shake_read): New. (_gcry_sha3_hash_buffers): Adjust for 'spec->mdlen' not being zero for SHAKE algorithms, instead check 'suffix' for type. (_gcry_digest_spec_shake128): Set mdlen to 32 bytes; Set read function. (_gcry_digest_spec_shake256): Set mdlen to 64 bytes; Set read function. * cipher/md.c (md_extract): Pass return value from algo extract function. (_gcry_md_hash_buffers_extract): Adjust for 'spec->mdlen' not being zero for SHAKE algorithms. * src/cipher-proto.h (gcry_md_extract_t): Change return type from 'void' to 'gpg_err_code_t'. * tests/basic.c (check_one_md, check_one_md_multi): Adjust for 'gcry_md_get_algo_dlen()' not being zero for SHAKE algorithms. (check_digests): Add md_read interface test-vectors for SHAKE128 and SHAKE256.
- GnuPG-bug-id: T6539
- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>