From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
barebox@lists.infradead.org
Subject: Re: [PATCH 4/9] crypto: hmac: move register to hmac
Date: Mon, 15 Jun 2015 16:27:34 +0200 [thread overview]
Message-ID: <557EE0D6.9040405@pengutronix.de> (raw)
In-Reply-To: <1427284580-30218-4-git-send-email-plagnioj@jcrosoft.com>
[-- Attachment #1.1: Type: text/plain, Size: 1993 bytes --]
Sorry for resurrecting this old thread :)
On 03/25/2015 12:56 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> As we will use the best sha algo at runtime
>
> Add a new init level crypto_initcall to ensure that all the sha present
> before hmac
Why do we need this initcall?
[...]
> -int digest_hmac_register(struct digest_algo *algo, unsigned int pad_length)
> +static int digest_hmac_register(char *name, unsigned int pad_length)
> {
> struct digest_hmac *dh;
> - char *name;
>
> - if (!algo || !pad_length)
> + if (!name || !pad_length)
> return -EINVAL;
>
> - name = algo->base.name;
> dh = xzalloc(sizeof(*dh));
> dh->name = xstrdup(name);
> dh->pad_length = pad_length;
> dh->algo = hmac_algo;
> - dh->algo.length = algo->length;
> dh->algo.base.name = asprintf("hmac(%s)", name);
> dh->algo.base.driver_name = asprintf("hmac(%s)-generic", name);
> - dh->algo.base.priority = algo->base.priority;
>
> return digest_algo_register(&dh->algo);
We just call digest_algo_register(), which adds us to the list of algos.
Nothing is allocated at this time.
> }
> +
> +static int digest_hmac_initcall(void)
> +{
> + if (IS_ENABLED(CONFIG_MD5))
> + digest_hmac_register("md5", 64);
> + if (IS_ENABLED(CONFIG_SHA1))
> + digest_hmac_register("sha1", 64);
> + if (IS_ENABLED(CONFIG_SHA224))
> + digest_hmac_register("sha224", 64);
> + if (IS_ENABLED(CONFIG_SHA256))
> + digest_hmac_register("sha256", 64);
> + if (IS_ENABLED(CONFIG_SHA384))
> + digest_hmac_register("sha384", 128);
> + if (IS_ENABLED(CONFIG_SHA512))
> + digest_hmac_register("sha512", 128);
> +
> + return 0;
> +}
> +crypto_initcall(digest_hmac_initcall);
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-06-15 14:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 11:51 [PATCH 0/9 v3] digest: allow multiple implementation of digest Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 1/9] command: digest/hashsum: set key command level Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 2/9] digest: allow algo to specify their length at runtime Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 3/9] crypto: prepare to allow multiple digest driver Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 4/9] crypto: hmac: move register to hmac Jean-Christophe PLAGNIOL-VILLARD
2015-06-15 14:27 ` Marc Kleine-Budde [this message]
2015-03-25 11:56 ` [PATCH 5/9] crypto: sha1: switch to linux implementation Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 6/9] crypto: sha256: " Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 7/9] crypto: sha512: " Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 8/9] arm: crypto: add sha1 assembly support Jean-Christophe PLAGNIOL-VILLARD
2015-03-25 11:56 ` [PATCH 9/9] arm: crypto: add sha256 " Jean-Christophe PLAGNIOL-VILLARD
2015-03-26 6:46 ` [PATCH 0/9 v3] digest: allow multiple implementation of digest Sascha Hauer
2015-03-31 15:44 ` Antony Pavlov
2015-03-31 17:33 ` Jean-Christophe PLAGNIOL-VILLARD
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=557EE0D6.9040405@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.com \
/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