From patchwork Sun Dec 7 12:26:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Spelvin X-Patchwork-Id: 5451391 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 64788BEEBA for ; Sun, 7 Dec 2014 12:26:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DB3A20158 for ; Sun, 7 Dec 2014 12:26:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9AB4020155 for ; Sun, 7 Dec 2014 12:26:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753075AbaLGM0y (ORCPT ); Sun, 7 Dec 2014 07:26:54 -0500 Received: from ns.horizon.com ([71.41.210.147]:29037 "HELO ns.horizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753083AbaLGM0x (ORCPT ); Sun, 7 Dec 2014 07:26:53 -0500 Received: (qmail 20774 invoked by uid 1000); 7 Dec 2014 07:26:51 -0500 From: George Spelvin To: nhorman@tuxdriver.com, linux-crypto@vger.kernel.org Cc: smueller@chronox.de, herbert@gondor.apana.org.au, linux@horizon.com Subject: [PATCH v2 02/25] crypto: ansi_cprng - Additional _get_more_prng_bytes cleanup Date: Sun, 7 Dec 2014 07:26:10 -0500 Message-Id: <0adc66f32b0eb34ba267d7173f8ee4b732294a5e.1417951990.git.linux@horizon.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The local variable "output" is no longer required. Signed-off-by: George Spelvin --- crypto/ansi_cprng.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index ce315bf7..143e0cfa 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c @@ -89,8 +89,6 @@ static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test) { int i; unsigned char tmp[DEFAULT_BLK_SZ]; - unsigned char *output = NULL; - dbgprint(KERN_CRIT "Calling _get_more_prng_bytes for context %p\n", ctx); @@ -104,9 +102,8 @@ static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test) * This gives us an intermediate value I */ memcpy(tmp, ctx->DT, DEFAULT_BLK_SZ); - output = ctx->I; hexdump("tmp stage 0: ", tmp, DEFAULT_BLK_SZ); - crypto_cipher_encrypt_one(ctx->tfm, output, tmp); + crypto_cipher_encrypt_one(ctx->tfm, ctx->I, tmp); /* * Next xor I with our secret vector V @@ -115,8 +112,7 @@ static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test) */ xor_vectors(ctx->I, ctx->V, tmp, DEFAULT_BLK_SZ); hexdump("tmp stage 1: ", tmp, DEFAULT_BLK_SZ); - output = ctx->rand_data; - crypto_cipher_encrypt_one(ctx->tfm, output, tmp); + crypto_cipher_encrypt_one(ctx->tfm, ctx->rand_data, tmp); /* * First check that we didn't produce the same @@ -139,9 +135,8 @@ static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test) * and encrypt that to obtain a new secret vector V */ xor_vectors(ctx->rand_data, ctx->I, tmp, DEFAULT_BLK_SZ); - output = ctx->V; hexdump("tmp stage 2: ", tmp, DEFAULT_BLK_SZ); - crypto_cipher_encrypt_one(ctx->tfm, output, tmp); + crypto_cipher_encrypt_one(ctx->tfm, ctx->V, tmp); /* * Now update our DT value