Skip to content

Commit 3fb8e3f

Browse files
uudiinjarkkojs
authored andcommitted
pkcs7: parser support SM2 and SM3 algorithms combination
Support parsing the message signature of the SM2 and SM3 algorithm combination. This group of algorithms has been well supported. One of the main users is module signature verification. Signed-off-by: Tianjia Zhang <[email protected]> Reviewed-by: Vitaly Chikunov <[email protected]> Reviewed-by: Stefan Berger <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 1a83950 commit 3fb8e3f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crypto/asymmetric_keys/pkcs7_parser.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
248248
case OID_sha224:
249249
ctx->sinfo->sig->hash_algo = "sha224";
250250
break;
251+
case OID_sm3:
252+
ctx->sinfo->sig->hash_algo = "sm3";
253+
break;
251254
default:
252255
printk("Unsupported digest algo: %u\n", ctx->last_oid);
253256
return -ENOPKG;
@@ -277,6 +280,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
277280
ctx->sinfo->sig->pkey_algo = "ecdsa";
278281
ctx->sinfo->sig->encoding = "x962";
279282
break;
283+
case OID_SM2_with_SM3:
284+
ctx->sinfo->sig->pkey_algo = "sm2";
285+
ctx->sinfo->sig->encoding = "raw";
286+
break;
280287
default:
281288
printk("Unsupported pkey algo: %u\n", ctx->last_oid);
282289
return -ENOPKG;

0 commit comments

Comments
 (0)