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: 10858153 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C7DA17E9 for ; Mon, 18 Mar 2019 17:14:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35F8F28D29 for ; Mon, 18 Mar 2019 17:14:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A3B128D49; Mon, 18 Mar 2019 17:14:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9AC528D35 for ; Mon, 18 Mar 2019 17:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbfCRROX (ORCPT ); Mon, 18 Mar 2019 13:14:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbfCRROX (ORCPT ); Mon, 18 Mar 2019 13:14:23 -0400 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 Cc: linux-crypto@vger.kernel.org Subject: [PATCH v2 3/6] crypto/af_alg02: new regression test for salsa20 empty message bug 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 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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, +};