From de8f6a3e293a43f364cddefdf734b13486ec4cc9 Mon Sep 17 00:00:00 2001 From: Xu Yizhou Date: Tue, 1 Nov 2022 17:06:45 +0800 Subject: [PATCH] obj: Add SM4 XTS OID Add the following OID: SM4-XTS: 1.2.156.10197.1.104.10 Reviewed-by: Hugo Landau Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/19619) --- crypto/objects/obj_dat.h | 15 ++++++++++----- crypto/objects/obj_mac.num | 1 + crypto/objects/objects.txt | 1 + fuzz/oids.txt | 1 + include/openssl/obj_mac.h | 5 +++++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h index ca710b7ffe..3f90b7765f 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[8356] = { +static const unsigned char so[8364] = { 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 */ @@ -1152,9 +1152,10 @@ static const unsigned char so[8356] = { 0x60,0x86,0x48,0x01,0x86,0xF9,0x66, /* [ 8325] OBJ_oracle */ 0x60,0x86,0x48,0x01,0x86,0xF9,0x66,0xAD,0xCA,0x7B,0x01,0x01, /* [ 8332] OBJ_oracle_jdk_trustedkeyusage */ 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x10,0x01,0x32, /* [ 8344] OBJ_id_ct_signedTAL */ + 0x2A,0x81,0x1C,0xCF,0x55,0x01,0x68,0x0A, /* [ 8355] OBJ_sm4_xts */ }; -#define NUM_NID 1290 +#define NUM_NID 1291 static const ASN1_OBJECT nid_objs[NUM_NID] = { {"UNDEF", "undefined", NID_undef}, {"rsadsi", "RSA Data Security, Inc.", NID_rsadsi, 6, &so[0]}, @@ -2446,9 +2447,10 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = { {"brainpoolP512r1tls13", "brainpoolP512r1tls13", NID_brainpoolP512r1tls13}, {"brotli", "Brotli compression", NID_brotli}, {"zstd", "Zstandard compression", NID_zstd}, + {"SM4-XTS", "sm4-xts", NID_sm4_xts, 8, &so[8355]}, }; -#define NUM_SN 1281 +#define NUM_SN 1282 static const unsigned int sn_objs[NUM_SN] = { 364, /* "AD_DVCS" */ 419, /* "AES-128-CBC" */ @@ -2735,6 +2737,7 @@ static const unsigned int sn_objs[NUM_SN] = { 1133, /* "SM4-ECB" */ 1248, /* "SM4-GCM" */ 1135, /* "SM4-OFB" */ + 1290, /* "SM4-XTS" */ 188, /* "SMIME" */ 167, /* "SMIME-CAPS" */ 100, /* "SN" */ @@ -3733,7 +3736,7 @@ static const unsigned int sn_objs[NUM_SN] = { 1289, /* "zstd" */ }; -#define NUM_LN 1281 +#define NUM_LN 1282 static const unsigned int ln_objs[NUM_LN] = { 363, /* "AD Time Stamping" */ 405, /* "ANSI X9.62" */ @@ -4966,6 +4969,7 @@ static const unsigned int ln_objs[NUM_LN] = { 1133, /* "sm4-ecb" */ 1248, /* "sm4-gcm" */ 1135, /* "sm4-ofb" */ + 1290, /* "sm4-xts" */ 1203, /* "sshkdf" */ 1205, /* "sskdf" */ 16, /* "stateOrProvinceName" */ @@ -5018,7 +5022,7 @@ static const unsigned int ln_objs[NUM_LN] = { 125, /* "zlib compression" */ }; -#define NUM_OBJ 1147 +#define NUM_OBJ 1148 static const unsigned int obj_objs[NUM_OBJ] = { 0, /* OBJ_undef 0 */ 181, /* OBJ_iso 1 */ @@ -5514,6 +5518,7 @@ static const unsigned int obj_objs[NUM_OBJ] = { 1139, /* OBJ_sm4_ctr 1 2 156 10197 1 104 7 */ 1248, /* OBJ_sm4_gcm 1 2 156 10197 1 104 8 */ 1249, /* OBJ_sm4_ccm 1 2 156 10197 1 104 9 */ + 1290, /* OBJ_sm4_xts 1 2 156 10197 1 104 10 */ 1172, /* OBJ_sm2 1 2 156 10197 1 301 */ 1143, /* OBJ_sm3 1 2 156 10197 1 401 */ 1204, /* OBJ_SM2_with_SM3 1 2 156 10197 1 501 */ diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num index 6f9cea2b0e..f0fe5c64e5 100644 --- a/crypto/objects/obj_mac.num +++ b/crypto/objects/obj_mac.num @@ -1287,3 +1287,4 @@ brainpoolP384r1tls13 1286 brainpoolP512r1tls13 1287 brotli 1288 zstd 1289 +sm4_xts 1290 diff --git a/crypto/objects/objects.txt b/crypto/objects/objects.txt index d8aaac0570..ed4746f462 100644 --- a/crypto/objects/objects.txt +++ b/crypto/objects/objects.txt @@ -1611,6 +1611,7 @@ sm-scheme 104 6 : SM4-CFB8 : sm4-cfb8 sm-scheme 104 7 : SM4-CTR : sm4-ctr sm-scheme 104 8 : SM4-GCM : sm4-gcm sm-scheme 104 9 : SM4-CCM : sm4-ccm +sm-scheme 104 10 : SM4-XTS : sm4-xts # There is no OID that just denotes "HMAC" oddly enough... diff --git a/fuzz/oids.txt b/fuzz/oids.txt index 3eb51375a3..02a8177486 100644 --- a/fuzz/oids.txt +++ b/fuzz/oids.txt @@ -1148,3 +1148,4 @@ OBJ_hmacWithSM3="\x2A\x81\x1C\xCF\x55\x01\x83\x11\x03\x01" OBJ_oracle="\x60\x86\x48\x01\x86\xF9\x66" OBJ_oracle_jdk_trustedkeyusage="\x60\x86\x48\x01\x86\xF9\x66\xAD\xCA\x7B\x01\x01" OBJ_id_ct_signedTAL="\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x01\x32" +OBJ_sm4_xts="\x2A\x81\x1C\xCF\x55\x01\x68\x0A" diff --git a/include/openssl/obj_mac.h b/include/openssl/obj_mac.h index 2fcf6132f4..8e3ff0fd51 100644 --- a/include/openssl/obj_mac.h +++ b/include/openssl/obj_mac.h @@ -5094,6 +5094,11 @@ #define NID_sm4_ccm 1249 #define OBJ_sm4_ccm OBJ_sm_scheme,104L,9L +#define SN_sm4_xts "SM4-XTS" +#define LN_sm4_xts "sm4-xts" +#define NID_sm4_xts 1290 +#define OBJ_sm4_xts OBJ_sm_scheme,104L,10L + #define SN_hmac "HMAC" #define LN_hmac "hmac" #define NID_hmac 855