• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright 2019 Google LLC
4  */
5 
6 /*
7  * Regression test for commit e57121d08c38 ("crypto: chacha20poly1305 - validate
8  * the digest size").  This test verifies that the rfc7539 template can't be
9  * instantiated with a hash algorithm whose digest size is not 16 bytes.
10  */
11 
12 #include "tst_test.h"
13 #include "tst_af_alg.h"
14 
run(void)15 static void run(void)
16 {
17 	tst_require_alg("aead", "rfc7539(chacha20,poly1305)");
18 	tst_require_alg("hash", "sha256");
19 
20 	if (tst_have_alg("aead", "rfc7539(chacha20,sha256)")) {
21 		tst_res(TFAIL,
22 			"instantiated rfc7539 template with wrong digest size");
23 	} else {
24 		tst_res(TPASS,
25 			"couldn't instantiate rfc7539 template with wrong digest size");
26 	}
27 }
28 
29 static struct tst_test test = {
30 	.test_all = run,
31 	.tags = (const struct tst_tag[]) {
32 		{"linux-git", "e57121d08c38"},
33 		{}
34 	}
35 };
36