lkml.org 
[lkml]   [2019]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 10/10] integrity: support EC-RDSA signatures for asymmetric_verify
From
Date

> > > diff --git a/security/integrity/digsig_asymmetric.c b/security/integrity/digsig_asymmetric.c
> > > index d775e03fbbcc..c4a3313e0210 100644
> > > --- a/security/integrity/digsig_asymmetric.c
> > > +++ b/security/integrity/digsig_asymmetric.c
> > > @@ -104,9 +104,14 @@ 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 (!strncmp(pks.hash_algo, "streebog", 8)) {
> >
> > Is it possible to test hdr->hash_algo instead of pkcs.hash_algo? IMHO if
> > an integer value is available it's preferable to check it rather than
> > doing a string comparison.
>
> Yes. But we have long tradition of comparing by the name too:
>
> --linux$ git grep str.*cmp.*'"sha[12]'
> drivers/crypto/mxs-dcp.c: if (strcmp(halg->base.cra_name, "sha1") == 0)
> drivers/crypto/talitos.c: (!strcmp(alg->cra_name, "sha224") ||
> net/sctp/sysctl.c: if (!strncmp(tmp, "sha1", 4)) {
> scripts/sign-file.c: if (strcmp(hash_algo, "sha1") != 0) {

sign_file.c is a userspace program used for signing kernel modules.
 This example is not applicable.

> security/integrity/ima/ima_main.c: if (strncmp(str, "sha1", 4) == 0)

In the ima_main.c example, it is used in an __init function to set up
crypto defaults.  The code also predates the enumerations defined in
crypto/hash_info.c.

Mimi

\
 
 \ /
  Last update: 2019-02-26 13:09    [W:0.051 / U:1.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site