[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1551182863.27819.62.camel@linux.ibm.com>
Date: Tue, 26 Feb 2019 07:07:43 -0500
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Vitaly Chikunov <vt@...linux.org>,
Thiago Jung Bauermann <bauerman@...ux.ibm.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
David Howells <dhowells@...hat.com>,
linux-integrity@...r.kernel.org, keyrings@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
Dmitry Kasatkin <dmitry.kasatkin@...il.com>
Subject: Re: [PATCH v5 10/10] integrity: support EC-RDSA signatures for
asymmetric_verify
> > > 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
Powered by blists - more mailing lists