From patchwork Mon Oct 7 16:45:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 175374 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4529274ill; Mon, 7 Oct 2019 09:46:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzv/zV1fpeHPd1LCn74Lc13reNh76v1OW+I+6IKfjVuwiPLxxY2WQiiMsLjk4UKq/QSYFX2 X-Received: by 2002:a17:906:c822:: with SMTP id dd2mr24266766ejb.165.1570466797657; Mon, 07 Oct 2019 09:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570466797; cv=none; d=google.com; s=arc-20160816; b=ZRSJ9V8I3w4Zb4pmuUZ+pAPdqhKmbfhTLSiZ4ehr2Qlp8gL/ZdLe5oM8wR4M65aLWP vWy3zC3KYRzzfugl05lAGlR+RH/TnfvgjWUl8EYUUESgtEh1RVHzIqthyHt1eE0Dwno5 wAEB8bHYTctVH/jziBlXwsSKNXbEKsxAMwacbtd0k4+WUCAJMRugrtf7BZv5nd7fSchT YN8BS0xVpHuoN+mTAw/1y1gUF/QdmKJtf5Ennl3tAQJLZfft8bt9BWr6ALgDLGlqV0qn CM8i5FK9Jz0nMEd+6B3VzqvQ74MGFFkWoUpDKG0tGNCoVOwpbV+1W1zJZ0Zg7OvOsXaD oo3g== 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=2THynFjLIZu6DUZ0NDsK2MmHBOgVMYE3XCp8GCIntiA=; b=bXeedqmCe5khrnFJHufErXKXn14XJHmLX0oBRjTpQD8KXClIVCflt4p/F1AhH10xtg a4ZjG/e9gAh0AGzM2c7YDy10RIkcSC7XJPqilriPw5sThLONpjgeKZswQ2FPuRdy72oY ab3IO5d5pBZusCfr7nZCh11FWmssgPpZRtBZGmtqTgehaefe/PZFWM4vksePd5lPPG2O a2LJPlHmu0gp3AEqN/wjE1StC9/PXYJ/Uiov+vBh9lkusZO0FPvCxhFlLIy6aUA8OWbj eJu2OoVZ7rz+Plmeozo+L36H8l2m5n2K7vX5swrYYtwEWfSWmdBNhtwpVtcNtT0kiLr8 lD4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qsKpL//M"; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si11357081edf.328.2019.10.07.09.46.37; Mon, 07 Oct 2019 09:46:37 -0700 (PDT) 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=@linaro.org header.s=google header.b="qsKpL//M"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbfJGQqg (ORCPT + 3 others); Mon, 7 Oct 2019 12:46:36 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36877 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729003AbfJGQqg (ORCPT ); Mon, 7 Oct 2019 12:46:36 -0400 Received: by mail-wm1-f67.google.com with SMTP id f22so204433wmc.2 for ; Mon, 07 Oct 2019 09:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2THynFjLIZu6DUZ0NDsK2MmHBOgVMYE3XCp8GCIntiA=; b=qsKpL//M2CeQOOSvxNK3f92C1JB8Q0B2ISuVeOT/mZAHeSwaKDxIEUO7qpoRD4ks1D oTF2VPl16TmNaAIfpuIHB7MXFv9LfG1f9BW78q9ct7U5etDnepQxuSd1RUmoVsYo7Mqq 28ea0PgdaoaCx0yXkCucKD90YmXlwTNepeeT8dz/AZhJz+NzcqrFM/5zY761zPYAfBtX 5yVF9LatNWtljPUOZw7DmHxjQD95GrrAzoRu87NC5o4JfCXTyWLBquRVp/EQpGc1spPg gdqAtZkQV46fA0SzpbTSaiIDpa5ZywfA/ggCsL0ihyxAKfVNJg96ZLaO8Cg7OygqAzZA cFlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2THynFjLIZu6DUZ0NDsK2MmHBOgVMYE3XCp8GCIntiA=; b=mq34sdJ6L94xjzG7mEXG6kmNqFmOrJw6DtQeNgT5toMCDL2Clwz37BpDFbLeeHFo0d 132Cq9dDgr0wWUdpXb7Hm/UTy6XUZW0kepuaVHXqborFmsJxJb6LyGwCpqbTVPu0QYUD clTU4oAfJpTu8MQV/GN+pfhtuWbY4emvhk3W5AEL/iDCpnbu5/uAfIZdDFPeZ3gw/qCI PJEVC/cC4aiNcgHP9W7pk8zMk3/e99nz7ktS7nVawwA/DEnyrDKh1bAz/Q/ZeL5F0+Bq 2otS7QR6HtHpLhELFuCpceUEhK8v0Sz+mVtFruvra9snQIrU4USeYXLuP52wEuyZrITl L8xA== X-Gm-Message-State: APjAAAXgH1F3VeugVL8hJH+EdjLCNVVsb9DpbrgWWkF3QMNxCw8IASYv 6ZcI6tu5hRS51VF4J0rILlSjrDgHQVStqg== X-Received: by 2002:a05:600c:143:: with SMTP id w3mr162679wmm.17.1570466794328; Mon, 07 Oct 2019 09:46:34 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id b22sm68507wmj.36.2019.10.07.09.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 09:46:33 -0700 (PDT) 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 Subject: [PATCH v3 11/29] crypto: chacha - unexport chacha_generic routines Date: Mon, 7 Oct 2019 18:45:52 +0200 Message-Id: <20191007164610.6881-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191007164610.6881-1-ard.biesheuvel@linaro.org> References: <20191007164610.6881-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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 | 28 +++++++++----------- include/crypto/internal/chacha.h | 10 ------- 2 files changed, 12 insertions(+), 26 deletions(-) -- 2.20.1 diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c index ebae6d9d9b32..a794df0e5b70 100644 --- a/crypto/chacha_generic.c +++ b/crypto/chacha_generic.c @@ -12,6 +12,12 @@ #include #include +static void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, + const u8 *iv) +{ + chacha_init_generic(state, ctx->key, iv); +} + static int chacha_stream_xor(struct skcipher_request *req, const struct chacha_ctx *ctx, const u8 *iv) { @@ -37,36 +43,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); @@ -86,7 +83,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 8724545bc959..194980d58174 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) { @@ -30,12 +28,4 @@ static inline int chacha_setkey(struct crypto_skcipher *tfm, const u8 *key, return 0; } -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 */