Message ID | 20161104160417.18155.32963.stgit@taos (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show
Return-Path: <linux-crypto-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2298D6022E for <patchwork-linux-crypto@patchwork.kernel.org>; Fri, 4 Nov 2016 16:04:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1445E2B189 for <patchwork-linux-crypto@patchwork.kernel.org>; Fri, 4 Nov 2016 16:04:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0913F2B1BC; Fri, 4 Nov 2016 16:04:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A39A2B189 for <patchwork-linux-crypto@patchwork.kernel.org>; Fri, 4 Nov 2016 16:04:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935303AbcKDQEc (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Fri, 4 Nov 2016 12:04:32 -0400 Received: from mail-by2nam01on0040.outbound.protection.outlook.com ([104.47.34.40]:29632 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935059AbcKDQEb (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Fri, 4 Nov 2016 12:04:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FJk30icZlcytWCClg2YOIz/dBbeNDpY6DLFymvQHTjs=; b=eCIopiLEhxMjg8BKOxxTPtn3Esn862FtZ2ZGGoHGje6MmpynAp3fW9s2/7A95eKi9mdtFmlLCdyw01hjCFu/uPBySSKM8pOl+Ga1gDUMo1Ymx9Qf6ua+FiVKv5qBm1gbovMpq6XTe1N4mfBkOGnAF8g40Wmgw8L1oRVeLraIIuc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by BN6PR12MB1394.namprd12.prod.outlook.com (10.168.228.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Fri, 4 Nov 2016 16:04:28 +0000 Subject: [PATCH V2 5/9] crypto: Move RSA+MPI constructs into an #include file From: Gary R Hook <gary.hook@amd.com> To: <linux-crypto@vger.kernel.org> CC: <thomas.lendacky@amd.com>, <herbert@gondor.apana.org.au>, <davem@davemloft.net> Date: Fri, 4 Nov 2016 11:04:17 -0500 Message-ID: <20161104160417.18155.32963.stgit@taos> In-Reply-To: <20161104160140.18155.75618.stgit@taos> References: <20161104160140.18155.75618.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR18CA0043.namprd18.prod.outlook.com (10.173.208.29) To BN6PR12MB1394.namprd12.prod.outlook.com (10.168.228.140) X-MS-Office365-Filtering-Correlation-Id: 3d52277f-e002-4982-8631-08d404cc41e0 X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 2:JQjwLKpvYQnoT5edY/i3uStzbR86zfmPK7jnv9eC2UyFgd5HBx2nO2KsFto8UM9FllrnmeDepeo4IhcmJp4NhKjuTq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; 20:fD9OGWLT7JYTPmlXnZ6iemLyrrqie3XamR+wDWy/VABw4jk6esmtj7NQSuZPEcr2JjTHXhUWKv2IyNSjAYK5BeQz4bJ6dUCN5EFmSsheen619B/BQHa5l0K6xf1bv1lnEDW/R17ut6V1XlniTTcXNyo2/emW0sRCk7XuN/xjVg521v7rRAGbZprylslLfdCocIG38C5Pbh+ESdforp+KnUTqft+Im88JIwIF5x1a0ld9C7ej2J2+P+ff3ss2SllWCL9/eObzliQzlSHWzEfOzX1HwyTPas/7KhTL4Ay7Ra/CITJsvB04PLPacu//XyLoxWEhe7OJtFs6h7wj1d8XZ5HI0KBQnmL32/go1PkelX5a1qahwNHff69qBN+jc0fhVW5ADQTMT6n+Es49FX5Wn5BYR7s2EuEijFGhafB2C/yZqzcUSvAx0T193Xugn0ZOSKj3hwo/T140EhkUm07xTjh1YJp49Xlw/9Cy7RWwUH7/mu6r7to+zsAT2E06Qv5q X-Microsoft-Antispam-PRVS: <BN6PR12MB1394835E4217AD6242F09463FDA20@BN6PR12MB1394.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BN6PR12MB1394; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1394; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 4:lcBzx21fKjzNxfChIDvqqQNmLBHgX9leHxaEcJMR8x6hTkKrDgVa+9+vnwvTpCLHDzGFi1cGGWemdRmacHXfxkorPxc2K+JiuwNllsu+Q/gDqsKCCcccrg1voV9m/AclvEBTouYt2N1GxnR/cXlUFLE9E+jMHE6yK9vVSJ79zaij7OoDclagkGmiGYgLaVW6uZXdNBo6w23uTh1iXWOcIzgDY67voGcQtbV0zuFgE3+kNCd8ruS/X0lStxeNJ+sskXiyz/qklbBm9J0vxoMrlnQssSp/e3lOOE3lTeHslDQBNQCO3SsbmgRb8DuRF9WC0+qR94LTMI26KzBBFMCqfDNHTVQiIGd+cgLoZm0XUg0MOuJgWbTEOIbp35dc0N7b7VunSfYDtNPA8s7znv6P4djbghOGhK7o/hiE5KhSm5Csx5eqbJ0SOHp5CrzvviyGw8zbudtk7k9ru/otqv+HFQ== X-Forefront-PRVS: 01165471DB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(189002)(199003)(86362001)(77096005)(47776003)(66066001)(50466002)(19580405001)(19580395003)(9686002)(4326007)(189998001)(83506001)(8676002)(6666003)(92566002)(2906002)(103116003)(81166006)(81156014)(6916009)(2950100002)(68736007)(42186005)(3846002)(586003)(54356999)(33646002)(105586002)(4001350100001)(97746001)(305945005)(230700001)(33716001)(50986999)(23676002)(7736002)(110136003)(97736004)(7846002)(2351001)(106356001)(229853001)(101416001)(6116002)(5660300001)(76176999)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1394; H:[10.236.19.42]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMzk0OzIzOnhuM2VxSFFQL3F4QUxPRnhCTS8vUEhoMkdw?= =?utf-8?B?OFdSVCtLOG5RMnFMWnZHdy9lNjNVSXNYYXFqU0ZGck1mYVMrRGtuK2lKdUZ5?= =?utf-8?B?bXhORkFRa3JqQzlPd1JSN1lIZVVLWVN3WTV2YlFZTWtOdXV1a1pjSTA2ME5K?= =?utf-8?B?YVkzVkw2Ym1nYzVwV2IvRFFDYld6bTkxbm5yaVBPbU1mcDA0bWRtNkc5REN4?= =?utf-8?B?aWdGMjNoT0RGYnkvL3UwSE16NmRoQUxtV0NjMXl1RDBiZ3BsTjhBbnpWVktS?= =?utf-8?B?dnVLeUJGOUIrQVVUSkdxekdZR3loOG9EYUc3Z1dUay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ZMtG57595HeTfMp2S6btQHB/3ZMGlFw3y7b3/2/qd4Xg28ubGSYDAJtebx1ZNzWU1pBf9FIiMkM/8in+hIoS5jMTWbKtXlFDfaOw=; 24:vUqgZUqYzJtbhqryiczGw7Obl83ioTAghVtg3QBNxsfN/JHUV03uqFwbwamPIVG3wuFOWDrX1+e7O/+F33wEABz5KVxzq3u6SHJm3X/ZSaI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 7:MyUN3Dk5Vi+Mby6cTh8tlT8FZN+gw3ghQUUbQ870C9SXQEP0k/GL21Ye1ebh+QQszyiVZtgb7UhDsB4CzD57GujNlngDym8tiCDfNQhNs8xBaX1klZCpe0+MNxrEYxVW8RJswSX13GqpZ0BI8zL821HrQS/TuRandY8Msn/VcBfBRkpxUDb9Zmi3VQUssmFxMoOf/85xRlnmbhq4Qm9c0zIwJre82FvrWcsmHo1FdWQFkGwAWLVnpRUXRgaiy0nokiA3OjflnzDxhLNhtot1oqudEJtgq8jssBQfU/UKt/9Z1jz/6hP4X1MIS7Z9kkDsMmnHWzuLw7O1lpFgXQ3ULeaBXz17+oE41ikh1EgTM0Q=; 20:+cBPTOxi5fBZ3OX8cpPYONw6Ov04E1nQu4jAQE8EqOxmWzb6k0PN3pdezSA2H2dNLxRtEbJtc/Dstry4oDcvc1qBKTPdOreTvgYnpW/inAU9HK5dns2CKEEuWA8rXDu5ctdujaHSdsXIIClspj5t+JNXGBbidQYruBufNVazTK4ZGUEnC5dqEZF/QRamIDgP22n+aFogoFKdy1sXenjHKXKloKKsu8kPySAXb3IwqXF728YLRfhIIoCVRbHMyt+8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2016 16:04:28.7722 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1394 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: <linux-crypto.vger.kernel.org> X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/crypto/rsa.c b/crypto/rsa.c index 4c280b6..15e9220 100644 --- a/crypto/rsa.c +++ b/crypto/rsa.c @@ -16,12 +16,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; @@ -240,16 +234,6 @@ static int rsa_verify(struct akcipher_request *req) return ret; } -static void rsa_free_mpi_key(struct rsa_mpi_key *key) -{ - mpi_free(key->d); - mpi_free(key->e); - mpi_free(key->n); - key->d = NULL; - key->e = NULL; - key->n = NULL; -} - static int rsa_check_key_length(unsigned int len) { switch (len) { diff --git a/include/crypto/internal/rsa.h b/include/crypto/internal/rsa.h index 9e8f159..253b275 100644 --- a/include/crypto/internal/rsa.h +++ b/include/crypto/internal/rsa.h @@ -13,6 +13,7 @@ #ifndef _RSA_HELPER_ #define _RSA_HELPER_ #include <linux/types.h> +#include <linux/mpi.h> /** * rsa_key - RSA key structure @@ -52,6 +53,22 @@ struct rsa_key { size_t qinv_sz; }; +struct rsa_mpi_key { + MPI n; + MPI e; + MPI d; +}; + +static inline void rsa_free_mpi_key(struct rsa_mpi_key *key) +{ + mpi_free(key->d); + mpi_free(key->e); + mpi_free(key->n); + key->d = NULL; + key->e = NULL; + key->n = NULL; +} + int rsa_parse_pub_key(struct rsa_key *rsa_key, const void *key, unsigned int key_len);
RSA support of general use, but dependent upon MPI, should go into internal/rsa.h Signed-off-by: Gary R Hook <gary.hook@amd.com> --- crypto/rsa.c | 16 ---------------- include/crypto/internal/rsa.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) -- 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