From patchwork Thu May 26 10:57:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolai Stange X-Patchwork-Id: 9136917 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 436DD6075C for ; Thu, 26 May 2016 10:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AB3A28093 for ; Thu, 26 May 2016 10:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E81E28278; Thu, 26 May 2016 10:58:01 +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, FREEMAIL_FROM, 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 B176C28093 for ; Thu, 26 May 2016 10:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360AbcEZK57 (ORCPT ); Thu, 26 May 2016 06:57:59 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35130 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbcEZK56 (ORCPT ); Thu, 26 May 2016 06:57:58 -0400 Received: by mail-wm0-f65.google.com with SMTP id e3so4192268wme.2; Thu, 26 May 2016 03:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=AF6GRKSQaGt9piX5g7HH6PTHM5veHAPYUQkgarRZ168=; b=BoDgfcV9ImTKm1U8mu7brh0QQfic3CrUs4b5QV6MjtSW8zov0D/wCJuMj0VXFfULM1 TV3+zB7KHaEII/Pb08bGTnzBCWxR2HHcdxmR1wcCuMS8+H2J34h7aJosAoIYsY/7hRvq MdpxMiXQ+AxETWHLR12rHVCmdRhwY5inr8/8E89WfvSHDnCX8HxJdSvPQijAcNCdNsdG wFphlsShwkKfIzcNLXUYNELrG+jkTDhn+NSBfEOD5lRprym0P+RhEq2JoWBpmPJbVEYN VCKGNAsMJ/pYS/9CuwEwbpxgXe8x/CSD85XMBPhLZb5nXdgQYVRXzWwKfQorN71Cjmdg sl3w== 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=AF6GRKSQaGt9piX5g7HH6PTHM5veHAPYUQkgarRZ168=; b=O53To6GTqeyaaBB0kbv6f0vVBBOBSE0gfVkF7lbKM+fZSokDzv87zW4hO+nyySZF9N vHzoCRDDcFmNG1eieqYXaR3DOpEsttaKZXrKWUgNeE2YclnOMeAK/MfG0bjuv65ZdLm0 4PHfld1V3IoVgXXMT9Gf+X0kKpaMHXNcR2BWaRFRhbpjr3kiFwbS7jqT82DZ6l33X+us mQ7K6Ji9npDpHTr+AL3rnLK3++joYx0Y2wOdrHdPh4eobMDQv9xp8MeTUIGgp/99hBB9 qLahbrbuSJyVz+CVeAERIlJekKfC9Q0Mf5X5D2Ga4PJSYiweavXn+QMgISaokT61iu15 RIPg== X-Gm-Message-State: ALyK8tK6Tj9idUyK88ZRwmTSteJNdjM13ZcVOPDp+evXrcOT5bGpefpozktIfg4FL6E4KQ== X-Received: by 10.28.27.8 with SMTP id b8mr3068170wmb.78.1464260276641; Thu, 26 May 2016 03:57:56 -0700 (PDT) Received: from localhost (x4e361809.dyn.telefonica.de. [78.54.24.9]) by smtp.gmail.com with ESMTPSA id c62sm2929540wmd.1.2016.05.26.03.57.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2016 03:57:56 -0700 (PDT) From: Nicolai Stange To: Herbert Xu Cc: Dmitry Kasatkin , Tadeusz Struk , LABBE Corentin , Michal Marek , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH] lib/mpi: purge mpi_set_buffer() Date: Thu, 26 May 2016 12:57:50 +0200 Message-Id: <1464260270-3525-1-git-send-email-nicstange@gmail.com> X-Mailer: git-send-email 2.8.2 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 mpi_set_buffer() has no in-tree users and similar functionality is provided by mpi_read_raw_data(). Remove mpi_set_buffer(). Signed-off-by: Nicolai Stange --- Applicable to linux-next-20150525. allmodconfig build on x86_64 succeeded. include/linux/mpi.h | 1 - lib/mpi/mpicoder.c | 76 ----------------------------------------------------- 2 files changed, 77 deletions(-) diff --git a/include/linux/mpi.h b/include/linux/mpi.h index 3a5abe9..f219559 100644 --- a/include/linux/mpi.h +++ b/include/linux/mpi.h @@ -80,7 +80,6 @@ void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign); int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes, int *sign); void *mpi_get_secure_buffer(MPI a, unsigned *nbytes, int *sign); -int mpi_set_buffer(MPI a, const void *buffer, unsigned nbytes, int sign); int mpi_write_to_sgl(MPI a, struct scatterlist *sg, unsigned *nbytes, int *sign); diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c index 747606f..c742033 100644 --- a/lib/mpi/mpicoder.c +++ b/lib/mpi/mpicoder.c @@ -250,82 +250,6 @@ void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign) } EXPORT_SYMBOL_GPL(mpi_get_buffer); -/**************** - * Use BUFFER to update MPI. - */ -int mpi_set_buffer(MPI a, const void *xbuffer, unsigned nbytes, int sign) -{ - const uint8_t *buffer = xbuffer, *p; - mpi_limb_t alimb; - int nlimbs; - int i; - - nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB); - if (RESIZE_IF_NEEDED(a, nlimbs) < 0) - return -ENOMEM; - a->sign = sign; - - for (i = 0, p = buffer + nbytes - 1; p >= buffer + BYTES_PER_MPI_LIMB;) { -#if BYTES_PER_MPI_LIMB == 4 - alimb = (mpi_limb_t) *p--; - alimb |= (mpi_limb_t) *p-- << 8; - alimb |= (mpi_limb_t) *p-- << 16; - alimb |= (mpi_limb_t) *p-- << 24; -#elif BYTES_PER_MPI_LIMB == 8 - alimb = (mpi_limb_t) *p--; - alimb |= (mpi_limb_t) *p-- << 8; - alimb |= (mpi_limb_t) *p-- << 16; - alimb |= (mpi_limb_t) *p-- << 24; - alimb |= (mpi_limb_t) *p-- << 32; - alimb |= (mpi_limb_t) *p-- << 40; - alimb |= (mpi_limb_t) *p-- << 48; - alimb |= (mpi_limb_t) *p-- << 56; -#else -#error please implement for this limb size. -#endif - a->d[i++] = alimb; - } - if (p >= buffer) { -#if BYTES_PER_MPI_LIMB == 4 - alimb = *p--; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 8; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 16; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 24; -#elif BYTES_PER_MPI_LIMB == 8 - alimb = (mpi_limb_t) *p--; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 8; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 16; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 24; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 32; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 40; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 48; - if (p >= buffer) - alimb |= (mpi_limb_t) *p-- << 56; -#else -#error please implement for this limb size. -#endif - a->d[i++] = alimb; - } - a->nlimbs = i; - - if (i != nlimbs) { - pr_emerg("MPI: mpi_set_buffer: Assertion failed (%d != %d)", i, - nlimbs); - BUG(); - } - return 0; -} -EXPORT_SYMBOL_GPL(mpi_set_buffer); - /** * mpi_write_to_sgl() - Funnction exports MPI to an sgl (msb first) *