From patchwork Wed Nov 9 01:16:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Cope X-Patchwork-Id: 9418335 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D685A60459 for ; Wed, 9 Nov 2016 01:17:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C931A28AB4 for ; Wed, 9 Nov 2016 01:17:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE05328AC1; Wed, 9 Nov 2016 01:17:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCE3B28AB4 for ; Wed, 9 Nov 2016 01:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752316AbcKIBRQ (ORCPT ); Tue, 8 Nov 2016 20:17:16 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36245 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752242AbcKIBRM (ORCPT ); Tue, 8 Nov 2016 20:17:12 -0500 Received: by mail-pf0-f170.google.com with SMTP id 189so117047582pfz.3 for ; Tue, 08 Nov 2016 17:17:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=KmUX10pxX7RcSZfHbadl60jhoaIovnNXAI7PiKZC7DE=; b=VegNt9kqM0wTWVFZ6PGd8Eev4eisQXfBAo8ECpjh2Z4LUsCo1vcDwFMa2/EZ4uIt8J HNhV8m7lyfG1Qp/v6aetXUrgDe+vO6gze332MzPiMIHte/lb7YWhw6GaZ/bxzmO9/ypQ KawglG1EpIqtzsqtKdvh0cEicw9k7g7gtochllSEKLv1VJBkU3Zu9bAGHSIFMWSvFjyf LaDOsLlbS0jReAUaIkGpar6brvKtOFqx2tDGwj3rUYRPDmS09Lxc38MwbzjEcYBV2Sag z2Z5lpi9NV3deaP5JAfAoIWgmqAYoBW7xH0+DPXwT9xFhs8Ju1OEihUESJKVi0q/7rjT rhdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KmUX10pxX7RcSZfHbadl60jhoaIovnNXAI7PiKZC7DE=; b=TmvDIjOfNNjwPcBKcXRvq4GwUPvLzJrhUynqBWgy4pRJiPOD7dR2JVOwWghsAvGDZR ecAOPU0g767R9e5+hNT0HoVbhA6kk8+t2ve1SxWIzSHueU1ZLsOT7F3zGp2C8Ql6krwB t0lQFuuC+z+ZaWoOM4WImXNGi7yqPtTIXXUqU0dnTzJcHIUQvp5McGMjNA2yVF5C53d6 tlDrzG1xDMP2lxil4njPT2ARVGpPuuzZ7CCf7bcrHsBkfN3gz9eaUppK9hJHes6AdvgM Z3FSi39mfvWntYazmJpqdXlpGuwJ178XXB3hSqtZJ8yu2wv1XKOxMAuFxij6D9RWyQor UGRA== X-Gm-Message-State: ABUngve1QEevtRmgxUscLlnCPnDDnSUcAb/DJjnjw5WM8Crt2kqPm7Zetpqtaj0wRFtT6ueo X-Received: by 10.99.240.83 with SMTP id s19mr22478725pgj.175.1478654230879; Tue, 08 Nov 2016 17:17:10 -0800 (PST) Received: from alexcope-linuxxworkstation.kir.corp.google.com ([172.23.164.32]) by smtp.gmail.com with ESMTPSA id af14sm50948143pac.13.2016.11.08.17.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Nov 2016 17:17:10 -0800 (PST) From: Alex Cope To: linux-crypto@vger.kernel.org Cc: Alex Cope Subject: [PATCH RESEND] crypto: gf128mul - remove dead gf128mul_64k_lle code Date: Tue, 8 Nov 2016 17:16:58 -0800 Message-Id: <1478654218-49724-1-git-send-email-alexcope@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This code is unlikely to be useful in the future because transforms don't know how often keys will be changed, new algorithms are unlikely to use lle representation, and tables should be replaced with carryless multiplication instructions when available. Signed-off-by: Alex Cope --- crypto/gf128mul.c | 55 ----------------------------------------------- include/crypto/gf128mul.h | 13 ++++++----- 2 files changed, 6 insertions(+), 62 deletions(-) diff --git a/crypto/gf128mul.c b/crypto/gf128mul.c index 5276607..57c85dd 100644 --- a/crypto/gf128mul.c +++ b/crypto/gf128mul.c @@ -263,48 +263,6 @@ EXPORT_SYMBOL(gf128mul_bbe); * t[1][BYTE] contains g*x^8*BYTE * .. * t[15][BYTE] contains g*x^120*BYTE */ -struct gf128mul_64k *gf128mul_init_64k_lle(const be128 *g) -{ - struct gf128mul_64k *t; - int i, j, k; - - t = kzalloc(sizeof(*t), GFP_KERNEL); - if (!t) - goto out; - - for (i = 0; i < 16; i++) { - t->t[i] = kzalloc(sizeof(*t->t[i]), GFP_KERNEL); - if (!t->t[i]) { - gf128mul_free_64k(t); - t = NULL; - goto out; - } - } - - t->t[0]->t[128] = *g; - for (j = 64; j > 0; j >>= 1) - gf128mul_x_lle(&t->t[0]->t[j], &t->t[0]->t[j + j]); - - for (i = 0;;) { - for (j = 2; j < 256; j += j) - for (k = 1; k < j; ++k) - be128_xor(&t->t[i]->t[j + k], - &t->t[i]->t[j], &t->t[i]->t[k]); - - if (++i >= 16) - break; - - for (j = 128; j > 0; j >>= 1) { - t->t[i]->t[j] = t->t[i - 1]->t[j]; - gf128mul_x8_lle(&t->t[i]->t[j]); - } - } - -out: - return t; -} -EXPORT_SYMBOL(gf128mul_init_64k_lle); - struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g) { struct gf128mul_64k *t; @@ -357,19 +315,6 @@ void gf128mul_free_64k(struct gf128mul_64k *t) } EXPORT_SYMBOL(gf128mul_free_64k); -void gf128mul_64k_lle(be128 *a, struct gf128mul_64k *t) -{ - u8 *ap = (u8 *)a; - be128 r[1]; - int i; - - *r = t->t[0]->t[ap[0]]; - for (i = 1; i < 16; ++i) - be128_xor(r, r, &t->t[i]->t[ap[i]]); - *a = *r; -} -EXPORT_SYMBOL(gf128mul_64k_lle); - void gf128mul_64k_bbe(be128 *a, struct gf128mul_64k *t) { u8 *ap = (u8 *)a; diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h index da2530e..b611aa9 100644 --- a/include/crypto/gf128mul.h +++ b/include/crypto/gf128mul.h @@ -181,20 +181,19 @@ static inline void gf128mul_free_4k(struct gf128mul_4k *t) } -/* 64k table optimization, implemented for lle and bbe */ +/* 64k table optimization, implemented for bbe */ struct gf128mul_64k { struct gf128mul_4k *t[16]; }; -/* first initialize with the constant factor with which you - * want to multiply and then call gf128_64k_lle with the other - * factor in the first argument, the table in the second and a - * scratch register in the third. Afterwards *a = *r. */ -struct gf128mul_64k *gf128mul_init_64k_lle(const be128 *g); +/* First initialize with the constant factor with which you + * want to multiply and then call gf128mul_64k_bbe with the other + * factor in the first argument, and the table in the second. + * Afterwards, the result is stored in *a. + */ struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g); void gf128mul_free_64k(struct gf128mul_64k *t); -void gf128mul_64k_lle(be128 *a, struct gf128mul_64k *t); void gf128mul_64k_bbe(be128 *a, struct gf128mul_64k *t); #endif /* _CRYPTO_GF128MUL_H */