Skip to content

Commit

Permalink
X.509: Support parsing certificate using SM2 algorithm
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
  • Loading branch information
uudiin authored and jarkkojs committed Aug 3, 2022
1 parent bbc23a0 commit 74ad433
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/asymmetric_keys/x509_cert_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 74ad433

Please sign in to comment.