From patchwork Mon Mar 18 17:13:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1057949 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="rfJ3CFLB"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44NN8V4qytz9sBV for ; Tue, 19 Mar 2019 04:14:34 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D68AD3EADBF for ; Mon, 18 Mar 2019 18:14:31 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 0D6573EA188 for ; Mon, 18 Mar 2019 18:14:25 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 7AA341A01181 for ; Mon, 18 Mar 2019 18:14:24 +0100 (CET) Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BE4621741; Mon, 18 Mar 2019 17:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552929262; bh=TBiTnpqnDNbXb+i+BTpmBaZvLRAhCCO8ILCRjzwbKs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfJ3CFLBsYaJzdambq/nqHNRPdGQeXKa6HSkVSgOj0WxQp3BZWUZCYcPP/TyfdB2+ gXNIwshyqiqSQ7EQ34rHH/1UIlZrXEYv6hdUv5u4awJ/pwcI6wq0AzIi4b6GsWy7lJ zu5tOmqmi+/Ct/r2N26DIZCSSn81JH0nV1/uSqhs= From: Eric Biggers To: ltp@lists.linux.it Date: Mon, 18 Mar 2019 10:13:24 -0700 Message-Id: <20190318171327.237014-4-ebiggers@kernel.org> X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog In-Reply-To: <20190318171327.237014-1-ebiggers@kernel.org> References: <20190318171327.237014-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-3.smtp.seeweb.it Cc: linux-crypto@vger.kernel.org Subject: [LTP] [PATCH v2 3/6] crypto/af_alg02: new regression test for salsa20 empty message bug X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Eric Biggers Signed-off-by: Eric Biggers --- runtest/crypto | 1 + runtest/cve | 1 + testcases/kernel/crypto/.gitignore | 1 + testcases/kernel/crypto/af_alg02.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 testcases/kernel/crypto/af_alg02.c diff --git a/runtest/crypto b/runtest/crypto index 45c8cdd2d..758586c19 100644 --- a/runtest/crypto +++ b/runtest/crypto @@ -1,3 +1,4 @@ af_alg01 af_alg01 +af_alg02 af_alg02 pcrypt_aead01 pcrypt_aead01 crypto_user01 crypto_user01 diff --git a/runtest/cve b/runtest/cve index f46c400cc..031bcdc2a 100644 --- a/runtest/cve +++ b/runtest/cve @@ -27,6 +27,7 @@ cve-2017-15299 request_key03 -b cve-2017-15299 cve-2017-15537 ptrace07 cve-2017-15649 fanout01 cve-2017-15951 request_key03 -b cve-2017-15951 +cve-2017-17805 af_alg02 cve-2017-17806 af_alg01 cve-2017-17807 request_key04 cve-2017-1000364 stack_clash diff --git a/testcases/kernel/crypto/.gitignore b/testcases/kernel/crypto/.gitignore index 998af1728..dc79f3275 100644 --- a/testcases/kernel/crypto/.gitignore +++ b/testcases/kernel/crypto/.gitignore @@ -1,3 +1,4 @@ af_alg01 +af_alg02 pcrypt_aead01 crypto_user01 diff --git a/testcases/kernel/crypto/af_alg02.c b/testcases/kernel/crypto/af_alg02.c new file mode 100644 index 000000000..a9e820423 --- /dev/null +++ b/testcases/kernel/crypto/af_alg02.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2019 Google LLC + */ + +/* + * Regression test for commit ecaaab564978 ("crypto: salsa20 - fix + * blkcipher_walk API usage"), or CVE-2017-17805. This test verifies that an + * empty message can be encrypted with Salsa20 without crashing the kernel. + */ + +#include "tst_test.h" +#include "tst_af_alg.h" + +static void run(void) +{ + char buf[16]; + int reqfd = tst_alg_setup_reqfd("skcipher", "salsa20", NULL, 16); + + /* With the bug the kernel crashed here */ + if (read(reqfd, buf, 16) == 0) + tst_res(TPASS, "Successfully \"encrypted\" an empty message"); + else + tst_res(TBROK, "read() didn't return 0"); +} + +static struct tst_test test = { + .test_all = run, +};