From 170115c0b1ff765eac3c652daeabe9260ad1d950 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin-Solenikov Date: Fri, 21 Oct 2016 03:57:17 +0300 Subject: Add declarations for GOST R 34.11 (-94 and -2012) digest algorithms Signed-off-by: Dmitry Eremin-Solenikov --- lib/algorithms/mac.c | 24 ++++++++++++++++++++++++ lib/includes/gnutls/gnutls.h.in | 14 +++++++++++++- lib/x509/x509_int.h | 5 +++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/lib/algorithms/mac.c b/lib/algorithms/mac.c index f6f9cb3ecf..8fc1da2254 100644 --- a/lib/algorithms/mac.c +++ b/lib/algorithms/mac.c @@ -31,6 +31,9 @@ #define MAC_OID_SHA256 "1.2.840.113549.2.9" #define MAC_OID_SHA384 "1.2.840.113549.2.10" #define MAC_OID_SHA512 "1.2.840.113549.2.11" +#define MAC_OID_GOST_R_3411_94 "1.2.643.2.2.10" +#define MAC_OID_STREEBOG_256 "1.2.643.7.1.1.4.1" +#define MAC_OID_STREEBOG_512 "1.2.643.7.1.1.4.2" static const mac_entry_st hash_algorithms[] = { {.name = "SHA1", @@ -128,6 +131,27 @@ static const mac_entry_st hash_algorithms[] = { .output_size = 20, .key_size = 20, .block_size = 64}, + {.name = "GOSTR341194", + .oid = HASH_OID_GOST_R_3411_94, + .mac_oid = MAC_OID_GOST_R_3411_94, + .id = GNUTLS_MAC_GOSTR_94, + .output_size = 32, + .key_size = 32, + .block_size = 32}, + {.name = "STREEBOG-256", + .oid = HASH_OID_STREEBOG_256, + .mac_oid = MAC_OID_STREEBOG_256, + .id = GNUTLS_MAC_STREEBOG_256, + .output_size = 32, + .key_size = 32, + .block_size = 64}, + {.name = "STREEBOG-512", + .oid = HASH_OID_STREEBOG_512, + .mac_oid = MAC_OID_STREEBOG_512, + .id = GNUTLS_MAC_STREEBOG_512, + .output_size = 64, + .key_size = 64, + .block_size = 64}, {.name = "MAC-NULL", .id = GNUTLS_MAC_NULL}, {0, 0, 0, 0, 0, 0, 0, 0, 0} diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index 41389a39af..11b8a65997 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -253,6 +253,9 @@ typedef enum { * @GNUTLS_MAC_SHA512: HMAC-SHA-512 algorithm. * @GNUTLS_MAC_SHA224: HMAC-SHA-224 algorithm. * @GNUTLS_MAC_MD5_SHA1: Combined MD5+SHA1 MAC placeholder. + * @GNUTLS_MAC_GOSTR_94: HMAC GOST R 34.10-94 algorithm. + * @GNUTLS_MAC_STREEBOG_256: HMAC GOST R 34.10-2001 (Streebog) algorithm, 256 bit. + * @GNUTLS_MAC_STREEBOG_512: HMAC GOST R 34.10-2001 (Streebog) algorithm, 512 bit. * @GNUTLS_MAC_AEAD: MAC implicit through AEAD cipher. * @GNUTLS_MAC_UMAC_96: The UMAC-96 MAC algorithm. * @GNUTLS_MAC_UMAC_128: The UMAC-128 MAC algorithm. @@ -276,6 +279,9 @@ typedef enum { GNUTLS_MAC_SHA3_384 = 12, /* reserved: no implementation */ GNUTLS_MAC_SHA3_512 = 13, /* reserved: no implementation */ GNUTLS_MAC_MD5_SHA1 = 14, /* reserved: no implementation */ + GNUTLS_MAC_GOSTR_94 = 15, + GNUTLS_MAC_STREEBOG_256 = 16, + GNUTLS_MAC_STREEBOG_512 = 17, /* If you add anything here, make sure you align with gnutls_digest_algorithm_t. */ GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */ @@ -300,6 +306,9 @@ typedef enum { * @GNUTLS_DIG_SHA3_384: SHA3-384 algorithm. * @GNUTLS_DIG_SHA3_512: SHA3-512 algorithm. * @GNUTLS_DIG_MD5_SHA1: Combined MD5+SHA1 algorithm. + * @GNUTLS_DIG_GOSTR_94: GOST R 34.10-94 algorithm. + * @GNUTLS_DIG_STREEBOG_256: GOST R 34.10-2001 (Streebog) algorithm, 256 bit. + * @GNUTLS_DIG_STREEBOG_512: GOST R 34.10-2001 (Streebog) algorithm, 512 bit. * * Enumeration of different digest (hash) algorithms. */ @@ -318,7 +327,10 @@ typedef enum { GNUTLS_DIG_SHA3_256 = GNUTLS_MAC_SHA3_256, GNUTLS_DIG_SHA3_384 = GNUTLS_MAC_SHA3_384, GNUTLS_DIG_SHA3_512 = GNUTLS_MAC_SHA3_512, - GNUTLS_DIG_MD5_SHA1 = GNUTLS_MAC_MD5_SHA1 + GNUTLS_DIG_MD5_SHA1 = GNUTLS_MAC_MD5_SHA1, + GNUTLS_DIG_GOSTR_94 = GNUTLS_MAC_GOSTR_94, + GNUTLS_DIG_STREEBOG_256 = GNUTLS_MAC_STREEBOG_256, + GNUTLS_DIG_STREEBOG_512 = GNUTLS_MAC_STREEBOG_512 /* If you add anything here, make sure you align with gnutls_mac_algorithm_t. */ } gnutls_digest_algorithm_t; diff --git a/lib/x509/x509_int.h b/lib/x509/x509_int.h index 3dd3985cf3..77f673f656 100644 --- a/lib/x509/x509_int.h +++ b/lib/x509/x509_int.h @@ -48,6 +48,11 @@ #define HASH_OID_SHA3_256 "2.16.840.1.101.3.4.2.8" #define HASH_OID_SHA3_384 "2.16.840.1.101.3.4.2.9" #define HASH_OID_SHA3_512 "2.16.840.1.101.3.4.2.10" +#define HASH_OID_GOST_R_3411_94 "1.2.643.2.2.9" +#define HASH_OID_STREEBOG_256 "1.2.643.7.1.1.2.2" +#define HASH_OID_STREEBOG_512 "1.2.643.7.1.1.2.3" + +#define HASH_OID_GOST_R_3411_94_CRYPTOPRO_PARAMS "1.2.643.2.2.30.1" #define OID_ATTR_PROV_SEED "1.3.6.1.4.1.2312.18.8.1" -- cgit v1.2.1