summaryrefslogtreecommitdiffstats
path: root/crypto/x509
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-03-10 22:50:22 +0100
committerRichard Levitte <levitte@openssl.org>2020-03-15 19:42:04 +0100
commit70a7dd6f96c28a1a3059bf3d175bfb24449202ae (patch)
treebed8cc22e8013b51568f4b8cf3e04bf55891bf6e /crypto/x509
parenta5ce329eb496eb7ae17d6198dac51c2ab417550e (diff)
X509: Rename X509_set0_sm2_id() and friends
- X509_set0_sm2_id() -> X509_set0_distinguishing_id() - X509_get0_sm2_id() -> X509_get0_distinguishing_id() - X509_REQ_set0_sm2_id -> X509_REQ_set0_distinguishing_id() - X509_REQ_get0_sm2_id -> X509_REQ_get0_distinguishing_id() The reason for this rename is that the SM2 ID isn't really a unique SM2 data item, but rather a re-use of the Distinguished that is defined in ISO/IEC 15946-3 as well as in FIPS 196, with no special attribution toward any algorithm in particular. Fixes #11293 Reviewed-by: Paul Yang <kaishen.yy@antfin.com> (Merged from https://github.com/openssl/openssl/pull/11302)
Diffstat (limited to 'crypto/x509')
-rw-r--r--crypto/x509/x_all.c10
-rw-r--r--crypto/x509/x_req.c18
-rw-r--r--crypto/x509/x_x509.c24
3 files changed, 18 insertions, 34 deletions
diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c
index 2d7387b9e0..ca9d3dbc98 100644
--- a/crypto/x509/x_all.c
+++ b/crypto/x509/x_all.c
@@ -71,10 +71,7 @@ int X509_verify(X509 *a, EVP_PKEY *r)
if (X509_ALGOR_cmp(&a->sig_alg, &a->cert_info.signature))
return 0;
-#ifndef OPENSSL_NO_SM2
- id = a->sm2_id;
-#endif
-
+ id = a->distinguishing_id;
if ((ctx = make_id_ctx(r, id)) != NULL) {
rv = ASN1_item_verify_ctx(ASN1_ITEM_rptr(X509_CINF), &a->sig_alg,
&a->signature, &a->cert_info, ctx);
@@ -89,10 +86,7 @@ int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r)
EVP_MD_CTX *ctx = NULL;
ASN1_OCTET_STRING *id = NULL;
-#ifndef OPENSSL_NO_SM2
- id = a->sm2_id;
-#endif
-
+ id = a->distinguishing_id;
if ((ctx = make_id_ctx(r, id)) != NULL) {
rv = ASN1_item_verify_ctx(ASN1_ITEM_rptr(X509_REQ_INFO), &a->sig_alg,
a->signature, &a->req_info, ctx);
diff --git a/crypto/x509/x_req.c b/crypto/x509/x_req.c
index e9cc9ba41c..d8a89011e8 100644
--- a/crypto/x509/x_req.c
+++ b/crypto/x509/x_req.c
@@ -53,14 +53,14 @@ static int req_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
switch (operation) {
case ASN1_OP_D2I_PRE:
- ASN1_OCTET_STRING_free(ret->sm2_id);
+ ASN1_OCTET_STRING_free(ret->distinguishing_id);
/* fall thru */
case ASN1_OP_NEW_POST:
- ret->sm2_id = NULL;
+ ret->distinguishing_id = NULL;
break;
case ASN1_OP_FREE_POST:
- ASN1_OCTET_STRING_free(ret->sm2_id);
+ ASN1_OCTET_STRING_free(ret->distinguishing_id);
break;
}
#endif
@@ -90,15 +90,13 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_REQ)
IMPLEMENT_ASN1_DUP_FUNCTION(X509_REQ)
-#ifndef OPENSSL_NO_SM2
-void X509_REQ_set0_sm2_id(X509_REQ *x, ASN1_OCTET_STRING *sm2_id)
+void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *d_id)
{
- ASN1_OCTET_STRING_free(x->sm2_id);
- x->sm2_id = sm2_id;
+ ASN1_OCTET_STRING_free(x->distinguishing_id);
+ x->distinguishing_id = d_id;
}
-ASN1_OCTET_STRING *X509_REQ_get0_sm2_id(X509_REQ *x)
+ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x)
{
- return x->sm2_id;
+ return x->distinguishing_id;
}
-#endif
diff --git a/crypto/x509/x_x509.c b/crypto/x509/x_x509.c
index 7b41ce0777..e3caf8d44a 100644
--- a/crypto/x509/x_x509.c
+++ b/crypto/x509/x_x509.c
@@ -53,9 +53,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
ASIdentifiers_free(ret->rfc3779_asid);
#endif
-#ifndef OPENSSL_NO_SM2
- ASN1_OCTET_STRING_free(ret->sm2_id);
-#endif
+ ASN1_OCTET_STRING_free(ret->distinguishing_id);
/* fall thru */
@@ -76,9 +74,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
ret->rfc3779_addr = NULL;
ret->rfc3779_asid = NULL;
#endif
-#ifndef OPENSSL_NO_SM2
- ret->sm2_id = NULL;
-#endif
+ ret->distinguishing_id = NULL;
ret->aux = NULL;
ret->crldp = NULL;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data))
@@ -98,9 +94,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
ASIdentifiers_free(ret->rfc3779_asid);
#endif
-#ifndef OPENSSL_NO_SM2
- ASN1_OCTET_STRING_free(ret->sm2_id);
-#endif
+ ASN1_OCTET_STRING_free(ret->distinguishing_id);
break;
}
@@ -254,15 +248,13 @@ int X509_get_signature_nid(const X509 *x)
return OBJ_obj2nid(x->sig_alg.algorithm);
}
-#ifndef OPENSSL_NO_SM2
-void X509_set0_sm2_id(X509 *x, ASN1_OCTET_STRING *sm2_id)
+void X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *d_id)
{
- ASN1_OCTET_STRING_free(x->sm2_id);
- x->sm2_id = sm2_id;
+ ASN1_OCTET_STRING_free(x->distinguishing_id);
+ x->distinguishing_id = d_id;
}
-ASN1_OCTET_STRING *X509_get0_sm2_id(X509 *x)
+ASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x)
{
- return x->sm2_id;
+ return x->distinguishing_id;
}
-#endif