Skip to content

Commit

Permalink
integrity: support EC-RDSA signatures for asymmetric_verify
Browse files Browse the repository at this point in the history
Allow to use EC-RDSA signatures for IMA by determining signature type by
the hash algorithm name. This works good for EC-RDSA since Streebog and
EC-RDSA should always be used together.

Cc: Mimi Zohar <[email protected]>
Cc: Dmitry Kasatkin <[email protected]>
Cc: [email protected]
Signed-off-by: Vitaly Chikunov <[email protected]>
Reviewed-by: Mimi Zohar <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
vt-alt authored and herbertx committed Apr 18, 2019
1 parent 32fbdbd commit be08f0c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions security/integrity/digsig_asymmetric.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,16 @@ int asymmetric_verify(struct key *keyring, const char *sig,

memset(&pks, 0, sizeof(pks));

pks.pkey_algo = "rsa";
pks.hash_algo = hash_algo_name[hdr->hash_algo];
pks.encoding = "pkcs1";
if (hdr->hash_algo == HASH_ALGO_STREEBOG_256 ||
hdr->hash_algo == HASH_ALGO_STREEBOG_512) {
/* EC-RDSA and Streebog should go together. */
pks.pkey_algo = "ecrdsa";
pks.encoding = "raw";
} else {
pks.pkey_algo = "rsa";
pks.encoding = "pkcs1";
}
pks.digest = (u8 *)data;
pks.digest_size = datalen;
pks.s = hdr->sig;
Expand Down

0 comments on commit be08f0c

Please sign in to comment.