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