[PATCH 3/3] Add MD2-HMAC calculation support

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Fri Dec 27 09:37:12 CET 2013


* 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 at gmail.com>
---
 cipher/mac-hmac.c | 8 ++++++++
 src/gcrypt.h.in   | 1 +
 2 files changed, 9 insertions(+)

diff --git a/cipher/mac-hmac.c b/cipher/mac-hmac.c
index 15c613d..930f2c5 100644
--- a/cipher/mac-hmac.c
+++ b/cipher/mac-hmac.c
@@ -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
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in
index 23195af..3479bd1 100644
--- a/src/gcrypt.h.in
+++ b/src/gcrypt.h.in
@@ -1320,6 +1320,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,
-- 
1.8.5.1




More information about the Gcrypt-devel mailing list