Re: adiantum testmgr tests not running?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux