summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>2022-06-27 11:19:58 +0200
committerJarkko Sakkinen <jarkko@kernel.org>2022-08-03 22:56:20 +0200
commit74ad4334b2ae4f83d8018487d625d1073fd3f02d (patch)
tree32bb2548c0af069a6f498c247bba5efc0a2e7584 /crypto
parenttpm: Add tpm_tis_i2c backend for tpm_tis_core (diff)
downloadlinux-74ad4334b2ae4f83d8018487d625d1073fd3f02d.tar.xz
linux-74ad4334b2ae4f83d8018487d625d1073fd3f02d.zip
X.509: Support parsing certificate using SM2 algorithm
The SM2-with-SM3 certificate generated by latest openssl no longer reuses the OID_id_ecPublicKey, but directly uses OID_sm2. This patch supports this type of x509 certificate parsing. Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asymmetric_keys/x509_cert_parser.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index 2899ed80bb18..7a9b084e2043 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -508,6 +508,9 @@ int x509_extract_key_data(void *context, size_t hdrlen,
case OID_gost2012PKey512:
ctx->cert->pub->pkey_algo = "ecrdsa";
break;
+ case OID_sm2:
+ ctx->cert->pub->pkey_algo = "sm2";
+ break;
case OID_id_ecPublicKey:
if (parse_OID(ctx->params, ctx->params_size, &oid) != 0)
return -EBADMSG;