Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3524791imu; Mon, 7 Jan 2019 05:05:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN57EosGrxw9HhLACENq7Hx0t1IP/UV5Xi8L1mLTF1m3Hvc1+m072IgElslqXi3rjcOQUCTY X-Received: by 2002:a63:d949:: with SMTP id e9mr10931355pgj.24.1546866317807; Mon, 07 Jan 2019 05:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546866317; cv=none; d=google.com; s=arc-20160816; b=lSno19ExOEO1dozqgOlQTCFonUHzYj1EWGKzL0MA8Y2+fD04KHXKIs6lcqivOM0n5g KsM0hVXQH32RJTkMoKtVley4QGouK5KDxUHpMArJ//Fvjr4oFmvRCe3U69MCj923WB0o EuK4hay3Mek5C+BCbAjGRBgv8AM56QgLHsCtW7Rc3ArMkBqe4jWfwJYOOalSMGm62pJ3 x/A+X2w1MNVWmYh7z+CW1IRDbLMw516Tp8PNswQT6ujII8LbSrj6x2sR+VNZT1FYsJ7U hQXSDOmdBi7MMY4XfpgZaJnq15plmXSDZT2ltXnPQQRseCW5m0eNL70SY3aaL8x3Xg3W BfoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TX8xsBDf0Hixe3AcRdLKmyL6YrwWvbWGPNcmb920GL8=; b=fuSLhSb3ROoVWLX1vlQFtDKzPJtIrrXo0gBHTvfMIBayp6Ni1whMD0OihzuWXZ9cVG 6RLcqfzjGO394Q8/Ewk86svqb8tr/L6dIfqZRjXXq3+QvShoNfNk06Lf/4wc/SpzwAw/ UVlegx1vrsfRs8qsbDjPa018Zcff8ADcW4uvnGM0iqYg4k8RgEjscTRN/do2PN5YwjWa 3S4AXqkAuV2Q6joU/rTH6i8bnr2OOf+jzfXoazg/mABnN9Ace4q7zbGXqcFc0VJTtse9 OavLdb2zIfgI/HSj66wH+pUB78wIxtRHccutUQjgFOgrb7ChRzt1GfS1MTFCzgNDQW4U dlNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c0mRCsVK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 80si29516702pfz.11.2019.01.07.05.05.02; Mon, 07 Jan 2019 05:05:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c0mRCsVK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730960AbfAGNDM (ORCPT + 99 others); Mon, 7 Jan 2019 08:03:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:50640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730936AbfAGNDJ (ORCPT ); Mon, 7 Jan 2019 08:03:09 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5F1A22183E; Mon, 7 Jan 2019 13:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866188; bh=7T/Y8D3pJnjWAraxEMp8lW05Nhm2JOw20yO+uMSSe10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0mRCsVKm1v1cllpXnjjv52GiP6doaKnHJ1Y9NSy+6nk8W+AN7HR9Qo8K00j1H9pN KvmkG2pgH3Dd7NtkWP05eP3McA8lDTJ1CYR2+ohSNsLlCX5vzt7PT/gqOCBBossdLK 5dGB2eM2sf4w+O6XpTrSOHY3eo2mjeUgUbZY7+ys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Eremin-Solenikov , Herbert Xu Subject: [PATCH 4.14 074/101] crypto: testmgr - add AES-CFB tests Date: Mon, 7 Jan 2019 13:33:02 +0100 Message-Id: <20190107105337.027200704@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Eremin-Solenikov commit 7da66670775d201f633577f5b15a4bbeebaaa2b0 upstream. Add AES128/192/256-CFB testvectors from NIST SP800-38A. Signed-off-by: Dmitry Eremin-Solenikov Cc: stable@vger.kernel.org Signed-off-by: Dmitry Eremin-Solenikov Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/tcrypt.c | 5 +++ crypto/testmgr.c | 7 +++++ crypto/testmgr.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -1099,6 +1099,7 @@ static int do_test(const char *alg, u32 ret += tcrypt_test("xts(aes)"); ret += tcrypt_test("ctr(aes)"); ret += tcrypt_test("rfc3686(ctr(aes))"); + ret += tcrypt_test("cfb(aes)"); break; case 11: @@ -1422,6 +1423,10 @@ static int do_test(const char *alg, u32 speed_template_16_24_32); test_cipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); + test_cipher_speed("cfb(aes)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + test_cipher_speed("cfb(aes)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); break; case 201: --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2626,6 +2626,13 @@ static const struct alg_test_desc alg_te } } }, { + .alg = "cfb(aes)", + .test = alg_test_skcipher, + .fips_allowed = 1, + .suite = { + .cipher = __VECS(aes_cfb_tv_template) + }, + }, { .alg = "chacha20", .test = alg_test_skcipher, .suite = { --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -16029,6 +16029,82 @@ static const struct cipher_testvec aes_c }, }; +static const struct cipher_testvec aes_cfb_tv_template[] = { + { /* From NIST SP800-38A */ + .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" + "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", + .klen = 16, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", + .ctext = "\x3b\x3f\xd9\x2e\xb7\x2d\xad\x20" + "\x33\x34\x49\xf8\xe8\x3c\xfb\x4a" + "\xc8\xa6\x45\x37\xa0\xb3\xa9\x3f" + "\xcd\xe3\xcd\xad\x9f\x1c\xe5\x8b" + "\x26\x75\x1f\x67\xa3\xcb\xb1\x40" + "\xb1\x80\x8c\xf1\x87\xa4\xf4\xdf" + "\xc0\x4b\x05\x35\x7c\x5d\x1c\x0e" + "\xea\xc4\xc6\x6f\x9f\xf7\xf2\xe6", + .len = 64, + }, { + .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52" + "\xc8\x10\xf3\x2b\x80\x90\x79\xe5" + "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b", + .klen = 24, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", + .ctext = "\xcd\xc8\x0d\x6f\xdd\xf1\x8c\xab" + "\x34\xc2\x59\x09\xc9\x9a\x41\x74" + "\x67\xce\x7f\x7f\x81\x17\x36\x21" + "\x96\x1a\x2b\x70\x17\x1d\x3d\x7a" + "\x2e\x1e\x8a\x1d\xd5\x9b\x88\xb1" + "\xc8\xe6\x0f\xed\x1e\xfa\xc4\xc9" + "\xc0\x5f\x9f\x9c\xa9\x83\x4f\xa0" + "\x42\xae\x8f\xba\x58\x4b\x09\xff", + .len = 64, + }, { + .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe" + "\x2b\x73\xae\xf0\x85\x7d\x77\x81" + "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" + "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", + .klen = 32, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", + .ctext = "\xdc\x7e\x84\xbf\xda\x79\x16\x4b" + "\x7e\xcd\x84\x86\x98\x5d\x38\x60" + "\x39\xff\xed\x14\x3b\x28\xb1\xc8" + "\x32\x11\x3c\x63\x31\xe5\x40\x7b" + "\xdf\x10\x13\x24\x15\xe5\x4b\x92" + "\xa1\x3e\xd0\xa8\x26\x7a\xe2\xf9" + "\x75\xa3\x85\x74\x1a\xb9\xce\xf8" + "\x20\x31\x62\x3d\x55\xb1\xe4\x71", + .len = 64, + }, +}; + static const struct aead_testvec hmac_md5_ecb_cipher_null_enc_tv_template[] = { { /* Input data from RFC 2410 Case 1 */ #ifdef __LITTLE_ENDIAN