]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
der: _ossl prefix der_oid_ and der_aid_ functions
authorPauli <paul.dale@oracle.com>
Wed, 30 Sep 2020 03:59:20 +0000 (13:59 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 1 Oct 2020 01:25:12 +0000 (11:25 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13038)

providers/common/der/der_dsa_key.c
providers/common/der/der_dsa_sig.c
providers/common/der/der_ec_key.c
providers/common/der/der_ec_sig.c
providers/common/der/der_ecx_key.c
providers/common/der/der_rsa_key.c
providers/common/der/der_rsa_sig.c
providers/common/der/der_sm2_key.c
providers/common/der/der_sm2_sig.c
providers/common/der/oids_to_c.pm
providers/implementations/kdfs/x942kdf.c

index b0a6db105401c803458077b93b0050c64c009578..1a369faa81d38d60f62ea2bd9bbbc574878c97bd 100644 (file)
@@ -15,7 +15,7 @@ int ossl_DER_w_algorithmIdentifier_DSA(WPACKET *pkt, int tag, DSA *dsa)
 {
     return ossl_DER_w_begin_sequence(pkt, tag)
         /* No parameters (yet?) */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_dsa,
-                                  sizeof(der_oid_id_dsa))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_dsa,
+                                  sizeof(ossl_der_oid_id_dsa))
         && ossl_DER_w_end_sequence(pkt, tag);
 }
index ad747340ad764866370a3ee99af3d3783f56012f..37ee5f459d177d4ae04d827672531e95ccc11b61 100644 (file)
@@ -13,8 +13,8 @@
 
 #define MD_CASE(name)                                                   \
     case NID_##name:                                                    \
-        precompiled = der_oid_id_dsa_with_##name;                \
-        precompiled_sz = sizeof(der_oid_id_dsa_with_##name);     \
+        precompiled = ossl_der_oid_id_dsa_with_##name;                  \
+        precompiled_sz = sizeof(ossl_der_oid_id_dsa_with_##name);       \
         break;
 
 int ossl_DER_w_algorithmIdentifier_DSA_with_MD(WPACKET *pkt, int tag,
index 4c0b9a2dd5647741f42a1c264ee06f7093f668d8..ae0775af5340aafce0945eb19fdf638861199f53 100644 (file)
@@ -15,7 +15,7 @@ int ossl_DER_w_algorithmIdentifier_EC(WPACKET *pkt, int cont, EC_KEY *ec)
 {
     return ossl_DER_w_begin_sequence(pkt, cont)
         /* No parameters (yet?) */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_ecPublicKey,
-                                  sizeof(der_oid_id_ecPublicKey))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_ecPublicKey,
+                                  sizeof(ossl_der_oid_id_ecPublicKey))
         && ossl_DER_w_end_sequence(pkt, cont);
 }
index 095e22507737980f58bfdabb4a7d8e903f3b36f6..25b672dab2f19769d87c0ebe184b065ed64c7408 100644 (file)
 #include "prov/der_ec.h"
 
 /* Aliases so we can have a uniform MD_CASE */
-#define der_oid_id_ecdsa_with_sha1   der_oid_ecdsa_with_SHA1
-#define der_oid_id_ecdsa_with_sha224 der_oid_ecdsa_with_SHA224
-#define der_oid_id_ecdsa_with_sha256 der_oid_ecdsa_with_SHA256
-#define der_oid_id_ecdsa_with_sha384 der_oid_ecdsa_with_SHA384
-#define der_oid_id_ecdsa_with_sha512 der_oid_ecdsa_with_SHA512
+#define ossl_der_oid_id_ecdsa_with_sha1   ossl_der_oid_ecdsa_with_SHA1
+#define ossl_der_oid_id_ecdsa_with_sha224 ossl_der_oid_ecdsa_with_SHA224
+#define ossl_der_oid_id_ecdsa_with_sha256 ossl_der_oid_ecdsa_with_SHA256
+#define ossl_der_oid_id_ecdsa_with_sha384 ossl_der_oid_ecdsa_with_SHA384
+#define ossl_der_oid_id_ecdsa_with_sha512 ossl_der_oid_ecdsa_with_SHA512
 
 #define MD_CASE(name)                                                   \
     case NID_##name:                                                    \
-        precompiled = der_oid_id_ecdsa_with_##name;                     \
-        precompiled_sz = sizeof(der_oid_id_ecdsa_with_##name);          \
+        precompiled = ossl_der_oid_id_ecdsa_with_##name;                \
+        precompiled_sz = sizeof(ossl_der_oid_id_ecdsa_with_##name);     \
         break;
 
 int ossl_DER_w_algorithmIdentifier_ECDSA_with_MD(WPACKET *pkt, int cont,
index d445836866a6e977dca05398ea28440d0540e83a..c00a11cac8eec7b336fc71c293a93bcbe5187567 100644 (file)
@@ -15,8 +15,8 @@ int ossl_DER_w_algorithmIdentifier_X25519(WPACKET *pkt, int cont, ECX_KEY *ec)
 {
     return ossl_DER_w_begin_sequence(pkt, cont)
         /* No parameters (yet?) */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_X25519,
-                                  sizeof(der_oid_id_X25519))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_X25519,
+                                  sizeof(ossl_der_oid_id_X25519))
         && ossl_DER_w_end_sequence(pkt, cont);
 }
 
@@ -24,8 +24,8 @@ int ossl_DER_w_algorithmIdentifier_X448(WPACKET *pkt, int cont, ECX_KEY *ec)
 {
     return ossl_DER_w_begin_sequence(pkt, cont)
         /* No parameters (yet?) */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_X448,
-                                  sizeof(der_oid_id_X448))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_X448,
+                                  sizeof(ossl_der_oid_id_X448))
         && ossl_DER_w_end_sequence(pkt, cont);
 }
 
