From: Rusty Russell <rusty@rustcorp.com.au>
To: Herbert Xu <herbert@gondor.apana.org.au>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: crypto: api - Move module sig ifdef into accessor function
Date: Wed, 22 Apr 2015 16:29:16 +0930 [thread overview]
Message-ID: <87pp6wodh7.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20150422032846.GA6798@gondor.apana.org.au>
Herbert Xu <herbert@gondor.apana.org.au> writes:
> Currently we're hiding mod->sig_ok under an ifdef in open code.
> This patch adds a module_sig_ok accessor function and removes that
> ifdef.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Did you want me to take this via modules-next? Assuming not.
So:
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Thanks,
Rusty.
> diff --git a/crypto/algapi.c b/crypto/algapi.c
> index 8057c9f..c63836f 100644
> --- a/crypto/algapi.c
> +++ b/crypto/algapi.c
> @@ -44,12 +44,9 @@ static inline int crypto_set_driver_name(struct crypto_alg *alg)
>
> static inline void crypto_check_module_sig(struct module *mod)
> {
> -#ifdef CONFIG_CRYPTO_FIPS
> - if (fips_enabled && mod && !mod->sig_ok)
> + if (fips_enabled && mod && !module_sig_ok(mod))
> panic("Module %s signature verification failed in FIPS mode\n",
> mod->name);
> -#endif
> - return;
> }
>
> static int crypto_check_alg(struct crypto_alg *alg)
> diff --git a/include/linux/module.h b/include/linux/module.h
> index c883b86..1e54360 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -655,4 +655,16 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr,
> static inline void module_bug_cleanup(struct module *mod) {}
> #endif /* CONFIG_GENERIC_BUG */
>
> +#ifdef CONFIG_MODULE_SIG
> +static inline bool module_sig_ok(struct module *module)
> +{
> + return module->sig_ok;
> +}
> +#else /* !CONFIG_MODULE_SIG */
> +static inline bool module_sig_ok(struct module *module)
> +{
> + return true;
> +}
> +#endif /* CONFIG_MODULE_SIG */
> +
> #endif /* _LINUX_MODULE_H */
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2015-04-22 6:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 3:28 crypto: api - Move module sig ifdef into accessor function Herbert Xu
2015-04-22 6:59 ` Rusty Russell [this message]
2015-04-22 8:12 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pp6wodh7.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).