Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2438006ybx; Fri, 8 Nov 2019 04:24:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwsbYicDVIsDrJZISTqMEP1y0eFbqRQVuALqbr+L5gvYRPXpqUoQoWqHMlXgdF2kSxsa3u6 X-Received: by 2002:a17:906:4697:: with SMTP id a23mr8199393ejr.322.1573215880279; Fri, 08 Nov 2019 04:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573215880; cv=none; d=google.com; s=arc-20160816; b=KCB9y/WcL+DNqo3cTBmvVoBEnMzXe6VTYAM9GejhTr1fQOApy4BtvltnsGtH62gd1z yikcwHJ7J/W7C6CoFdWevvjoq4wIYcfbMDCgmGUYfZCZ9gqa7p6pwgnYe7Musvv1pTK2 tMntOGOzcro1TjSt/oJF3NuaSeH4jPqU7OrcCBXkRy5mStjeY/M3/3Tw+Np5GEWQWYPu 8f5qXOCfB7g1y/rfLfeP3vxJ8qwHoJB6oP4ygPZQJ5Bxvb2cM3eI1kEOcUjFtar713zc R/C/+R3phS5IwgYDExbKkz3PdwY7QsZs7dtfAd154yMnwC6HkJVSMjzn0m+e1Wp2I9J6 yFwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+/QhzI3wQ4EyW1asfk02UCT4ZF5apsqs4Am0kLzg3lA=; b=RPyEdmYH6380Gp1VXiZVR7MH5bjWPtPTpCnXN9p7GYgnHxcD+F/klJ3PPeIbdzDMrN +noJ65aGvTYlfGuSPbCN/BfDpH4YakYyw7eoJh3o/YE42ymkUNuq/RrDJsrJ+az3O0vH xW3wduvOu6t0WZ15kOFZBIKyg8Rp6M4K16NND0bLKyJQndt67Sx/dXiGlXTMMIntf6eU A5zeYQyPnB7bnSBvrcArkpSl6BSL60g7Mzgzl3o8WzZir8UYE8lD2tV+t3van2+f/dJA QA28Kgd3cssVEBJKJl0WCoscIdMwyqF/OSsmfJb9PVSKGTXmLxnYOHPnUHusGDho3RgD czxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HjyIgiTA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nf6si3477882ejb.406.2019.11.08.04.24.16; Fri, 08 Nov 2019 04:24:40 -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=pass header.i=@kernel.org header.s=default header.b=HjyIgiTA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732314AbfKHMXh (ORCPT + 99 others); Fri, 8 Nov 2019 07:23:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:38044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727598AbfKHMXh (ORCPT ); Fri, 8 Nov 2019 07:23:37 -0500 Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr [92.154.90.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7635222466; Fri, 8 Nov 2019 12:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573215815; bh=2a+PT+frzlqqB6N654vMHLV8wTuhXDw8QFGaYOxD5ZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HjyIgiTAERRN0J1gJiAhtRapd547BF/reBqPrh0qnYgaRbN+OhlYI42HVMTICnHxu ZHlGdsP8ksP7bPC2TtqBiSzaothuCa+p5Fy9aaFm+WW8BpZJ1NAaSgbLxpzygwufqk kR3r0k1jRhyHs74/a2Y41y62w9LyvuzOYN35EnZw= From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: Ard Biesheuvel , Herbert Xu , David Miller , "Jason A . Donenfeld" , Samuel Neves , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Martin Willi , Rene van Dorst , David Sterba Subject: [PATCH v5 12/34] crypto: chacha - unexport chacha_generic routines Date: Fri, 8 Nov 2019 13:22:18 +0100 Message-Id: <20191108122240.28479-13-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191108122240.28479-1-ardb@kernel.org> References: <20191108122240.28479-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Now that all users of generic ChaCha code have moved to the core library, there is no longer a need for the generic ChaCha skcpiher driver to export parts of it implementation for reuse by other drivers. So drop the exports, and make the symbols static. Signed-off-by: Ard Biesheuvel --- crypto/chacha_generic.c | 26 ++++++-------------- include/crypto/internal/chacha.h | 10 -------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c index ebae6d9d9b32..c1b147318393 100644 --- a/crypto/chacha_generic.c +++ b/crypto/chacha_generic.c @@ -21,7 +21,7 @@ static int chacha_stream_xor(struct skcipher_request *req, err = skcipher_walk_virt(&walk, req, false); - crypto_chacha_init(state, ctx, iv); + chacha_init_generic(state, ctx->key, iv); while (walk.nbytes > 0) { unsigned int nbytes = walk.nbytes; @@ -37,36 +37,27 @@ static int chacha_stream_xor(struct skcipher_request *req, return err; } -void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, const u8 *iv) -{ - chacha_init_generic(state, ctx->key, iv); -} -EXPORT_SYMBOL_GPL(crypto_chacha_init); - -int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, - unsigned int keysize) +static int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, + unsigned int keysize) { return chacha_setkey(tfm, key, keysize, 20); } -EXPORT_SYMBOL_GPL(crypto_chacha20_setkey); -int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key, - unsigned int keysize) +static int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key, + unsigned int keysize) { return chacha_setkey(tfm, key, keysize, 12); } -EXPORT_SYMBOL_GPL(crypto_chacha12_setkey); -int crypto_chacha_crypt(struct skcipher_request *req) +static int crypto_chacha_crypt(struct skcipher_request *req) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct chacha_ctx *ctx = crypto_skcipher_ctx(tfm); return chacha_stream_xor(req, ctx, req->iv); } -EXPORT_SYMBOL_GPL(crypto_chacha_crypt); -int crypto_xchacha_crypt(struct skcipher_request *req) +static int crypto_xchacha_crypt(struct skcipher_request *req) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct chacha_ctx *ctx = crypto_skcipher_ctx(tfm); @@ -75,7 +66,7 @@ int crypto_xchacha_crypt(struct skcipher_request *req) u8 real_iv[16]; /* Compute the subkey given the original key and first 128 nonce bits */ - crypto_chacha_init(state, ctx, req->iv); + chacha_init_generic(state, ctx->key, req->iv); hchacha_block_generic(state, subctx.key, ctx->nrounds); subctx.nrounds = ctx->nrounds; @@ -86,7 +77,6 @@ int crypto_xchacha_crypt(struct skcipher_request *req) /* Generate the stream and XOR it with the data */ return chacha_stream_xor(req, &subctx, real_iv); } -EXPORT_SYMBOL_GPL(crypto_xchacha_crypt); static struct skcipher_alg algs[] = { { diff --git a/include/crypto/internal/chacha.h b/include/crypto/internal/chacha.h index c0e40b245431..aa5d4a16aac5 100644 --- a/include/crypto/internal/chacha.h +++ b/include/crypto/internal/chacha.h @@ -12,8 +12,6 @@ struct chacha_ctx { int nrounds; }; -void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, const u8 *iv); - static inline int chacha_setkey(struct crypto_skcipher *tfm, const u8 *key, unsigned int keysize, int nrounds) { @@ -42,12 +40,4 @@ static int inline chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key, return chacha_setkey(tfm, key, keysize, 12); } -int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, - unsigned int keysize); -int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key, - unsigned int keysize); - -int crypto_chacha_crypt(struct skcipher_request *req); -int crypto_xchacha_crypt(struct skcipher_request *req); - #endif /* _CRYPTO_CHACHA_H */ -- 2.20.1