From patchwork Wed Nov 11 00:58:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Zaborowski X-Patchwork-Id: 7593321 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E9F7C05CA for ; Wed, 11 Nov 2015 00:59:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65C4320631 for ; Wed, 11 Nov 2015 00:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 788CB20639 for ; Wed, 11 Nov 2015 00:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752035AbbKKA7W (ORCPT ); Tue, 10 Nov 2015 19:59:22 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:37742 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751760AbbKKA7H (ORCPT ); Tue, 10 Nov 2015 19:59:07 -0500 Received: by wmww144 with SMTP id w144so24460267wmw.0 for ; Tue, 10 Nov 2015 16:59:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=BzjTz9ry+g13t7Rq291GbY0yZwh28wgCpmjzEcWaWjs=; b=zaqm4BhOcf055E/8SQy3q+/t4lwqJ10E+48ijjSA9Vlcgj+WM+piF5sUEYwxxJ1p2x zkzta941Bo4dsJa6Pld3aDCbcTYZo1PUG3wVwlDxjlv0AHCYkIMGAaN7+Gs0LCxxVC2+ SBwg60nsZ7EaE9Wr0Odbe9kxiSByF9pbqFdBWLWYLBGUn6aGbKlTtUZJpN03rYoeW3m6 ghgY+eoCn2Of4ryDEAURaFfmAk6JaSi7VXxX2qjlvjCWt7dJf1imSHSN9LJV9vM1lhpX Te2gvDCku0EH6dAdgX8m1chojcfUKOZChBaBMj9iAjZ6Pjul86WfS4YF9D6bGWsZw/1r qgnw== X-Received: by 10.28.184.13 with SMTP id i13mr31068121wmf.31.1447203545995; Tue, 10 Nov 2015 16:59:05 -0800 (PST) Received: from localhost.localdomain (9.Red-2-136-109.dynamicIP.rima-tde.net. [2.136.109.9]) by smtp.gmail.com with ESMTPSA id lf10sm6255702wjb.23.2015.11.10.16.59.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 16:59:05 -0800 (PST) From: Andrew Zaborowski To: linux-crypto@vger.kernel.org Subject: [PATCH 3/4] crypto: akcipher: add crypto_akcipher_type methods needed by templates. Date: Wed, 11 Nov 2015 01:58:44 +0100 Message-Id: <1447203525-16796-3-git-send-email-andrew.zaborowski@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447203525-16796-1-git-send-email-andrew.zaborowski@intel.com> References: <1447203525-16796-1-git-send-email-andrew.zaborowski@intel.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add two dummy methods that are required by the crypto API internals: .ctxsize and .init (just because the framework calls them without checking if they were provided). They're only required by the complicated code path needed to instantiate a template algorithm. Also expose crypto_akcipher_type like other crypto types are exposed to be used from outside modules. Signed-off-by: Andrew Zaborowski --- crypto/akcipher.c | 16 +++++++++++++++- include/crypto/algapi.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crypto/akcipher.c b/crypto/akcipher.c index 120ec04..6ef7f99 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -53,6 +53,11 @@ static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) seq_puts(m, "type : akcipher\n"); } +static int crypto_akcipher_init(struct crypto_tfm *tfm, u32 type, u32 mask) +{ + return 0; +} + static void crypto_akcipher_exit_tfm(struct crypto_tfm *tfm) { struct crypto_akcipher *akcipher = __crypto_akcipher_tfm(tfm); @@ -75,8 +80,16 @@ static int crypto_akcipher_init_tfm(struct crypto_tfm *tfm) return 0; } -static const struct crypto_type crypto_akcipher_type = { +static unsigned int crypto_akcipher_ctxsize(struct crypto_alg *alg, u32 type, + u32 mask) +{ + return alg->cra_ctxsize; +} + +const struct crypto_type crypto_akcipher_type = { + .ctxsize = crypto_akcipher_ctxsize, .extsize = crypto_alg_extsize, + .init = crypto_akcipher_init, .init_tfm = crypto_akcipher_init_tfm, #ifdef CONFIG_PROC_FS .show = crypto_akcipher_show, @@ -87,6 +100,7 @@ static const struct crypto_type crypto_akcipher_type = { .type = CRYPTO_ALG_TYPE_AKCIPHER, .tfmsize = offsetof(struct crypto_akcipher, base), }; +EXPORT_SYMBOL_GPL(crypto_akcipher_type); struct crypto_akcipher *crypto_alloc_akcipher(const char *alg_name, u32 type, u32 mask) diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index c9fe145..1089f20 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -130,6 +130,7 @@ struct ablkcipher_walk { extern const struct crypto_type crypto_ablkcipher_type; extern const struct crypto_type crypto_blkcipher_type; +extern const struct crypto_type crypto_akcipher_type; void crypto_mod_put(struct crypto_alg *alg);