From patchwork Sun Jun 9 11:55:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 166222 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2795030ili; Sun, 9 Jun 2019 04:55:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyseVkyEX15dlDmpSWBKSA1aai04EDXbrJOTXnrrA+hrJNNRjcJzc7lW4GDVXY/ti6AnLN0 X-Received: by 2002:a17:90a:ab0c:: with SMTP id m12mr16046135pjq.87.1560081326719; Sun, 09 Jun 2019 04:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560081326; cv=none; d=google.com; s=arc-20160816; b=xNzTltDqzvm45NSJlAa7vSEeKit/Sn0EIw7IzV/qq+9nbhEFXshVyGDTIattvF1ASw 05kiKjczMUQN1Rn6ifbQbtObtgIxwkzE41NWfue4uDQWqV/0e07HcLtOz2ljPHaH0q7U rAdsG7vwVIwK6uPd0wR+NaLsD8mbdcMZT1V1vUEEiVJ/f061uGsCVrYp0CImcxZ2O0Ax IMvbRa9wj1bUvyw8cRsC0D6geShnIPK0cujFMIPS0Ck814k/+PSVYpoZEeyQrx3Xn5t2 BQ96JaCfWnK1BdHZI8dF8sEJVB16DSt369v38gPyuMge1NeW5Eq+lbKfs1J6SijRFadN ZziQ== 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=KCbpo8tnaYKrv2j1lDPpryYW7uZhax3jjlheYdiONDU=; b=ZOTv8OOLWXihU+I5S/UrHfiTUzQhSSKjoA6wc5YTDA3F8EsZBh3MLb7rtBnWegwshX lpcGd+NzOJjvXHQBtI3Rfre/NssNZKeaYZdLUAI63BAyWDhii83PN/ZWD5xIh3VTCjW+ KlYGukTnxS3dW5JgpYL1/Ac6z32kVHVoeaXwCFpRjhHpKkj0UuQy0if3FyZHlSKbvkm7 HZwKUo7p3zEouFlATb0XSV4OwUSCMq7w6Rn8gK2N2kpRMKcL2oZcdGhXk6iQydn0leE4 I/IY4S55wV0FU/DcYu3l+rkTutlFe101GZf5sK2tCn5grFfnlEARGbMVPnaDSHXc0vA6 n5Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l13Au7VE; 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 s11si7009259pgp.326.2019.06.09.04.55.26; Sun, 09 Jun 2019 04:55:26 -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=l13Au7VE; 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 S1728341AbfFILzZ (ORCPT + 3 others); Sun, 9 Jun 2019 07:55:25 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39884 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728342AbfFILzU (ORCPT ); Sun, 9 Jun 2019 07:55:20 -0400 Received: by mail-wr1-f66.google.com with SMTP id x4so3713986wrt.6 for ; Sun, 09 Jun 2019 04:55:19 -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=KCbpo8tnaYKrv2j1lDPpryYW7uZhax3jjlheYdiONDU=; b=l13Au7VE/9s2L57Uo7UyE8FQaKgLUT2TfiWqxhNmzbgKwXQfWEpCs6n0ba9v1DlS1q DtFoFzNTPtIItR/afepMSGay/bb0GmDrj0SiV8igULkWvOZeXz1hGqNgyD5C+jdDCyA3 mWVbjv2vTe+v+BLkixm7pUWbIMw3GNkl8MavjDeCZIgH7oqBvS0BfTBHYzpwDggDuHUc 4CTxbPAPecPHQwWhH0Bv/Hh04B3Qr5criSWn5NFG4zmpKebjCfyfb4fRIQnRr9mRdmgV Jcho3ZQsikt0rCsu4Z7FYaQnaJIi9cYdJGcbWu3QUuXHC+RHWs8nNN/9MPNV04/yuQ4N wo8Q== 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=KCbpo8tnaYKrv2j1lDPpryYW7uZhax3jjlheYdiONDU=; b=epCYy0WuAtRamz4mBhmzl4f2COpg2TBfH7XJXLf8Spd1jEjKmXusF/4Q/XBVMP0oPa 9icri56763CN7+yjrMFdx799JXMdhdaMIXN8VWzK1KnizDrHGsQykMTA9R0gBMstoflK mxIyZlNA7bOkvMG81DzJ/ayxeIk5m+BsvxVmKFZJFtVI33/7fcnvscDJK9CJrXyTqIGY tDaa/sIaJnP2mEEUdyfN8g5mkQxnuKfpi1infG69ztoMY/2cs5C8JEOAeMKbbWB0YXxa wXtrR5LBh4F8SY70L+lxh7aIvaDCSqXUuAxJrAErZ7QyNhclUA6vsqIRujh0M1PUWZN1 db+w== X-Gm-Message-State: APjAAAWhzeOtyyTcIq/jpxmUHTBkynEnyV1/OObmhA668/5QmGdzFgNf sWyFQVPNlXiHsnkDbm/dv4OOdu54H6Ltew== X-Received: by 2002:a5d:4a0b:: with SMTP id m11mr30740019wrq.251.1560081318756; Sun, 09 Jun 2019 04:55:18 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:5129:23cd:5870:89d4]) by smtp.gmail.com with ESMTPSA id r5sm14954317wrg.10.2019.06.09.04.55.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 04:55:18 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: Ard Biesheuvel , Herbert Xu , "David S. Miller" , Eric Biggers Subject: [PATCH v2 5/7] crypto: arc4 - remove cipher implementation Date: Sun, 9 Jun 2019 13:55:07 +0200 Message-Id: <20190609115509.26260-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190609115509.26260-1-ard.biesheuvel@linaro.org> References: <20190609115509.26260-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 There are no remaining users of the cipher implementation, and there are no meaningful ways in which the arc4 cipher can be combined with templates other than ECB (and the way we do provide that combination is highly dubious to begin with). So let's drop the arc4 cipher altogether, and only keep the ecb(arc4) skcipher, which is used in various places in the kernel. Signed-off-by: Ard Biesheuvel --- crypto/arc4.c | 36 ++------------------ 1 file changed, 2 insertions(+), 34 deletions(-) -- 2.20.1 diff --git a/crypto/arc4.c b/crypto/arc4.c index 7f80623aa66a..3cdfd12110ea 100644 --- a/crypto/arc4.c +++ b/crypto/arc4.c @@ -27,11 +27,6 @@ static int arc4_set_key_skcipher(struct crypto_skcipher *tfm, const u8 *in_key, return arc4_set_key(&tfm->base, in_key, key_len); } -static void arc4_crypt_one(struct crypto_tfm *tfm, u8 *out, const u8 *in) -{ - crypto_arc4_crypt(crypto_tfm_ctx(tfm), out, in, 1); -} - static int ecb_arc4_crypt(struct skcipher_request *req) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); @@ -50,23 +45,6 @@ static int ecb_arc4_crypt(struct skcipher_request *req) return err; } -static struct crypto_alg arc4_cipher = { - .cra_name = "arc4", - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, - .cra_blocksize = ARC4_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct crypto_arc4_ctx), - .cra_module = THIS_MODULE, - .cra_u = { - .cipher = { - .cia_min_keysize = ARC4_MIN_KEY_SIZE, - .cia_max_keysize = ARC4_MAX_KEY_SIZE, - .cia_setkey = arc4_set_key, - .cia_encrypt = arc4_crypt_one, - .cia_decrypt = arc4_crypt_one, - }, - }, -}; - static struct skcipher_alg arc4_skcipher = { .base.cra_name = "ecb(arc4)", .base.cra_priority = 100, @@ -82,21 +60,11 @@ static struct skcipher_alg arc4_skcipher = { static int __init arc4_init(void) { - int err; - - err = crypto_register_alg(&arc4_cipher); - if (err) - return err; - - err = crypto_register_skcipher(&arc4_skcipher); - if (err) - crypto_unregister_alg(&arc4_cipher); - return err; + return crypto_register_skcipher(&arc4_skcipher); } static void __exit arc4_exit(void) { - crypto_unregister_alg(&arc4_cipher); crypto_unregister_skcipher(&arc4_skcipher); } @@ -106,4 +74,4 @@ module_exit(arc4_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("ARC4 Cipher Algorithm"); MODULE_AUTHOR("Jon Oberheide "); -MODULE_ALIAS_CRYPTO("arc4"); +MODULE_ALIAS_CRYPTO("ecb(arc4)");