Add MD2-HMAC calculation support
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Fri, 27 Dec 2013 08:37:12 +0000 (12:37 +0400)
committerWerner Koch <wk@gnupg.org>
Mon, 13 Jan 2014 09:40:37 +0000 (10:40 +0100)
* src/gcrypt.h.in (GCRY_MAC_HMAC_MD2): New.
* cipher/mac-hmac.c: Support GCRY_MAC_HMAC_MD2.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
cipher/mac-hmac.c
src/gcrypt.h.in

index 5edd7e8..2c660e9 100644 (file)
@@ -35,6 +35,8 @@ map_mac_algo_to_md (int mac_algo)
     {
     default:
       return GCRY_MD_NONE;
+    case GCRY_MAC_HMAC_MD2:
+      return GCRY_MD_MD2;
     case GCRY_MAC_HMAC_MD4:
       return GCRY_MD_MD4;
     case GCRY_MAC_HMAC_MD5:
@@ -270,3 +272,9 @@ gcry_mac_spec_t _gcry_mac_type_spec_hmac_md4 = {
   &hmac_ops
 };
 #endif
+#if USE_MD2
+gcry_mac_spec_t _gcry_mac_type_spec_hmac_md2 = {
+  GCRY_MAC_HMAC_MD2, {0, 0}, "HMAC_MD2",
+  &hmac_ops
+};
+#endif
index 402e4fd..f8318c0 100644 (file)
@@ -1319,6 +1319,7 @@ enum gcry_mac_algos
     GCRY_MAC_HMAC_GOSTR3411_94  = 111,
     GCRY_MAC_HMAC_STRIBOG256    = 112,
     GCRY_MAC_HMAC_STRIBOG512    = 113,
+    GCRY_MAC_HMAC_MD2           = 114,
 
     GCRY_MAC_CMAC_AES           = 201,
     GCRY_MAC_CMAC_3DES          = 202,