From patchwork Thu Nov 24 15:43:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 83946 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp227649obn; Thu, 24 Nov 2016 07:44:35 -0800 (PST) X-Received: by 10.99.100.132 with SMTP id y126mr5211457pgb.177.1480002275933; Thu, 24 Nov 2016 07:44:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si15962642pgk.253.2016.11.24.07.44.35; Thu, 24 Nov 2016 07:44:35 -0800 (PST) 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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966610AbcKXPoe (ORCPT + 1 other); Thu, 24 Nov 2016 10:44:34 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36740 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966618AbcKXPoc (ORCPT ); Thu, 24 Nov 2016 10:44:32 -0500 Received: by mail-wm0-f48.google.com with SMTP id g23so118687143wme.1 for ; Thu, 24 Nov 2016 07:44:32 -0800 (PST) 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=so8uhfs6q6x23DKpjSqzcG8ynMIXQLDid01F/0KQXl4=; b=NcQJa4JaRIVbQGLKe/VJ9JAEvl4rODbHA05gABh09XkbknVYmaZRbAOiGO6SSI+SEl btU2qyB02543OU57p3ygtX/+VNyEWM5fc6Z6BwwvYNVOWlB1tq/A7OgLOUW1VZglWTOg QPzBd6oNKoC+a5GcSUO7IICrN0AX2+b9w+nAI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=so8uhfs6q6x23DKpjSqzcG8ynMIXQLDid01F/0KQXl4=; b=OLdc8vQ7QrVd8ofT8KYPJXxOhh8Rb3W/UlUhIMMgADZjF9Gg5+JqOFQ5oSn5d0g+IT XN+1hXwB9+VbqDrKgqxAQ3/0YYHJYGjFdydvxlpYLu0xJUdZDk9pknvBXbIlEPqB03YU Yk7Nx0cPBCsfybK2Oo5oPulIFNjHJiMI1WRRVB55ytpCy9JYzG+Tsz16XQq+twQxubYh XNCr9pvuR8OH0GqE6wUlhjbh4kBfQ1KYKslHFwMMSUzAEf92/U8DeEubIBAI+qbDtE4b QAa86mIrFIHsz3jsrXuJCaSV9tF6Bfg3NtJSG3abH/rottVWcHaGsR38Z+2DhO/JkrJI 9ucg== X-Gm-Message-State: AKaTC024NQgfLF62l/70Slv21wbmVmQKyWobLVtj7R0kZURFzPCVbCsG+qnKR1SocomR49lV X-Received: by 10.28.95.85 with SMTP id t82mr2799599wmb.56.1480002271402; Thu, 24 Nov 2016 07:44:31 -0800 (PST) Received: from localhost.localdomain ([160.163.23.103]) by smtp.gmail.com with ESMTPSA id c187sm8813797wmd.13.2016.11.24.07.44.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Nov 2016 07:44:30 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, linux@arm.linux.org.uk Cc: steve.capper@linaro.org, dingtianhong@huawei.com, yangshengkai@huawei.com, yuehaibing@huawei.com, hanjun.guo@linaro.org, Ard Biesheuvel Subject: [PATCH 2/4] crypto: testmgr - add/enhance test cases for CRC-T10DIF Date: Thu, 24 Nov 2016 15:43:19 +0000 Message-Id: <1480002201-1427-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480002201-1427-1-git-send-email-ard.biesheuvel@linaro.org> References: <1480002201-1427-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The existing test cases only exercise a small slice of the various possible code paths through the x86 SSE/PCLMULQDQ implementation, and the upcoming ports of it for arm64. So add one that exceeds 256 bytes in size, and convert another to a chunked test. Signed-off-by: Ard Biesheuvel --- crypto/testmgr.h | 70 ++++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/crypto/testmgr.h b/crypto/testmgr.h index e64a4ef9d8ca..b7cd41b25a2a 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -1334,36 +1334,50 @@ static struct hash_testvec rmd320_tv_template[] = { } }; -#define CRCT10DIF_TEST_VECTORS 3 +#define CRCT10DIF_TEST_VECTORS ARRAY_SIZE(crct10dif_tv_template) static struct hash_testvec crct10dif_tv_template[] = { { - .plaintext = "abc", - .psize = 3, -#ifdef __LITTLE_ENDIAN - .digest = "\x3b\x44", -#else - .digest = "\x44\x3b", -#endif - }, { - .plaintext = "1234567890123456789012345678901234567890" - "123456789012345678901234567890123456789", - .psize = 79, -#ifdef __LITTLE_ENDIAN - .digest = "\x70\x4b", -#else - .digest = "\x4b\x70", -#endif - }, { - .plaintext = - "abcddddddddddddddddddddddddddddddddddddddddddddddddddddd", - .psize = 56, -#ifdef __LITTLE_ENDIAN - .digest = "\xe3\x9c", -#else - .digest = "\x9c\xe3", -#endif - .np = 2, - .tap = { 28, 28 } + .plaintext = "abc", + .psize = 3, + .digest = (u8 *)(u16 []){ 0x443b }, + }, { + .plaintext = "1234567890123456789012345678901234567890" + "123456789012345678901234567890123456789", + .psize = 79, + .digest = (u8 *)(u16 []){ 0x4b70 }, + .np = 2, + .tap = { 63, 16 }, + }, { + .plaintext = "abcdddddddddddddddddddddddddddddddddddddddd" + "ddddddddddddd", + .psize = 56, + .digest = (u8 *)(u16 []){ 0x9ce3 }, + .np = 8, + .tap = { 1, 2, 28, 7, 6, 5, 4, 3 }, + }, { + .plaintext = "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "123456789012345678901234567890123456789", + .psize = 319, + .digest = (u8 *)((u16 []){ 0x44c6 }), + }, { + .plaintext = "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "123456789012345678901234567890123456789", + .psize = 319, + .digest = (u8 *)((u16 []){ 0x44c6 }), + .np = 4, + .tap = { 1, 255, 57, 6 }, } };