Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp261149ybv; Wed, 12 Feb 2020 23:42:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxedIBa5/2KdWmJ+8hqdvJEN076RKBqtkeyyrLmxAS88kR9HrlSxOylNmK8tG/CFFeDRWwy X-Received: by 2002:a54:480c:: with SMTP id j12mr1975910oij.130.1581579723905; Wed, 12 Feb 2020 23:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581579723; cv=none; d=google.com; s=arc-20160816; b=WVtUJufnO8SI6awIg8VgVwGmmHvI8axksGmIAu8rnCOA6p/KoAJOYxMGV+TRiUDMKT E3nFdQBMcmDKEGRpyc8BirOl5NRqAb2Rg3eNetZaZyiWZm6qlhvAzwHuQephXa2SuNbv mgbr+4pRr1GG0yxvb6GJrQHuv/hLvLC8Ej7P1l1QV2H6cDGYluhZfB4ffDjui8x+bp/d 1n+3MS3e3X42ZnMwaUNkdCfRnppg8OlrGjsBnANEXJZ7AEdLsvpFCMBJDobDNfb2iEbV HLnBVIzPMqZN+7AbW3N8qmcvQjawfd3c5vqPg5THm1E+5LPBtrmzx07n8kncfwWRqGTZ qdHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:cc:to:references:subject; bh=pp6PxzkjDKHUr2xu5ogz5cvJwpjCTKJqGnZss/uP8RY=; b=JgdHkPfnslM7Zq44VXSJiG/FeNH5wmOq5DQdK86DMvogrQBrZL9Ans2izS8m43PiVE 1nzZ8XiMTYyrRC4pkLeTK8e6W0dtQpWLKnyXNc8iW+YQyUIU1/eQkMVPtTZSur3HR03i sWVEVznbD2aUbcJO0X+QjiybOjzIdYZsCSSxrCJOgXudYwZZ/nm5eKkAlNTpsr2M3MB4 UsRtfjpxc2pU1gBpQqyef9ngJdE7dD7hiRms+7uETOhDAFSyl9wECRAPgpKKJsSdVEQO yLLsXIVuwVUkoD+3By+SGCY9+/IVyyENBbMEAngU9bOcGdlh+nJEBasn/ReIwV/coPMv aI8A== ARC-Authentication-Results: i=1; mx.google.com; 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 sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si732981otv.149.2020.02.12.23.41.43; Wed, 12 Feb 2020 23:42:03 -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; 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 sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729706AbgBMHkN (ORCPT + 99 others); Thu, 13 Feb 2020 02:40:13 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33396 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729803AbgBMHkN (ORCPT ); Thu, 13 Feb 2020 02:40:13 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01D7bJBi114699 for ; Thu, 13 Feb 2020 02:40:12 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y4qyak2ce-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 13 Feb 2020 02:40:11 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Feb 2020 07:40:10 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 13 Feb 2020 07:40:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01D7e7hc47054972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Feb 2020 07:40:07 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1524A42047; Thu, 13 Feb 2020 07:40:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE5B442042; Thu, 13 Feb 2020 07:40:06 +0000 (GMT) Received: from funtu.home (unknown [9.152.224.114]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 13 Feb 2020 07:40:06 +0000 (GMT) Subject: [PATCH] crypto/testmgr: add selftests for paes-s390 References: <20191113105523.8007-4-freude@linux.ibm.com> To: "linux-crypto@vger.kernel.org" , Herbert Xu Cc: Heiko Carstens , Vasily Gorbik From: Harald Freudenberger X-Forwarded-Message-Id: <20191113105523.8007-4-freude@linux.ibm.com> Date: Thu, 13 Feb 2020 08:40:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20191113105523.8007-4-freude@linux.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 20021307-0012-0000-0000-0000038664AC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021307-0013-0000-0000-000021C2E6E2 Message-Id: <2391ff22-97be-bc6a-3650-3cade8a78393@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-13_01:2020-02-12,2020-02-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 mlxlogscore=901 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002130059 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch enables the selftests for the s390 specific protected key AES (PAES) cipher implementations: ? * cbc-paes-s390 ? * ctr-paes-s390 ? * ecb-paes-s390 ? * xts-paes-s390 PAES is an AES cipher but with encrypted ('protected') key material. However, the paes ciphers are able to derive an protected key from clear key material with the help of the pkey kernel module. So this patch now enables the generic AES tests for the paes ciphers. Under the hood the setkey() functions rearrange the clear key values as clear key token and so the pkey kernel module is able to provide protected key blobs from the given clear key values. The derived protected key blobs are then used within the paes cipers and should produce the very same results as the generic AES implementation with the clear key values. The s390-paes cipher testlist entries are surrounded by #if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) because they don't make any sense on non s390 platforms or without the PAES cipher implementation. Signed-off-by: Harald Freudenberger Signed-off-by: Vasily Gorbik --- ?crypto/testmgr.c | 36 ++++++++++++++++++++++++++++++++++++ ?1 file changed, 36 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 82513b6b0abd..6c4a98102825 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4156,6 +4156,15 @@ static const struct alg_test_desc alg_test_descs[] = { ???? ??? ??? .cipher = __VECS(tf_cbc_tv_template) ???? ??? }, ???? }, { +#if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) +??? ??? .alg = "cbc-paes-s390", +??? ??? .fips_allowed = 1, +??? ??? .test = alg_test_skcipher, +??? ??? .suite = { +??? ??? ??? .cipher = __VECS(aes_cbc_tv_template) +??? ??? } +??? }, { +#endif ???? ??? .alg = "cbcmac(aes)", ???? ??? .fips_allowed = 1, ???? ??? .test = alg_test_hash, @@ -4304,6 +4313,15 @@ static const struct alg_test_desc alg_test_descs[] = { ???? ??? ??? .cipher = __VECS(tf_ctr_tv_template) ???? ??? } ???? }, { +#if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) +??? ??? .alg = "ctr-paes-s390", +??? ??? .fips_allowed = 1, +??? ??? .test = alg_test_skcipher, +??? ??? .suite = { +??? ??? ??? .cipher = __VECS(aes_ctr_tv_template) +??? ??? } +??? }, { +#endif ???? ??? .alg = "cts(cbc(aes))", ???? ??? .test = alg_test_skcipher, ???? ??? .fips_allowed = 1, @@ -4596,6 +4614,15 @@ static const struct alg_test_desc alg_test_descs[] = { ???? ??? ??? .cipher = __VECS(xtea_tv_template) ???? ??? } ???? }, { +#if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) +??? ??? .alg = "ecb-paes-s390", +??? ??? .fips_allowed = 1, +??? ??? .test = alg_test_skcipher, +??? ??? .suite = { +??? ??? ??? .cipher = __VECS(aes_tv_template) +??? ??? } +??? }, { +#endif ???? ??? .alg = "ecdh", ???? ??? .test = alg_test_kpp, ???? ??? .fips_allowed = 1, @@ -5167,6 +5194,15 @@ static const struct alg_test_desc alg_test_descs[] = { ???? ??? ??? .cipher = __VECS(tf_xts_tv_template) ???? ??? } ???? }, { +#if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) +??? ??? .alg = "xts-paes-s390", +??? ??? .fips_allowed = 1, +??? ??? .test = alg_test_skcipher, +??? ??? .suite = { +??? ??? ??? .cipher = __VECS(aes_xts_tv_template) +??? ??? } +??? }, { +#endif ???? ??? .alg = "xts4096(paes)", ???? ??? .test = alg_test_null, ???? ??? .fips_allowed = 1, -- 2.17.1