From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: adiantum testmgr tests not running?
Date: Thu, 12 Dec 2019 09:21:55 -0800 [thread overview]
Message-ID: <20191212172154.GA100563@gmail.com> (raw)
In-Reply-To: <CAHmME9o4s3B_KUKYAzJr6xNaKdiLSGMJz-EyzP7RUptya1FqMg@mail.gmail.com>
Hi Jason,
On Thu, Dec 12, 2019 at 04:33:25PM +0100, Jason A. Donenfeld wrote:
> Hey Eric,
>
> I had to do this ugly hack to get the adiantum testmgr tests running.
> Did you wind up doing the same when developing it, or was there some
> other mechanism that invoked this naturally? I see all the other
> primitives running, but not adiantum.
>
> Jason
>
> diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c
> index 8beea79ab117..f446b19429e9 100644
> --- a/crypto/chacha_generic.c
> +++ b/crypto/chacha_generic.c
> @@ -117,7 +117,9 @@ static struct skcipher_alg algs[] = {
>
> static int __init chacha_generic_mod_init(void)
> {
> - return crypto_register_skciphers(algs, ARRAY_SIZE(algs));
> + int ret = crypto_register_skciphers(algs, ARRAY_SIZE(algs));
> + BUG_ON(alg_test("adiantum(xchacha20,aes)", "adiantum", 0, 0));
> + return ret;
> }
>
You need to do something which instantiates the template, since "adiantum" is a
template, not an algorithm itself. The easiest way to do this is with AF_ALG,
e.g.:
python3 <<EOF
import socket
s = socket.socket(socket.AF_ALG, 5, 0)
s.bind(("skcipher", "adiantum(xchacha12,aes)"))
s.bind(("skcipher", "adiantum(xchacha20,aes)"))
EOF
All the other templates work this way too. So for more general testing of the
crypto API, I've actually been running a program that uses AF_ALG to try to bind
to every algorithm name for which self-tests are defined.
- Eric
next prev parent reply other threads:[~2019-12-12 17:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 15:33 adiantum testmgr tests not running? Jason A. Donenfeld
2019-12-12 17:21 ` Eric Biggers [this message]
2019-12-12 17:28 ` Jason A. Donenfeld
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=20191212172154.GA100563@gmail.com \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=ard.biesheuvel@linaro.org \
--cc=linux-crypto@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