diff mbox series

[4/6] crypto/af_alg03: new regression test for rfc7539 hash alg validation

Message ID 20190221053026.18489-5-ebiggers@kernel.org (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show
Series ltp: AF_ALG test helpers and a few regression tests | expand

Commit Message

Eric Biggers Feb. 21, 2019, 5:30 a.m. UTC
From: Eric Biggers <ebiggers@google.com>

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 testcases/kernel/crypto/.gitignore |  1 +
 testcases/kernel/crypto/af_alg03.c | 31 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 testcases/kernel/crypto/af_alg03.c

Comments

Petr Vorel March 15, 2019, 9:29 a.m. UTC | #1
Hi Eric,

you forget to add af_alg03 into runtest/cve.
The same applies to af_alg0{4,5}.


Kind regards,
Petr
Eric Biggers March 15, 2019, 4:13 p.m. UTC | #2
Hi Petr,

On Fri, Mar 15, 2019 at 10:29:53AM +0100, Petr Vorel wrote:
> Hi Eric,
> 
> you forget to add af_alg03 into runtest/cve.
> The same applies to af_alg0{4,5}.
> 
> 
> Kind regards,
> Petr

As far as I know, there are no CVEs assigned for those bugs.

- Eric
Petr Vorel March 15, 2019, 6:40 p.m. UTC | #3
Hi Eric,

> > you forget to add af_alg03 into runtest/cve.
> > The same applies to af_alg0{4,5}.

> As far as I know, there are no CVEs assigned for those bugs.
Wouldn't be better to add them to runtest/cve (or other runtest file) just with
filename? And rename them in runtest file once the CVEs are assigned?

> - Eric

Kind regards,
Petr
Eric Biggers March 15, 2019, 7:49 p.m. UTC | #4
On Fri, Mar 15, 2019 at 07:40:18PM +0100, Petr Vorel wrote:
> Hi Eric,
> 
> > > you forget to add af_alg03 into runtest/cve.
> > > The same applies to af_alg0{4,5}.
> 
> > As far as I know, there are no CVEs assigned for those bugs.
> Wouldn't be better to add them to runtest/cve (or other runtest file) just with
> filename? And rename them in runtest file once the CVEs are assigned?
> 
> > - Eric
> 
> Kind regards,
> Petr

Oh, I missed that they're not in any runtest file at all.  They all should be in
runtest/crypto (in addition to the ones with CVEs being in runtest/cve).

- Eric
diff mbox series

Patch

diff --git a/testcases/kernel/crypto/.gitignore b/testcases/kernel/crypto/.gitignore
index dc79f3275b..3e7936fc94 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 0000000000..240c52835f
--- /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,
+};