Skip to content

Commit

Permalink
pkcs7: support EC-RDSA/streebog in SignerInfo
Browse files Browse the repository at this point in the history
Allow using EC-RDSA/streebog in pkcs7 certificates in a similar way
to how it's done in the x509 parser.

This is needed e.g. for loading kernel modules signed with EC-RDSA.

Signed-off-by: Elvira Khabirova <[email protected]>
Reviewed-by: Vitaly Chikunov <[email protected]>
Reviewed-by: Tianjia Zhang <[email protected]>
Reviewed-by: Jarkko Sakkinen <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
  • Loading branch information
Elvira Khabirova authored and jarkkojs committed Aug 3, 2022
1 parent 3fb8e3f commit d35f42c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crypto/asymmetric_keys/pkcs7_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
case OID_sm3:
ctx->sinfo->sig->hash_algo = "sm3";
break;
case OID_gost2012Digest256:
ctx->sinfo->sig->hash_algo = "streebog256";
break;
case OID_gost2012Digest512:
ctx->sinfo->sig->hash_algo = "streebog512";
break;
default:
printk("Unsupported digest algo: %u\n", ctx->last_oid);
return -ENOPKG;
Expand Down Expand Up @@ -284,6 +290,11 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
ctx->sinfo->sig->pkey_algo = "sm2";
ctx->sinfo->sig->encoding = "raw";
break;
case OID_gost2012PKey256:
case OID_gost2012PKey512:
ctx->sinfo->sig->pkey_algo = "ecrdsa";
ctx->sinfo->sig->encoding = "raw";
break;
default:
printk("Unsupported pkey algo: %u\n", ctx->last_oid);
return -ENOPKG;
Expand Down

0 comments on commit d35f42c

Please sign in to comment.