From patchwork Tue Sep 3 16:43:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 172875 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp99309ily; Tue, 3 Sep 2019 09:44:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdj17ug4wU6GexZ1xZI0AB7Em0a8o0RYqj/pP6r2p8wwYdDsYhTsb2cKI2c6gqxH/6/Ayt X-Received: by 2002:a17:90a:2a4a:: with SMTP id d10mr235758pjg.72.1567529048037; Tue, 03 Sep 2019 09:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567529048; cv=none; d=google.com; s=arc-20160816; b=EUBZi8pPGtYTsLBhFXK3BSEPHJJOmGUhYCngFn3MfHS7pKziugCep3GMTR5Zv/d9Su YoLHoY+BkBrZ3QxA+dCHWk7OtOD4VMa+Rgpt3u0959BF6XjmPo1aIss7YHBROWqBUWgd cnIyryOlpMgv1AFFvsBDYLbIjcyhglswhA6WYPU3mk3MfzAy/g3yKMYMmOo8yhAdBxel b87REKlYOP+rI+jlU763kf3jLMFXh8k86Qm1xc0FR5Cs2ViHHDS/V5+qNIQ4zDJdidJZ 023bb5jViYJNfJeWV82S1OniFm23/CSO/c55BmHxTPukFA7k2zUJ7X+VePPSpdBkkNAn 1ERA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=aamHsTt7qMo6nP80it71PLpr/6sTUJeGAetaZJptbPw=; b=f5tQhuF0jOr/v+L0W0VcIiK2pDerU/16d5a9EQoR0c0GQPDDcko5VS37p35eC3Tv7n WqVB6W3Us8OPTUazNAs4BmYk5viWBf5QyPdf8yBys+Z118Ai6UanBCixOvkCqFK3wHiT ARExympnlMS4qBx3TtQhSvu0NtRAdC+uS/K74+i3r5WbgFfh3YgJ32Cr6YYJzZuSar+z 0iWqPaqVsyGUdjN2MRzJFvtFhAtB6tOLKyopxAMwCaGw8cCjz0h1duDlANUrSOUEJFvr TMrO9go8CKAhMzn7xB+ul7C/LAkcGvzRqnZL/kjlaTq1Rlh2WPq28FGvv2kWv1xFiwi7 lLoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o/cSwbn5"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si14716735pgs.87.2019.09.03.09.44.07; Tue, 03 Sep 2019 09:44:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=@linaro.org header.s=google header.b="o/cSwbn5"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730134AbfICQoH (ORCPT + 3 others); Tue, 3 Sep 2019 12:44:07 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44556 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730133AbfICQoH (ORCPT ); Tue, 3 Sep 2019 12:44:07 -0400 Received: by mail-pf1-f196.google.com with SMTP id q21so6089929pfn.11 for ; Tue, 03 Sep 2019 09:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aamHsTt7qMo6nP80it71PLpr/6sTUJeGAetaZJptbPw=; b=o/cSwbn5Bu3uXQ+r3TPgIG/f55MDyn/ay3aJH67AUeXUl6ipWw5RFMEZ89MskDmHQ/ mb9qEYIx2+jYCXinXSGcGs7pICXFs3nbxLRiOUymU0avQ+tXEN5P5qI/3ecK22OKfwzE REbVVw8gLqd5dDuZbGZXXqHlQuOb5RrHvXWRmc48JnGeTHi9iAOmBprlSZFA9nojifeJ F7v7KhrZgzP/sYNutXRf0RxRUqg6W680TBy/ZTrgJQMci6Fm4ffnDyyc1RoOu+gfmQmw SXRGnaDH1BSLi46d8qYr9vokyoGHxruEKPWUte42OVDWwdwhgT/eDCncuG9pvqmnXZMd /HQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aamHsTt7qMo6nP80it71PLpr/6sTUJeGAetaZJptbPw=; b=lrBT7iGFnq6Pctn4YWdW+2A+Bum5PvACqmOyqfXXEf3Tnb+Cs9IhzHAEHW7DtHsyad Pbai7N16zS/cHlotComR7ownm7N+5r746RdRS+/+7F6l4rKR+8FphV2e+GuP+3ozEmgX q6h6NZaBjl1R2pZA357jQuTVYD6D3uASDqFEmWzYqD9EUS/4c18nxbw0TOi0nl6D1CxF C9jfoagU7opTpZ7WCqmBbbqx7mXe8duEXjojmeNlK1siMFd6JPxoBQ4n9jV7+FY6sFkh /wbtRKCEkfy+F7p2U1QaSPNNmPNEtSNwlOiKDkE7bKIhN6IwTO+wlmqOLWp6nF7hkSii J3sA== X-Gm-Message-State: APjAAAVvNwnYWSQltQfqxdN9nO9wORozC9JnGGtU/CLa5BwGv9yHBTNX ZFpR12z1NRkR5ZIL9+Ro9DVQDi6eAZ7uvIod X-Received: by 2002:a62:c141:: with SMTP id i62mr19695910pfg.64.1567529046227; Tue, 03 Sep 2019 09:44:06 -0700 (PDT) Received: from e111045-lin.nice.arm.com ([104.133.8.102]) by smtp.gmail.com with ESMTPSA id b126sm20311847pfb.110.2019.09.03.09.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:44:05 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v2 16/17] crypto: testmgr - add test vectors for XTS ciphertext stealing Date: Tue, 3 Sep 2019 09:43:38 -0700 Message-Id: <20190903164339.27984-17-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190903164339.27984-1-ard.biesheuvel@linaro.org> References: <20190903164339.27984-1-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Import the AES-XTS test vectors from IEEE publication P1619/D16 that exercise the ciphertext stealing part of the XTS algorithm, which we haven't supported in the Linux kernel implementation up till now. Tested-by: Pascal van Leeuwen Signed-off-by: Ard Biesheuvel --- crypto/testmgr.h | 60 ++++++++++++++++++++ 1 file changed, 60 insertions(+) -- 2.17.1 diff --git a/crypto/testmgr.h b/crypto/testmgr.h index ef7d21f39d4a..86f2db6ae571 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -15291,6 +15291,66 @@ static const struct cipher_testvec aes_xts_tv_template[] = { "\xc4\xf3\x6f\xfd\xa9\xfc\xea\x70" "\xb9\xc6\xe6\x93\xe1\x48\xc1\x51", .len = 512, + }, { /* XTS-AES 15 */ + .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" + "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" + "\xbf\xbe\xbd\xbc\xbb\xba\xb9\xb8" + "\xb7\xb6\xb5\xb4\xb3\xb2\xb1\xb0", + .klen = 32, + .iv = "\x9a\x78\x56\x34\x12\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10", + .ctext = "\x6c\x16\x25\xdb\x46\x71\x52\x2d" + "\x3d\x75\x99\x60\x1d\xe7\xca\x09" + "\xed", + .len = 17, + }, { /* XTS-AES 16 */ + .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" + "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" + "\xbf\xbe\xbd\xbc\xbb\xba\xb9\xb8" + "\xb7\xb6\xb5\xb4\xb3\xb2\xb1\xb0", + .klen = 32, + .iv = "\x9a\x78\x56\x34\x12\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11", + .ctext = "\xd0\x69\x44\x4b\x7a\x7e\x0c\xab" + "\x09\xe2\x44\x47\xd2\x4d\xeb\x1f" + "\xed\xbf", + .len = 18, + }, { /* XTS-AES 17 */ + .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" + "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" + "\xbf\xbe\xbd\xbc\xbb\xba\xb9\xb8" + "\xb7\xb6\xb5\xb4\xb3\xb2\xb1\xb0", + .klen = 32, + .iv = "\x9a\x78\x56\x34\x12\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12", + .ctext = "\xe5\xdf\x13\x51\xc0\x54\x4b\xa1" + "\x35\x0b\x33\x63\xcd\x8e\xf4\xbe" + "\xed\xbf\x9d", + .len = 19, + }, { /* XTS-AES 18 */ + .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" + "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" + "\xbf\xbe\xbd\xbc\xbb\xba\xb9\xb8" + "\xb7\xb6\xb5\xb4\xb3\xb2\xb1\xb0", + .klen = 32, + .iv = "\x9a\x78\x56\x34\x12\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13", + .ctext = "\x9d\x84\xc8\x13\xf7\x19\xaa\x2c" + "\x7b\xe3\xf6\x61\x71\xc7\xc5\xc2" + "\xed\xbf\x9d\xac", + .len = 20, } };