@@ -33,8 +33,8 @@ int ossl_DER_w_algorithmIdentifier_ED25519(WPACKET *pkt, int cont, ECX_KEY *ec)
 {
     return ossl_DER_w_begin_sequence(pkt, cont)
         /* No parameters (yet?) */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_Ed25519,
-                                  sizeof(der_oid_id_Ed25519))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_Ed25519,
+                                  sizeof(ossl_der_oid_id_Ed25519))
         && ossl_DER_w_end_sequence(pkt, cont);
 }
 
@@ -42,7 +42,7 @@ int ossl_DER_w_algorithmIdentifier_ED448(WPACKET *pkt, int cont, ECX_KEY *ec)
 {
     return ossl_DER_w_begin_sequence(pkt, cont)
         /* No parameters (yet?) */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_Ed448,
-                                  sizeof(der_oid_id_Ed448))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_Ed448,
+                                  sizeof(ossl_der_oid_id_Ed448))
         && ossl_DER_w_end_sequence(pkt, cont);
 }
index 5340b6756b48a4b0144ce05b9364fc783438f2fa..6e8a37699dc24052278400782454d93e8683b4ac 100644 (file)
@@ -64,66 +64,66 @@ const unsigned char der_aid_sha1Identifier[] = {
         DER_OID_SZ_id_sha224 + DER_SZ_NULL,                             \
         DER_OID_V_id_sha224,                                            \
         DER_V_NULL
-extern const unsigned char der_aid_sha224Identifier[];
-const unsigned char der_aid_sha224Identifier[] = {
+extern const unsigned char ossl_der_aid_sha224Identifier[];
+const unsigned char ossl_der_aid_sha224Identifier[] = {
     DER_AID_V_sha224Identifier
 };
-#define DER_AID_SZ_sha224Identifier sizeof(der_aid_sha224Identifier)
+#define DER_AID_SZ_sha224Identifier sizeof(ossl_der_aid_sha224Identifier)
 
 #define DER_AID_V_sha256Identifier                                      \
     DER_P_SEQUENCE|DER_F_CONSTRUCTED,                                   \
         DER_OID_SZ_id_sha256 + DER_SZ_NULL,                             \
         DER_OID_V_id_sha256,                                            \
         DER_V_NULL
-extern const unsigned char der_aid_sha256Identifier[];
-const unsigned char der_aid_sha256Identifier[] = {
+extern const unsigned char ossl_der_aid_sha256Identifier[];
+const unsigned char ossl_der_aid_sha256Identifier[] = {
     DER_AID_V_sha256Identifier
 };
-#define DER_AID_SZ_sha256Identifier sizeof(der_aid_sha256Identifier)
+#define DER_AID_SZ_sha256Identifier sizeof(ossl_der_aid_sha256Identifier)
 
 #define DER_AID_V_sha384Identifier                                      \
     DER_P_SEQUENCE|DER_F_CONSTRUCTED,                                   \
         DER_OID_SZ_id_sha384 + DER_SZ_NULL,                             \
         DER_OID_V_id_sha384,                                            \
         DER_V_NULL
-extern const unsigned char der_aid_sha384Identifier[];
-const unsigned char der_aid_sha384Identifier[] = {
+extern const unsigned char ossl_der_aid_sha384Identifier[];
+const unsigned char ossl_der_aid_sha384Identifier[] = {
     DER_AID_V_sha384Identifier
 };
-#define DER_AID_SZ_sha384Identifier sizeof(der_aid_sha384Identifier)
+#define DER_AID_SZ_sha384Identifier sizeof(ossl_der_aid_sha384Identifier)
 
 #define DER_AID_V_sha512Identifier                                      \
     DER_P_SEQUENCE|DER_F_CONSTRUCTED,                                   \
         DER_OID_SZ_id_sha512 + DER_SZ_NULL,                             \
         DER_OID_V_id_sha512,                                            \
         DER_V_NULL
-extern const unsigned char der_aid_sha512Identifier[];
-const unsigned char der_aid_sha512Identifier[] = {
+extern const unsigned char ossl_der_aid_sha512Identifier[];
+const unsigned char ossl_der_aid_sha512Identifier[] = {
     DER_AID_V_sha512Identifier
 };
-#define DER_AID_SZ_sha512Identifier sizeof(der_aid_sha512Identifier)
+#define DER_AID_SZ_sha512Identifier sizeof(ossl_der_aid_sha512Identifier)
 
 #define DER_AID_V_sha512_224Identifier                                  \
     DER_P_SEQUENCE|DER_F_CONSTRUCTED,                                   \
         DER_OID_SZ_id_sha512_224 + DER_SZ_NULL,                         \
         DER_OID_V_id_sha512_224,                                        \
         DER_V_NULL
-extern const unsigned char der_aid_sha512_224Identifier[];
-const unsigned char der_aid_sha512_224Identifier[] = {
+extern const unsigned char ossl_der_aid_sha512_224Identifier[];
+const unsigned char ossl_der_aid_sha512_224Identifier[] = {
     DER_AID_V_sha512_224Identifier
 };
-#define DER_AID_SZ_sha512_224Identifier sizeof(der_aid_sha512_224Identifier)
+#define DER_AID_SZ_sha512_224Identifier sizeof(ossl_der_aid_sha512_224Identifier)
 
 #define DER_AID_V_sha512_256Identifier                                  \
     DER_P_SEQUENCE|DER_F_CONSTRUCTED,                                   \
         DER_OID_SZ_id_sha512_256 + DER_SZ_NULL,                         \
         DER_OID_V_id_sha512_256,                                        \
         DER_V_NULL
-extern const unsigned char der_aid_sha512_256Identifier[];
-const unsigned char der_aid_sha512_256Identifier[] = {
+extern const unsigned char ossl_der_aid_sha512_256Identifier[];
+const unsigned char ossl_der_aid_sha512_256Identifier[] = {
     DER_AID_V_sha512_256Identifier
 };
-#define DER_AID_SZ_sha512_256Identifier sizeof(der_aid_sha512_256Identifier)
+#define DER_AID_SZ_sha512_256Identifier sizeof(ossl_der_aid_sha512_256Identifier)
 
 /*-
  * From https://tools.ietf.org/html/rfc8017#appendix-A.2.1
@@ -271,8 +271,8 @@ static int DER_w_MaskGenAlgorithm(WPACKET *pkt, int tag,
 
 #define OAEP_PSS_MD_CASE(name, var)                                     \
     case NID_##name:                                                    \
-        var = der_oid_id_##name;                                        \
-        var##_sz = sizeof(der_oid_id_##name);                           \
+        var = ossl_der_oid_id_##name;                                   \
+        var##_sz = sizeof(ossl_der_oid_id_##name);                      \
         break;
 
 int ossl_DER_w_RSASSA_PSS_params(WPACKET *pkt, int tag,
@@ -341,12 +341,12 @@ int ossl_DER_w_RSASSA_PSS_params(WPACKET *pkt, int tag,
 }
 
 /* Aliases so we can have a uniform RSA_CASE */
-#define der_oid_rsassaPss der_oid_id_RSASSA_PSS
+#define ossl_der_oid_rsassaPss ossl_der_oid_id_RSASSA_PSS
 
 #define RSA_CASE(name, var)                                             \
     var##_nid = NID_##name;                                             \
-    var##_oid = der_oid_##name;                                         \
-    var##_oid_sz = sizeof(der_oid_##name);                              \
+    var##_oid = ossl_der_oid_##name;                                    \
+    var##_oid_sz = sizeof(ossl_der_oid_##name);                         \
     break;
 
 int ossl_DER_w_algorithmIdentifier_RSA(WPACKET *pkt, int tag, RSA *rsa)
index 5bdfa66255a8daaa6a4d05523aff332d6088b4f1..1ff9bf789bdf2a99aa4f84cb2be952752efe7406 100644 (file)
 #include "prov/der_digests.h"
 
 /* Aliases so we can have a uniform MD_with_RSA_CASE */
-#define der_oid_sha3_224WithRSAEncryption \
-    der_oid_id_rsassa_pkcs1_v1_5_with_sha3_224
-#define der_oid_sha3_256WithRSAEncryption \
-    der_oid_id_rsassa_pkcs1_v1_5_with_sha3_256
-#define der_oid_sha3_384WithRSAEncryption \
-    der_oid_id_rsassa_pkcs1_v1_5_with_sha3_384
-#define der_oid_sha3_512WithRSAEncryption \
-    der_oid_id_rsassa_pkcs1_v1_5_with_sha3_512
+#define ossl_der_oid_sha3_224WithRSAEncryption \
+    ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_224
+#define ossl_der_oid_sha3_256WithRSAEncryption \
+    ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_256
+#define ossl_der_oid_sha3_384WithRSAEncryption \
+    ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_384
+#define ossl_der_oid_sha3_512WithRSAEncryption \
+    ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_512
 
 #define MD_with_RSA_CASE(name, var)                                     \
     case NID_##name:                                                    \
-        var = der_oid_##name##WithRSAEncryption;                        \
-        var##_sz = sizeof(der_oid_##name##WithRSAEncryption);           \
+        var = ossl_der_oid_##name##WithRSAEncryption;                   \
+        var##_sz = sizeof(ossl_der_oid_##name##WithRSAEncryption);      \
         break;
 
 int ossl_DER_w_algorithmIdentifier_MDWithRSAEncryption(WPACKET *pkt, int tag,
index 6a458514b5133eb1dddf53b4a9728d89fe0f3182..a766bb4f3dd7e2cc3c855e6ae7d4dc9e9ba6bfaa 100644 (file)
@@ -17,7 +17,7 @@ int DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec)
     return ossl_DER_w_begin_sequence(pkt, cont)
         /* No parameters (yet?) */
         /* It seems SM2 identifier is the same as id_ecPublidKey */
-        && ossl_DER_w_precompiled(pkt, -1, der_oid_id_ecPublicKey,
-                                  sizeof(der_oid_id_ecPublicKey))
+        && ossl_DER_w_precompiled(pkt, -1, ossl_der_oid_id_ecPublicKey,
+                                  sizeof(ossl_der_oid_id_ecPublicKey))
         && ossl_DER_w_end_sequence(pkt, cont);
 }
index 8c37c4d84d0ad1f29b436f33f15989d4527a1e65..7b710cfa53fb76042a98c3e078ed432a1ea9a4d0 100644 (file)
 #include "prov/der_sm2.h"
 
 /* Aliases so we can have a uniform MD_CASE */
-#define der_oid_id_sm2_with_sm3   der_oid_sm2_with_SM3
+#define ossl_der_oid_id_sm2_with_sm3   ossl_der_oid_sm2_with_SM3
 
 #define MD_CASE(name)                                                   \
     case NID_##name:                                                    \
-        precompiled = der_oid_id_sm2_with_##name;                     \
-        precompiled_sz = sizeof(der_oid_id_sm2_with_##name);          \
+        precompiled = ossl_der_oid_id_sm2_with_##name;                  \
+        precompiled_sz = sizeof(ossl_der_oid_id_sm2_with_##name);       \
         break;
 
 int DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont,
index dee326316b1aea70effaf0d7e501a6f3f77ee143..aa5b80cc1288c0a3ff6f1c1b1e324e4d8581ae8c 100644 (file)
@@ -40,7 +40,7 @@ sub filter_to_H {
 $C_comment
 #define DER_OID_V_${C_name} DER_P_OBJECT, $oid_size, ${C_bytes}
 #define DER_OID_SZ_${C_name} ${C_bytes_size}
-extern const unsigned char der_oid_${C_name}[DER_OID_SZ_${C_name}];
+extern const unsigned char ossl_der_oid_${C_name}[DER_OID_SZ_${C_name}];
 _____
 }
 
@@ -58,7 +58,7 @@ sub filter_to_C {
 
     return <<"_____";
 $C_comment
-const unsigned char der_oid_${C_name}[DER_OID_SZ_${C_name}] = {
+const unsigned char ossl_der_oid_${C_name}[DER_OID_SZ_${C_name}] = {
     DER_OID_V_${C_name}
 };
 _____
index 20aa2c42cd6123b75e47a7a01593f2d3ea1508f1..3377350bf34a1835a856fe4be1b7ca7e164161ea 100644 (file)
@@ -58,12 +58,15 @@ static const struct {
     size_t oid_len;
     size_t keklen; /* size in bytes */
 } kek_algs[] = {
-    { "AES-128-WRAP", der_oid_id_aes128_wrap, DER_OID_SZ_id_aes128_wrap, 16 },
-    { "AES-192-WRAP", der_oid_id_aes192_wrap, DER_OID_SZ_id_aes192_wrap, 24 },
-    { "AES-256-WRAP", der_oid_id_aes256_wrap, DER_OID_SZ_id_aes256_wrap, 32 },
-#ifndef FIPS_MODULE
-    { "DES3-WRAP", der_oid_id_alg_CMS3DESwrap, DER_OID_SZ_id_alg_CMS3DESwrap,
+    { "AES-128-WRAP", ossl_der_oid_id_aes128_wrap, DER_OID_SZ_id_aes128_wrap,
+      16 },
+    { "AES-192-WRAP", ossl_der_oid_id_aes192_wrap, DER_OID_SZ_id_aes192_wrap,
       24 },
+    { "AES-256-WRAP", ossl_der_oid_id_aes256_wrap, DER_OID_SZ_id_aes256_wrap,
+      32 },
+#ifndef FIPS_MODULE
+    { "DES3-WRAP", ossl_der_oid_id_alg_CMS3DESwrap,
+      DER_OID_SZ_id_alg_CMS3DESwrap, 24 },
 #endif
 };