Skip to content

Commit 3f1679b

Browse files
committed
Add OIDs for kmac128, kmac256 and blake2.
Reviewed-by: Richard Levitte <[email protected]> (Merged from openssl#9277)
1 parent e955edc commit 3f1679b

File tree

4 files changed

+50
-34
lines changed

4 files changed

+50
-34
lines changed

crypto/objects/obj_dat.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
/* Serialized OID's */
13-
static const unsigned char so[7775] = {
13+
static const unsigned char so[7813] = {
1414
0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 0] OBJ_rsadsi */
1515
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 6] OBJ_pkcs */
1616
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02, /* [ 13] OBJ_md2 */
@@ -1077,7 +1077,11 @@ static const unsigned char so[7775] = {
10771077
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x0C, /* [ 7745] OBJ_hmacWithSHA512_224 */
10781078
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x0D, /* [ 7753] OBJ_hmacWithSHA512_256 */
10791079
0x28,0xCC,0x45,0x03,0x04, /* [ 7761] OBJ_gmac */
1080-
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x75, /* [ 7766] OBJ_SM2_with_SM3 */
1080+
0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x13, /* [ 7766] OBJ_kmac128 */
1081+
0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x14, /* [ 7775] OBJ_kmac256 */
1082+
0x2B,0x06,0x01,0x04,0x01,0x8D,0x3A,0x0C,0x02,0x01, /* [ 7784] OBJ_blake2bmac */
1083+
0x2B,0x06,0x01,0x04,0x01,0x8D,0x3A,0x0C,0x02,0x02, /* [ 7794] OBJ_blake2smac */
1084+
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x83,0x75, /* [ 7804] OBJ_SM2_with_SM3 */
10811085
};
10821086

10831087
#define NUM_NID 1207
@@ -2278,15 +2282,15 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = {
22782282
{"hmacWithSHA512-224", "hmacWithSHA512-224", NID_hmacWithSHA512_224, 8, &so[7745]},
22792283
{"hmacWithSHA512-256", "hmacWithSHA512-256", NID_hmacWithSHA512_256, 8, &so[7753]},
22802284
{"GMAC", "gmac", NID_gmac, 5, &so[7761]},
2281-
{"KMAC128", "kmac128", NID_kmac128},
2282-
{"KMAC256", "kmac256", NID_kmac256},
2285+
{"KMAC128", "kmac128", NID_kmac128, 9, &so[7766]},
2286+
{"KMAC256", "kmac256", NID_kmac256, 9, &so[7775]},
22832287
{"AES-128-SIV", "aes-128-siv", NID_aes_128_siv},
22842288
{"AES-192-SIV", "aes-192-siv", NID_aes_192_siv},
22852289
{"AES-256-SIV", "aes-256-siv", NID_aes_256_siv},
2286-
{"BLAKE2BMAC", "blake2bmac", NID_blake2bmac},
2287-
{"BLAKE2SMAC", "blake2smac", NID_blake2smac},
2290+
{"BLAKE2BMAC", "blake2bmac", NID_blake2bmac, 10, &so[7784]},
2291+
{"BLAKE2SMAC", "blake2smac", NID_blake2smac, 10, &so[7794]},
22882292
{"SSHKDF", "sshkdf", NID_sshkdf},
2289-
{"SM2-SM3", "SM2-with-SM3", NID_SM2_with_SM3, 8, &so[7766]},
2293+
{"SM2-SM3", "SM2-with-SM3", NID_SM2_with_SM3, 8, &so[7804]},
22902294
{"SSKDF", "sskdf", NID_sskdf},
22912295
{"X963KDF", "x963kdf", NID_x963kdf},
22922296
};
@@ -4695,7 +4699,7 @@ static const unsigned int ln_objs[NUM_LN] = {
46954699
125, /* "zlib compression" */
46964700
};
46974701

4698-
#define NUM_OBJ 1073
4702+
#define NUM_OBJ 1077
46994703
static const unsigned int obj_objs[NUM_OBJ] = {
47004704
0, /* OBJ_undef 0 */
47014705
181, /* OBJ_iso 1 */
@@ -5547,6 +5551,8 @@ static const unsigned int obj_objs[NUM_OBJ] = {
55475551
1103, /* OBJ_hmac_sha3_256 2 16 840 1 101 3 4 2 14 */
55485552
1104, /* OBJ_hmac_sha3_384 2 16 840 1 101 3 4 2 15 */
55495553
1105, /* OBJ_hmac_sha3_512 2 16 840 1 101 3 4 2 16 */
5554+
1196, /* OBJ_kmac128 2 16 840 1 101 3 4 2 19 */
5555+
1197, /* OBJ_kmac256 2 16 840 1 101 3 4 2 20 */
55505556
802, /* OBJ_dsa_with_SHA224 2 16 840 1 101 3 4 3 1 */
55515557
803, /* OBJ_dsa_with_SHA256 2 16 840 1 101 3 4 3 2 */
55525558
1106, /* OBJ_dsa_with_SHA384 2 16 840 1 101 3 4 3 3 */
@@ -5664,6 +5670,8 @@ static const unsigned int obj_objs[NUM_OBJ] = {
56645670
138, /* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 4 */
56655671
648, /* OBJ_ms_smartcard_login 1 3 6 1 4 1 311 20 2 2 */
56665672
649, /* OBJ_ms_upn 1 3 6 1 4 1 311 20 2 3 */
5673+
1201, /* OBJ_blake2bmac 1 3 6 1 4 1 1722 12 2 1 */
5674+
1202, /* OBJ_blake2smac 1 3 6 1 4 1 1722 12 2 2 */
56675675
951, /* OBJ_ct_precert_scts 1 3 6 1 4 1 11129 2 4 2 */
56685676
952, /* OBJ_ct_precert_poison 1 3 6 1 4 1 11129 2 4 3 */
56695677
953, /* OBJ_ct_precert_signer 1 3 6 1 4 1 11129 2 4 4 */

crypto/objects/objects.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ iso 3 : identified-organization
1414
# GMAC OID
1515
iso 0 9797 3 4 : GMAC : gmac
1616

17-
# There are no OIDs for these yet...
18-
: KMAC128 : kmac128
19-
: KMAC256 : kmac256
20-
: BLAKE2BMAC : blake2bmac
21-
: BLAKE2SMAC : blake2smac
22-
2317
# HMAC OIDs
2418
identified-organization 6 1 5 5 8 1 1 : HMAC-MD5 : hmac-md5
2519
identified-organization 6 1 5 5 8 1 2 : HMAC-SHA1 : hmac-sha1
@@ -709,8 +703,10 @@ algorithm 29 : RSA-SHA1-2 : sha1WithRSA
709703
1 3 36 3 2 1 : RIPEMD160 : ripemd160
710704
1 3 36 3 3 1 2 : RSA-RIPEMD160 : ripemd160WithRSA
711705

712-
1 3 6 1 4 1 1722 12 2 1 16 : BLAKE2b512 : blake2b512
713-
1 3 6 1 4 1 1722 12 2 2 8 : BLAKE2s256 : blake2s256
706+
1 3 6 1 4 1 1722 12 2 1 : BLAKE2BMAC : blake2bmac
707+
1 3 6 1 4 1 1722 12 2 2 : BLAKE2SMAC : blake2smac
708+
blake2bmac 16 : BLAKE2b512 : blake2b512
709+
blake2smac 8 : BLAKE2s256 : blake2s256
714710

715711
!Cname sxnet
716712
1 3 101 1 4 1 : SXNetID : Strong Extranet ID
@@ -987,6 +983,10 @@ nist_hashalgs 16 : id-hmacWithSHA3-512 : hmac-sha3-512
987983
# how to handle them...
988984
# nist_hashalgs 17 : id-shake128-len : shake128-len
989985
# nist_hashalgs 18 : id-shake256-len : shake256-len
986+
nist_hashalgs 19 : KMAC128 : kmac128
987+
nist_hashalgs 20 : KMAC256 : kmac256
988+
# nist_hashalgs 21 : KMAC128-XOF : kmac128-xof
989+
# nist_hashalgs 22 : KMAC256-XOF : kmac256-xof
990990

991991
# OIDs for dsa-with-sha224 and dsa-with-sha256
992992
!Alias dsa_with_sha2 nistAlgorithms 3

fuzz/oids.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,4 +1064,8 @@ OBJ_id_tc26_gost_3410_2012_256_paramSetD="\x2A\x85\x03\x07\x01\x02\x01\x01\x04"
10641064
OBJ_hmacWithSHA512_224="\x2A\x86\x48\x86\xF7\x0D\x02\x0C"
10651065
OBJ_hmacWithSHA512_256="\x2A\x86\x48\x86\xF7\x0D\x02\x0D"
10661066
OBJ_gmac="\x28\xCC\x45\x03\x04"
1067+
OBJ_kmac128="\x60\x86\x48\x01\x65\x03\x04\x02\x13"
1068+
OBJ_kmac256="\x60\x86\x48\x01\x65\x03\x04\x02\x14"
1069+
OBJ_blake2bmac="\x2B\x06\x01\x04\x01\x8D\x3A\x0C\x02\x01"
1070+
OBJ_blake2smac="\x2B\x06\x01\x04\x01\x8D\x3A\x0C\x02\x02"
10671071
OBJ_SM2_with_SM3="\x2A\x81\x1C\xCF\x55\x01\x83\x75"

include/openssl/obj_mac.h

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,6 @@
4949
#define NID_gmac 1195
5050
#define OBJ_gmac OBJ_iso,0L,9797L,3L,4L
5151

52-
#define SN_kmac128 "KMAC128"
53-
#define LN_kmac128 "kmac128"
54-
#define NID_kmac128 1196
55-
56-
#define SN_kmac256 "KMAC256"
57-
#define LN_kmac256 "kmac256"
58-
#define NID_kmac256 1197
59-
60-
#define SN_blake2bmac "BLAKE2BMAC"
61-
#define LN_blake2bmac "blake2bmac"
62-
#define NID_blake2bmac 1201
63-
64-
#define SN_blake2smac "BLAKE2SMAC"
65-
#define LN_blake2smac "blake2smac"
66-
#define NID_blake2smac 1202
67-
6852
#define SN_hmac_md5 "HMAC-MD5"
6953
#define LN_hmac_md5 "hmac-md5"
7054
#define NID_hmac_md5 780
@@ -2139,15 +2123,25 @@
21392123
#define NID_ripemd160WithRSA 119
21402124
#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L
21412125

2126+
#define SN_blake2bmac "BLAKE2BMAC"
2127+
#define LN_blake2bmac "blake2bmac"
2128+
#define NID_blake2bmac 1201
2129+
#define OBJ_blake2bmac 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L
2130+
2131+
#define SN_blake2smac "BLAKE2SMAC"
2132+
#define LN_blake2smac "blake2smac"
2133+
#define NID_blake2smac 1202
2134+
#define OBJ_blake2smac 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L
2135+
21422136
#define SN_blake2b512 "BLAKE2b512"
21432137
#define LN_blake2b512 "blake2b512"
21442138
#define NID_blake2b512 1056
2145-
#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L
2139+
#define OBJ_blake2b512 OBJ_blake2bmac,16L
21462140

21472141
#define SN_blake2s256 "BLAKE2s256"
21482142
#define LN_blake2s256 "blake2s256"
21492143
#define NID_blake2s256 1057
2150-
#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L
2144+
#define OBJ_blake2s256 OBJ_blake2smac,8L
21512145

21522146
#define SN_sxnet "SXNetID"
21532147
#define LN_sxnet "Strong Extranet ID"
@@ -2997,6 +2991,16 @@
29972991
#define NID_hmac_sha3_512 1105
29982992
#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L
29992993

2994+
#define SN_kmac128 "KMAC128"
2995+
#define LN_kmac128 "kmac128"
2996+
#define NID_kmac128 1196
2997+
#define OBJ_kmac128 OBJ_nist_hashalgs,19L
2998+
2999+
#define SN_kmac256 "KMAC256"
3000+
#define LN_kmac256 "kmac256"
3001+
#define NID_kmac256 1197
3002+
#define OBJ_kmac256 OBJ_nist_hashalgs,20L
3003+
30003004
#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L
30013005

30023006
#define SN_dsa_with_SHA224 "dsa_with_SHA224"

0 commit comments

Comments
 (0)