From: Eric Biggers <ebiggers@kernel.org> To: ltp@lists.linux.it Cc: linux-crypto@vger.kernel.org Subject: [PATCH v2 4/6] crypto/af_alg03: new regression test for rfc7539 hash alg validation Date: Mon, 18 Mar 2019 10:13:25 -0700 [thread overview] Message-ID: <20190318171327.237014-5-ebiggers@kernel.org> (raw) In-Reply-To: <20190318171327.237014-1-ebiggers@kernel.org> From: Eric Biggers <ebiggers@google.com> Signed-off-by: Eric Biggers <ebiggers@google.com> --- runtest/crypto | 1 + testcases/kernel/crypto/.gitignore | 1 + testcases/kernel/crypto/af_alg03.c | 31 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 testcases/kernel/crypto/af_alg03.c diff --git a/runtest/crypto b/runtest/crypto index 758586c19..03a49df3a 100644 --- a/runtest/crypto +++ b/runtest/crypto @@ -1,4 +1,5 @@ af_alg01 af_alg01 af_alg02 af_alg02 +af_alg03 af_alg03 pcrypt_aead01 pcrypt_aead01 crypto_user01 crypto_user01 diff --git a/testcases/kernel/crypto/.gitignore b/testcases/kernel/crypto/.gitignore index dc79f3275..3e7936fc9 100644 --- a/testcases/kernel/crypto/.gitignore +++ b/testcases/kernel/crypto/.gitignore @@ -1,4 +1,5 @@ af_alg01 af_alg02 +af_alg03 pcrypt_aead01 crypto_user01 diff --git a/testcases/kernel/crypto/af_alg03.c b/testcases/kernel/crypto/af_alg03.c new file mode 100644 index 000000000..240c52835 --- /dev/null +++ b/testcases/kernel/crypto/af_alg03.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2019 Google LLC + */ + +/* + * Regression test for commit e57121d08c38 ("crypto: chacha20poly1305 - validate + * the digest size"). This test verifies that the rfc7539 template can't be + * instantiated with a hash algorithm whose digest size is not 16 bytes. + */ + +#include "tst_test.h" +#include "tst_af_alg.h" + +static void run(void) +{ + tst_require_alg("aead", "rfc7539(chacha20,poly1305)"); + tst_require_alg("hash", "sha256"); + + if (tst_have_alg("aead", "rfc7539(chacha20,sha256)")) { + tst_res(TFAIL, + "instantiated rfc7539 template with wrong digest size"); + } else { + tst_res(TPASS, + "couldn't instantiate rfc7539 template with wrong digest size"); + } +} + +static struct tst_test test = { + .test_all = run, +}; -- 2.21.0.225.g810b269d1ac-goog
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org> To: ltp@lists.linux.it Subject: [LTP] [PATCH v2 4/6] crypto/af_alg03: new regression test for rfc7539 hash alg validation Date: Mon, 18 Mar 2019 10:13:25 -0700 [thread overview] Message-ID: <20190318171327.237014-5-ebiggers@kernel.org> (raw) In-Reply-To: <20190318171327.237014-1-ebiggers@kernel.org> From: Eric Biggers <ebiggers@google.com> Signed-off-by: Eric Biggers <ebiggers@google.com> --- runtest/crypto | 1 + testcases/kernel/crypto/.gitignore | 1 + testcases/kernel/crypto/af_alg03.c | 31 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 testcases/kernel/crypto/af_alg03.c diff --git a/runtest/crypto b/runtest/crypto index 758586c19..03a49df3a 100644 --- a/runtest/crypto +++ b/runtest/crypto @@ -1,4 +1,5 @@ af_alg01 af_alg01 af_alg02 af_alg02 +af_alg03 af_alg03 pcrypt_aead01 pcrypt_aead01 crypto_user01 crypto_user01 diff --git a/testcases/kernel/crypto/.gitignore b/testcases/kernel/crypto/.gitignore index dc79f3275..3e7936fc9 100644 --- a/testcases/kernel/crypto/.gitignore +++ b/testcases/kernel/crypto/.gitignore @@ -1,4 +1,5 @@ af_alg01 af_alg02 +af_alg03 pcrypt_aead01 crypto_user01 diff --git a/testcases/kernel/crypto/af_alg03.c b/testcases/kernel/crypto/af_alg03.c new file mode 100644 index 000000000..240c52835 --- /dev/null +++ b/testcases/kernel/crypto/af_alg03.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2019 Google LLC + */ + +/* + * Regression test for commit e57121d08c38 ("crypto: chacha20poly1305 - validate + * the digest size"). This test verifies that the rfc7539 template can't be + * instantiated with a hash algorithm whose digest size is not 16 bytes. + */ + +#include "tst_test.h" +#include "tst_af_alg.h" + +static void run(void) +{ + tst_require_alg("aead", "rfc7539(chacha20,poly1305)"); + tst_require_alg("hash", "sha256"); + + if (tst_have_alg("aead", "rfc7539(chacha20,sha256)")) { + tst_res(TFAIL, + "instantiated rfc7539 template with wrong digest size"); + } else { + tst_res(TPASS, + "couldn't instantiate rfc7539 template with wrong digest size"); + } +} + +static struct tst_test test = { + .test_all = run, +}; -- 2.21.0.225.g810b269d1ac-goog
next prev parent reply other threads:[~2019-03-18 17:14 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-18 17:13 [PATCH v2 0/6] ltp: AF_ALG test helpers and a few regression tests Eric Biggers 2019-03-18 17:13 ` [LTP] " Eric Biggers 2019-03-18 17:13 ` [PATCH v2 1/6] lib: add tst_af_alg lib Eric Biggers 2019-03-18 17:13 ` [LTP] " Eric Biggers 2019-03-18 17:13 ` [PATCH v2 2/6] crypto/af_alg01: new regression test for hmac nesting bug Eric Biggers 2019-03-18 17:13 ` [LTP] " Eric Biggers 2019-03-18 17:13 ` [PATCH v2 3/6] crypto/af_alg02: new regression test for salsa20 empty message bug Eric Biggers 2019-03-18 17:13 ` [LTP] " Eric Biggers 2019-03-18 17:13 ` Eric Biggers [this message] 2019-03-18 17:13 ` [LTP] [PATCH v2 4/6] crypto/af_alg03: new regression test for rfc7539 hash alg validation Eric Biggers 2019-03-18 17:13 ` [PATCH v2 5/6] crypto/af_alg04: new regression test for vmac race conditions Eric Biggers 2019-03-18 17:13 ` [LTP] " Eric Biggers 2019-03-18 17:13 ` [PATCH v2 6/6] crypto/af_alg05: new regression test for skcipher_walk error bug Eric Biggers 2019-03-18 17:13 ` [LTP] " Eric Biggers 2019-03-18 18:27 ` [LTP] [PATCH v2 0/6] ltp: AF_ALG test helpers and a few regression tests Petr Vorel 2019-03-18 18:27 ` Petr Vorel 2019-03-18 19:10 ` Petr Vorel 2019-03-18 19:10 ` Petr Vorel
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=20190318171327.237014-5-ebiggers@kernel.org \ --to=ebiggers@kernel.org \ --cc=linux-crypto@vger.kernel.org \ --cc=ltp@lists.linux.it \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.