Message ID | 20210408141516.11369-11-varad.gautam@suse.com |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-crypto-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3598DC43461 for <linux-crypto@archiver.kernel.org>; Thu, 8 Apr 2021 14:17:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FB6861166 for <linux-crypto@archiver.kernel.org>; Thu, 8 Apr 2021 14:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbhDHORQ (ORCPT <rfc822; linux-crypto@archiver.kernel.org>); Thu, 8 Apr 2021 10:17:16 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:42395 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232020AbhDHORE (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Thu, 8 Apr 2021 10:17:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1617891412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GNjWFjXDejG3E3NOFeXgEdrLskVD3XbvsnvqDZWR808=; b=g4UDDcP2ukwnlYhwsUKrGcP9yi8KFgnA80ksf6Ih0E8lwSGP2mAKhKNhapAO2SC+Lmykv+ vRbFekr46+1BNEY18CV2Uh4NJtHjG4fwt7HMgoCwqat0a9pw87MwZou5CPmbBo44yTtlJK LQVnEHxdHyMT/DR4AmVB2gPyjtiUebg= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2111.outbound.protection.outlook.com [104.47.17.111]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-17-tzzGxpx3PxiplTRQhzGM0w-1; Thu, 08 Apr 2021 16:16:41 +0200 X-MC-Unique: tzzGxpx3PxiplTRQhzGM0w-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k4eRUcO0eZYlL09iU6KtToXdJ4ZY0+nEjBNx1Bvx6wSH8LzrOFd1I1VpZKwjPT9tBWFmkB8S8ULYjIkUApm9gTA4AokGAm4aHCyK93fdo2jKMn7yYKdDzTU8e0Yqh/GMCdteU/JmLrnvxzlB1v7G+6kP9rSxL0T2ncUALPWCwlug8OSNLO34hZ/mV3+ilPCW1cKN6V3m6gddRlnXkzENVE5zVAMe5CGhLmTKyH+XT4RfqImVpqBuz3KgOKvHK1wHqMdYZVlMGxxAdGHgmkFuATxzYjESXhOU/mNGUX9CxQBTwagtlOAD19RlUvvoof1+XzMht3RXa2L+hwuNAI1mZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1F0kTH773gbCKICjeT11lBBAalcITmZBWtl2W9LJ9fA=; b=HWdk5RFZM0hUCtWCyj0JvLNbPbjVgF6E+CH5r8orBt/SIwtjMK9fsRanGN/AD1UOFhi9aOCkIMWzyTgyQ5UZzJ9/3scvrv1kcrFayHzP8+PXvIV7tBv6PfRbK4Zrt1fd6+eAFfmbtrf+SmCYY+gKdTXHb1B0bUh4DJzDPkSAs0wEZngj/IBCG9hiLUQ4TxQR50GpjGwP8BxAHjEcwiBZqVLM0Jq3Cd78mAuBDp2D7trv0cQAJZU0tKLXlfPb9hvxAPmYvyZ4fKdAHM36+b8Op8Vcm9TZGocdB/CgnaEpV/C67dOGwunGCWKd19tYk1ORX9A4bEv/Vs8N2YbinqHV0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=suse.com; Received: from AM0PR04MB5650.eurprd04.prod.outlook.com (2603:10a6:208:128::18) by AM0PR0402MB3572.eurprd04.prod.outlook.com (2603:10a6:208:22::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Thu, 8 Apr 2021 14:16:39 +0000 Received: from AM0PR04MB5650.eurprd04.prod.outlook.com ([fe80::756a:86b8:8283:733d]) by AM0PR04MB5650.eurprd04.prod.outlook.com ([fe80::756a:86b8:8283:733d%6]) with mapi id 15.20.3999.032; Thu, 8 Apr 2021 14:16:38 +0000 From: Varad Gautam <varad.gautam@suse.com> To: linux-crypto@vger.kernel.org CC: varad.gautam@suse.com, dhowells@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, vt@altlinux.org, tianjia.zhang@linux.alibaba.com, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, jarkko@kernel.org Subject: [PATCH v2 10/18] crypto: rsa: Move struct rsa_mpi_key definition to rsa.h Date: Thu, 8 Apr 2021 16:15:08 +0200 Message-ID: <20210408141516.11369-11-varad.gautam@suse.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210408141516.11369-1-varad.gautam@suse.com> References: <20210408141516.11369-1-varad.gautam@suse.com> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Originating-IP: [95.90.93.216] X-ClientProxiedBy: ZR0P278CA0137.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::16) To AM0PR04MB5650.eurprd04.prod.outlook.com (2603:10a6:208:128::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xps13.suse.cz (95.90.93.216) by ZR0P278CA0137.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Thu, 8 Apr 2021 14:16:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b188372c-d210-49f0-409b-08d8fa98e4c3 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3572: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <AM0PR0402MB3572016A0297DB46D9581A62E0749@AM0PR0402MB3572.eurprd04.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OlBx+Wc6ab3amZM6/UjZu/ku1nclB3CuRlGg73UbFPiJMnd0jHAJZs5A4vnLxFFVM4P2TmcbkP3nWq8HN9d0qkQUIBRHBTNNmrfY73wV89vhfvQqFIMey0KYhda+mafShP/5qT1JePMBzZtIlDzNTG/8R8RkXtv0kyIGxTrdzCOX72EpyQYbcPQSkrpa+0X+eTMKLDESirFlEoA6v4g/j6537XEVLj4OCrdMhmgRDFGIdwdzaRZZJFWEx1tCmWyxiPEXVrfmcnh+XOpwC1t29eiGBY7IpD4kutqHm0InjeuTcuGSj6VItMGlXXQC/9GHSH09/umfqqRIJ6sti1iYBW+uEIZJ096+wsrMVlxART2TdBitIvfrGBgKBKXrGAz6IxsQ372vDpDE3FSiSxMlNLs0vhxxRjAJLaq1yYg5iaC4puzP9tvILZ+TgShEoR7Hf7PAxYbpSJPuQ8xD5Ew59U0MfVb4SSKg/y/+XO4gkPCISET99hg/RfP5pPMGAjqgedQNidnEsfqS9uk+5gowrGL2GszdFLDanV/3K/uhXHwPIQ+Bj6eSM6BSy2jF/FayDkF5KzkZsmODTN0XWy7LxNUhbumxf+jm7YL4ZGyaUR0udEMwJ9nESYCDp/ltNcvnoJp3Kfvr551T4otnKi8XUk+y66ib3ZMHh1Zky19n0jXZ1OtvETFtPGhevsz9Qmkp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5650.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(396003)(376002)(346002)(366004)(16526019)(186003)(38100700001)(2616005)(956004)(38350700001)(52116002)(6512007)(2906002)(36756003)(44832011)(6916009)(83380400001)(6666004)(8936002)(26005)(66476007)(66556008)(66946007)(4326008)(316002)(1076003)(6506007)(6486002)(478600001)(5660300002)(86362001)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DvZaCPiSTkPaEKq3kyJp4YL3PJZB9xvjIh1eYvdzmbkVXSBRhKkC7yzKJ/GUY+40ZfPpmKoauAjGAT5/ZjnSqbl0HVpPit/syO/nbO+1twWbl+JaouR2UtunwxhXJ+qty62uLyS3pkrKAw8E3WuKIkoJg3hSKUJHU+ploJbYP82laqhTaN/jvB7gRTR9qsrOzzeuLVl05O12cqOdc8ByE26kw8wHsDT7iAmxPsIaEyj/1OtBiclNicEwBq6faGOCqi0Pq2GP7041XUbUUl8NGc3xf8Xf/nt8shnykA7VdouVPQnGIcf0KrsbAH8E+lqL/e8/0WO3sVXbyRVntI0pIFz1wluCp1zFKS+8mm4LcKCoBCmEsXaPq5bJpcYPEKNx/5wmdQtrzhPgV0r+fp23fOZ1wWKZn2KIowFSM/RUFKM4jrpuP/VFQwESudUGZgh4lDdhYW4BPTFHzKo0Ngy2rGkmr8Hfty3qg8D3qDevkKa3f+1iRSxLAccD2kz233qVp439XaSkQSfNLcdzdjO8NpA/STHA/Bkhi19uZppwmXB2quPY9LDgvFi3oS78wIg3W7lE9XRnNiSFFtjWoZ/Ecci85TaSsRFxMvh6AM8PbdCSSLtqAd8SzCGtFikU4mocwJnNfDVXDsxUSDmtjG/HaRWdCTeNquKTiCdykRU59qBDsiciPIA/ocbEHtseFv0IYO2d/OYtOv9F7hhd8fkDmtClY3Ifq0VjPzADtWbYFoI0Aku19baQ7UdMVZAJ4s73n7uZpssjHLk3TllDzCR4/j+tSZdI8TGlLltnd6M2j+R3e0mTedlA3LxhIpF1f/5+a0IGbftY9GalF7D/zkz4QQ34CclSsyTVU0+g94v26BOPzCa4PudD9ewChCMD7mm2tCdJOWqHMSkuKk7SKnYTeDOaZT2/OWrq05zZZJUWSzR/QM7X1bg3ZMxwpG4Znr6v5otPpCjX6K8fGy7eRMu1pFv3gHJ17XGIntIa7QSmdX2vEMhIZ26qgCzFrNMDsCZZOVfYIR3yNGIG/0gjau71B60Dm11hLCS4j39pDYxRrqhZocHOnQDsqVs73+diPEsNSV7o9Zwtn2QymZ1/f73BmEgvy4Ns6IzkRu/JBqDqFvCibyI/oGWvG07NDn4Z/0b7ivtEqxtghqsBRzrfqwrfeKFOrUkfj4wsvVZ5JUnS7/MURSsS/Qy9tr5ZL24/L8PLErwomBVnHdXHfStxkge1h9lhqDX775cIk+60xKsBDIq42F6n8qevHQq/cLc9pD15ikx2ysmWkrT4wZp15jzdS7NxupYTN/MVkqhl1Dxk26A5sO9o+jG1S0hKlUUrLE1i X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b188372c-d210-49f0-409b-08d8fa98e4c3 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2021 14:16:35.9998 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: loys/0cRTDZ3gzOhEFXaWVi7IAWymzdnypOG445DyD63wVwBhqIaCrjSUdZt8TeOkoR0SqoF3sIStCteYon64A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3572 Precedence: bulk List-ID: <linux-crypto.vger.kernel.org> X-Mailing-List: linux-crypto@vger.kernel.org |
Series |
Implement RSASSA-PSS signature verification
|
expand
|
diff --git a/crypto/rsa.c b/crypto/rsa.c index 4cdbec95d0779..5c4eece5b8028 100644 --- a/crypto/rsa.c +++ b/crypto/rsa.c @@ -12,12 +12,6 @@ #include <crypto/akcipher.h> #include <crypto/algapi.h> -struct rsa_mpi_key { - MPI n; - MPI e; - MPI d; -}; - /* * RSAEP function [RFC3447 sec 5.1.1] * c = m^e mod n; diff --git a/include/crypto/internal/rsa.h b/include/crypto/internal/rsa.h index e870133f4b775..e73c61f788e68 100644 --- a/include/crypto/internal/rsa.h +++ b/include/crypto/internal/rsa.h @@ -7,6 +7,7 @@ */ #ifndef _RSA_HELPER_ #define _RSA_HELPER_ +#include <linux/mpi.h> #include <linux/types.h> /** @@ -53,5 +54,11 @@ int rsa_parse_pub_key(struct rsa_key *rsa_key, const void *key, int rsa_parse_priv_key(struct rsa_key *rsa_key, const void *key, unsigned int key_len); +struct rsa_mpi_key { + MPI n; + MPI e; + MPI d; +}; + extern struct crypto_template rsa_pkcs1pad_tmpl; #endif
The RSASSA-PSS signature scheme requires knowing the RSA modulus size in bits. The rsa akcipher_alg max_size call is insufficient for this, as the returned keysize is rounded up to the next byte. Since the RSA modulus is stored as an MPI accessible via struct rsa_mpi_key, move the struct definition to rsa.h to help RSA sub-implementations query the MPI values. Signed-off-by: Varad Gautam <varad.gautam@suse.com> --- crypto/rsa.c | 6 ------ include/crypto/internal/rsa.h | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-)