From patchwork Thu Oct 17 19:09:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 176709 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1359669ill; Thu, 17 Oct 2019 12:10:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmo2trM0CljDomMf5jKMOpZefFsRxkKIQBPh4+mEp+JjB60dDT0SmZBKw1R0RUw3sqwv/V X-Received: by 2002:a17:906:1342:: with SMTP id x2mr5033717ejb.304.1571339415160; Thu, 17 Oct 2019 12:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571339415; cv=none; d=google.com; s=arc-20160816; b=Fwv9DM3D+ar8oNjQPjf0pvfKdj7Hg9DHDFej9pFB2hb/xK/leDs4uGt2FAXAeiPxvf agyFfn3U+BggYSQYbFtqmCoGpJ0+0o94OlU5Uw5E5EhTfOcX1T9Bu8/H47tG69hC7isO SKPnbC9WwmrD6xTQxO02JlaN69Z2ZiFef+0rf2sIJZD5DxzK0vY5AWiu8oUlVMs1ytmM pahpRmkoELaWFBtUEdCcE7J54F2ILAOiL3nDhLRykLES9yytDuN8J2lAyg4XM0PacerB WWQ4icpKU1qCKw8bdf13ZeLD4qFqSbh3YPzDzMOQamYKyCSq5zRUUgOFr76xcUg1hLEC PWOg== 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=IZIptCKd4WM8fX70RUOUVGCwkhKzlQyYGe3DbvsRt/c=; b=SbIMELoMGPhJ7ooaKdeRy0pdiIc1HvnRvjmsWs5yL8VM/3VFxNm+ULGwNfzNCiaQfP AvgSV13cfOQu2AZ4DXLeqjMf5YRirvG5VggUEjYzBtYXvVM5YX6mtGpu/OV8Hwofx3F2 jaUrADscIZu2e3aaLK78GjFYCBp60kNroDSNCPWgeSKmCGXZCRKBKUPgkEY8qLPWV+40 NSJ9WmxJ6MiDPhe7mp9YzBCLjbu8VjdPfXaceGeVTJmSbj74bEi19C5858paYZY+E7jX jW/Bv4kOQgwZp2s610UIeS6e09eyG1bsdOKG+yq6g57Gy6pPFxd1zkCorG1SY//P5YMP 4TCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7I4hpnN; 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 e31si2292605ede.199.2019.10.17.12.10.15; Thu, 17 Oct 2019 12:10:15 -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=V7I4hpnN; 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 S2503388AbfJQTKO (ORCPT + 3 others); Thu, 17 Oct 2019 15:10:14 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41460 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503322AbfJQTKO (ORCPT ); Thu, 17 Oct 2019 15:10:14 -0400 Received: by mail-wr1-f67.google.com with SMTP id p4so3583374wrm.8 for ; Thu, 17 Oct 2019 12:10:11 -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=IZIptCKd4WM8fX70RUOUVGCwkhKzlQyYGe3DbvsRt/c=; b=V7I4hpnN7QpQsdfNovsBb3ah83qPRsQkztYR7SDq7rpuR+g1jtpD3VS6I4vjaclKv6 GFsLVPmfjmw6aLsSNkoIIB/eX4li8BK2AZvgAlCh6wjsU4EQDUNSPgX5ZoMDIqO3Lx1w xXgNjxkw2wl9yAmr2dMjAdhC8GjqoFMp54DGh9UGjsAGnyBf3vAEj1cgUJXS/ECap6Gd pq8i+enCuSCx3Ee8RZBsyuWZDP4+V0KsIKHw0F+z+Fo9W0fwZTTILGkgp8T8q5sdnU6X hybxyaK2Bo81pHPc+VUOiq2MNUBR4d+DRLUczh3UMUXYpxMFP/58UJr81aa92UMOc9H2 PerQ== 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=IZIptCKd4WM8fX70RUOUVGCwkhKzlQyYGe3DbvsRt/c=; b=fEstpK50euxtymGbEvMcSkjL/Fnu7FQEptJz05YxHRoDV/XTglZ4VM2GsZgHfchuio TDJZxRBOa8pyT0s9prehJQbad8MHTewfFWkIhw2ioGxQx4v8u/0h+VP4rSHcQPKmW3ST 6n5o2ioFJVB6raZBjDYevUX3ZCRbBZrVGFNzII5YTG6y0nBVFj1qC3SgKKHF6sWw82oC jfpJAI0ynYntRU+XOGIiEXrCWwsCeHvheWTKiYi8wdaW5jlaY8FvPr3HWlF7RHF9wvW7 VNHUowIprEVKUqVaBmNVaP9H7iFrHUyRHStQ/OPter/vbX+OwWx2eC2PRs/ll42CiE2F C7Ig== X-Gm-Message-State: APjAAAWNGlux89fQKPcvrBcqQWfx4wjan7oJ0dvCpahFHjYed37Pyt6h v0cPMLw4t7ZaFXxOlmjfJ0nVkvBPfsS06AyN X-Received: by 2002:adf:e747:: with SMTP id c7mr4363804wrn.384.1571339410196; Thu, 17 Oct 2019 12:10:10 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:ccb6:e9d4:c1bc:d107]) by smtp.gmail.com with ESMTPSA id y3sm5124528wro.36.2019.10.17.12.10.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2019 12:10:09 -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 , David Sterba Subject: [PATCH v4 12/35] crypto: chacha - unexport chacha_generic routines Date: Thu, 17 Oct 2019 21:09:09 +0200 Message-Id: <20191017190932.1947-13-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017190932.1947-1-ard.biesheuvel@linaro.org> References: <20191017190932.1947-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 | 26 ++++++-------------- include/crypto/internal/chacha.h | 10 -------- 2 files changed, 8 insertions(+), 28 deletions(-) -- 2.20.1 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 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 */