summaryrefslogtreecommitdiffstats
path: root/crypto/objects
diff options
context:
space:
mode:
authorRonald Tse <ronald.tse@ribose.com>2017-10-31 15:19:14 +1000
committerPauli <paul.dale@oracle.com>2017-10-31 15:19:14 +1000
commitf19a5ff9ab85313f5b30cfc9fbed3a2eea60a59d (patch)
treee93336cc7c31d2a41e19b1c906135a6ec91cabfc /crypto/objects
parentffd23209933ea0ad5543f15ca6303d63d8dac826 (diff)
SM4: Add SM4 block cipher to EVP
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4552)
Diffstat (limited to 'crypto/objects')
-rw-r--r--crypto/objects/obj_dat.h60
-rw-r--r--crypto/objects/obj_mac.num10
-rw-r--r--crypto/objects/objects.txt21
3 files changed, 84 insertions, 7 deletions
diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h
index 471202f0b6..866fa34cc1 100644
--- a/crypto/objects/obj_dat.h
+++ b/crypto/objects/obj_dat.h
@@ -10,7 +10,7 @@
*/
/* Serialized OID's */
-static const unsigned char so[7238] = {
+static const unsigned char so[7308] = {
0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 0] OBJ_rsadsi */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 6] OBJ_pkcs */
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02, /* [ 13] OBJ_md2 */
@@ -1018,9 +1018,19 @@ static const unsigned char so[7238] = {
0x2A,0x83,0x1A,0x8C,0x9A,0x6E,0x01,0x01,0x24, /* [ 7212] OBJ_aria_256_gcm */
0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1B, /* [ 7221] OBJ_cmcCA */
0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x1C, /* [ 7229] OBJ_cmcRA */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x01, /* [ 7237] OBJ_sm4_ecb */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x02, /* [ 7245] OBJ_sm4_cbc */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x03, /* [ 7253] OBJ_sm4_ofb128 */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x05, /* [ 7261] OBJ_sm4_cfb1 */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x04, /* [ 7269] OBJ_sm4_cfb128 */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x06, /* [ 7277] OBJ_sm4_cfb8 */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x07, /* [ 7285] OBJ_sm4_ctr */
+ 0x2A,0x81,0x1C, /* [ 7293] OBJ_ISO_CN */
+ 0x2A,0x81,0x1C,0xCF,0x55, /* [ 7296] OBJ_oscca */
+ 0x2A,0x81,0x1C,0xCF,0x55,0x01, /* [ 7301] OBJ_sm_scheme */
};
-#define NUM_NID 1133
+#define NUM_NID 1143
static const ASN1_OBJECT nid_objs[NUM_NID] = {
{"UNDEF", "undefined", NID_undef},
{"rsadsi", "RSA Data Security, Inc.", NID_rsadsi, 6, &so[0]},
@@ -2155,9 +2165,19 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = {
{"ffdhe8192", "ffdhe8192", NID_ffdhe8192},
{"cmcCA", "CMC Certificate Authority", NID_cmcCA, 8, &so[7221]},
{"cmcRA", "CMC Registration Authority", NID_cmcRA, 8, &so[7229]},
+ {"SM4-ECB", "sm4-ecb", NID_sm4_ecb, 8, &so[7237]},
+ {"SM4-CBC", "sm4-cbc", NID_sm4_cbc, 8, &so[7245]},
+ {"SM4-OFB", "sm4-ofb", NID_sm4_ofb128, 8, &so[7253]},
+ {"SM4-CFB1", "sm4-cfb1", NID_sm4_cfb1, 8, &so[7261]},
+ {"SM4-CFB", "sm4-cfb", NID_sm4_cfb128, 8, &so[7269]},
+ {"SM4-CFB8", "sm4-cfb8", NID_sm4_cfb8, 8, &so[7277]},
+ {"SM4-CTR", "sm4-ctr", NID_sm4_ctr, 8, &so[7285]},
+ {"ISO-CN", "ISO CN Member Body", NID_ISO_CN, 3, &so[7293]},
+ {"oscca", "oscca", NID_oscca, 5, &so[7296]},
+ {"sm-scheme", "sm-scheme", NID_sm_scheme, 6, &so[7301]},
};
-#define NUM_SN 1124
+#define NUM_SN 1134
static const unsigned int sn_objs[NUM_SN] = {
364, /* "AD_DVCS" */
419, /* "AES-128-CBC" */
@@ -2316,6 +2336,7 @@ static const unsigned int sn_objs[NUM_SN] = {
46, /* "IDEA-OFB" */
1004, /* "INN" */
181, /* "ISO" */
+ 1140, /* "ISO-CN" */
183, /* "ISO-US" */
645, /* "ITU-T" */
646, /* "JOINT-ISO-ITU-T" */
@@ -2417,6 +2438,13 @@ static const unsigned int sn_objs[NUM_SN] = {
1095, /* "SHA512-256" */
1100, /* "SHAKE128" */
1101, /* "SHAKE256" */
+ 1134, /* "SM4-CBC" */
+ 1137, /* "SM4-CFB" */
+ 1136, /* "SM4-CFB1" */
+ 1138, /* "SM4-CFB8" */
+ 1139, /* "SM4-CTR" */
+ 1133, /* "SM4-ECB" */
+ 1135, /* "SM4-OFB" */
188, /* "SMIME" */
167, /* "SMIME-CAPS" */
100, /* "SN" */
@@ -2979,6 +3007,7 @@ static const unsigned int sn_objs[NUM_SN] = {
681, /* "onBasis" */
1089, /* "organizationIdentifier" */
491, /* "organizationalStatus" */
+ 1141, /* "oscca" */
475, /* "otherMailbox" */
876, /* "owner" */
489, /* "pagerTelephoneNumber" */
@@ -3233,6 +3262,7 @@ static const unsigned int sn_objs[NUM_SN] = {
52, /* "signingTime" */
454, /* "simpleSecurityObject" */
496, /* "singleLevelQuality" */
+ 1142, /* "sm-scheme" */
387, /* "snmpv2" */
660, /* "street" */
85, /* "subjectAltName" */
@@ -3285,7 +3315,7 @@ static const unsigned int sn_objs[NUM_SN] = {
1093, /* "x509ExtAdmission" */
};
-#define NUM_LN 1124
+#define NUM_LN 1134
static const unsigned int ln_objs[NUM_LN] = {
363, /* "AD Time Stamping" */
405, /* "ANSI X9.62" */
@@ -3354,6 +3384,7 @@ static const unsigned int ln_objs[NUM_LN] = {
294, /* "IPSec End System" */
295, /* "IPSec Tunnel" */
296, /* "IPSec User" */
+ 1140, /* "ISO CN Member Body" */
182, /* "ISO Member Body" */
183, /* "ISO US Member Body" */
667, /* "Independent" */
@@ -4082,6 +4113,7 @@ static const unsigned int ln_objs[NUM_LN] = {
17, /* "organizationName" */
491, /* "organizationalStatus" */
18, /* "organizationalUnitName" */
+ 1141, /* "oscca" */
475, /* "otherMailbox" */
876, /* "owner" */
935, /* "pSpecified" */
@@ -4366,6 +4398,14 @@ static const unsigned int ln_objs[NUM_LN] = {
454, /* "simpleSecurityObject" */
496, /* "singleLevelQuality" */
1062, /* "siphash" */
+ 1142, /* "sm-scheme" */
+ 1134, /* "sm4-cbc" */
+ 1137, /* "sm4-cfb" */
+ 1136, /* "sm4-cfb1" */
+ 1138, /* "sm4-cfb8" */
+ 1139, /* "sm4-ctr" */
+ 1133, /* "sm4-ecb" */
+ 1135, /* "sm4-ofb" */
16, /* "stateOrProvinceName" */
660, /* "streetAddress" */
498, /* "subtreeMaximumQuality" */
@@ -4413,7 +4453,7 @@ static const unsigned int ln_objs[NUM_LN] = {
125, /* "zlib compression" */
};
-#define NUM_OBJ 1013
+#define NUM_OBJ 1023
static const unsigned int obj_objs[NUM_OBJ] = {
0, /* OBJ_undef 0 */
181, /* OBJ_iso 1 */
@@ -4434,6 +4474,7 @@ static const unsigned int obj_objs[NUM_OBJ] = {
512, /* OBJ_id_set 2 23 42 */
678, /* OBJ_wap 2 23 43 */
435, /* OBJ_pss 0 9 2342 */
+ 1140, /* OBJ_ISO_CN 1 2 156 */
183, /* OBJ_ISO_US 1 2 840 */
381, /* OBJ_iana 1 3 6 1 */
1034, /* OBJ_X25519 1 3 101 110 */
@@ -4657,6 +4698,7 @@ static const unsigned int obj_objs[NUM_OBJ] = {
637, /* OBJ_set_brand_Diners 2 23 42 8 30 */
638, /* OBJ_set_brand_AmericanExpress 2 23 42 8 34 */
639, /* OBJ_set_brand_JCB 2 23 42 8 35 */
+ 1141, /* OBJ_oscca 1 2 156 10197 */
805, /* OBJ_cryptopro 1 2 643 2 2 */
806, /* OBJ_cryptocom 1 2 643 2 9 */
974, /* OBJ_id_tc26 1 2 643 7 1 */
@@ -4736,6 +4778,7 @@ static const unsigned int obj_objs[NUM_OBJ] = {
744, /* OBJ_wap_wsg_idm_ecid_wtls11 2 23 43 1 4 11 */
745, /* OBJ_wap_wsg_idm_ecid_wtls12 2 23 43 1 4 12 */
804, /* OBJ_whirlpool 1 0 10118 3 0 55 */
+ 1142, /* OBJ_sm_scheme 1 2 156 10197 1 */
773, /* OBJ_kisa 1 2 410 200004 */
807, /* OBJ_id_GostR3411_94_with_GostR3410_2001 1 2 643 2 2 3 */
808, /* OBJ_id_GostR3411_94_with_GostR3410_94 1 2 643 2 2 4 */
@@ -4865,6 +4908,13 @@ static const unsigned int obj_objs[NUM_OBJ] = {
971, /* OBJ_camellia_256_ctr 0 3 4401 5 3 1 9 49 */
972, /* OBJ_camellia_256_cmac 0 3 4401 5 3 1 9 50 */
437, /* OBJ_pilot 0 9 2342 19200300 100 */
+ 1133, /* OBJ_sm4_ecb 1 2 156 10197 1 104 1 */
+ 1134, /* OBJ_sm4_cbc 1 2 156 10197 1 104 2 */
+ 1135, /* OBJ_sm4_ofb128 1 2 156 10197 1 104 3 */
+ 1137, /* OBJ_sm4_cfb128 1 2 156 10197 1 104 4 */
+ 1136, /* OBJ_sm4_cfb1 1 2 156 10197 1 104 5 */
+ 1138, /* OBJ_sm4_cfb8 1 2 156 10197 1 104 6 */
+ 1139, /* OBJ_sm4_ctr 1 2 156 10197 1 104 7 */
776, /* OBJ_seed_ecb 1 2 410 200004 1 3 */
777, /* OBJ_seed_cbc 1 2 410 200004 1 4 */
779, /* OBJ_seed_cfb128 1 2 410 200004 1 5 */
diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num
index 26495f2a05..4e5f702c29 100644
--- a/crypto/objects/obj_mac.num
+++ b/crypto/objects/obj_mac.num
@@ -1130,3 +1130,13 @@ ffdhe6144 1129
ffdhe8192 1130
cmcCA 1131
cmcRA 1132
+sm4_ecb 1133
+sm4_cbc 1134
+sm4_ofb128 1135
+sm4_cfb1 1136
+sm4_cfb128 1137
+sm4_cfb8 1138
+sm4_ctr 1139
+ISO_CN 1140
+oscca 1141
+sm_scheme 1142
diff --git a/crypto/objects/objects.txt b/crypto/objects/objects.txt
index 9aecacf625..22e69b8f1c 100644
--- a/crypto/objects/objects.txt
+++ b/crypto/objects/objects.txt
@@ -1368,7 +1368,7 @@ member-body 643 100 112 : issuerSignTool : Signing Tool of Issuer
# Definitions for Camellia cipher - ECB, CFB, OFB MODE
!Alias ntt-ds 0 3 4401 5
-!Alias camellia ntt-ds 3 1 9
+!Alias camellia ntt-ds 3 1 9
camellia 1 : CAMELLIA-128-ECB : camellia-128-ecb
!Cname camellia-128-ofb128
@@ -1461,6 +1461,23 @@ kisa 1 5 : SEED-CFB : seed-cfb
!Cname seed-ofb128
kisa 1 6 : SEED-OFB : seed-ofb
+
+# Definitions for SM4 cipher
+
+member-body 156 : ISO-CN : ISO CN Member Body
+ISO-CN 10197 : oscca
+oscca 1 : sm-scheme
+
+sm-scheme 104 1 : SM4-ECB : sm4-ecb
+sm-scheme 104 2 : SM4-CBC : sm4-cbc
+!Cname sm4-ofb128
+sm-scheme 104 3 : SM4-OFB : sm4-ofb
+!Cname sm4-cfb128
+sm-scheme 104 4 : SM4-CFB : sm4-cfb
+sm-scheme 104 5 : SM4-CFB1 : sm4-cfb1
+sm-scheme 104 6 : SM4-CFB8 : sm4-cfb8
+sm-scheme 104 7 : SM4-CTR : sm4-ctr
+
# There is no OID that just denotes "HMAC" oddly enough...
: HMAC : hmac
@@ -1498,7 +1515,7 @@ ISO-US 10046 2 1 : dhpublicnumber : X9.42 DH
1 3 36 3 3 2 8 1 1 11 : brainpoolP384r1
1 3 36 3 3 2 8 1 1 12 : brainpoolP384t1
1 3 36 3 3 2 8 1 1 13 : brainpoolP512r1
-1 3 36 3 3 2 8 1 1 14 : brainpoolP512t1
+1 3 36 3 3 2 8 1 1 14 : brainpoolP512t1
# ECDH schemes from RFC5753
!Alias x9-63-scheme 1 3 133 16 840 63 0