gost28147: implement special MAC mode called imitovstavka (IMIT)
* src/gcrypt.h.in (GCRY_MAC_GOST28147_IMIT): New. * cipher/gost28147.c (gost_imit_open, gost_imit_close) (gost_imit_setkey, gost_imit_setiv, gost_imit_reset, _gost_imit_block) (gost_imit_block, gost_imit_write, gost_imit_finish, gost_imit_read) (gost_imit_verify, gost_imit_get_maclen, gost_imit_get_keylen) (gost_imit_set_extra_info): New functions implementing GOST 28147-89 MAC (imitovstavka, IMIT) mode. * cipher/gost28147.c (gost_imit_ops) (_gcry_mac_type_spec_gost28147_imit): declare GOST 28147-89 IMIT handler. * cipher/mac-internal.h (gcry_mac_handle): add fields to support GOST 28147-89 IMIT mode. * cipher/mac.c (mac_list): add _gcry_mac_type_spec_gost28147_imit. (spec_from_algo): handle GCRY_MAC_GOST28147_IMIT. * tests/basic.c (check_mac): add GOST28147-89 IMIT test vector.
GOST 28147-89 (see RFC 5830 Section 8) defines MAC construction using
the same base transformation. Implement support for it: required to read
some CMS files produced using GOST algorithms, see RFC 4490.
[jk: cipher/mac-internal.h: moved include of gost.h to include section]
- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>