From patchwork Tue Dec 2 08:43:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Spelvin X-Patchwork-Id: 5417901 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 E55E9BEEA8 for ; Tue, 2 Dec 2014 08:43:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 272A520295 for ; Tue, 2 Dec 2014 08:43:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 500FE2028D for ; Tue, 2 Dec 2014 08:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751391AbaLBInP (ORCPT ); Tue, 2 Dec 2014 03:43:15 -0500 Received: from ns.horizon.com ([71.41.210.147]:53399 "HELO ns.horizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751021AbaLBInP (ORCPT ); Tue, 2 Dec 2014 03:43:15 -0500 Received: (qmail 18412 invoked by uid 1000); 2 Dec 2014 03:43:13 -0500 Date: 2 Dec 2014 03:43:13 -0500 Message-ID: <20141202084313.18411.qmail@ns.horizon.com> From: "George Spelvin" To: herbert@gondor.apana.org.au, nhorman@tuxdriver.com Subject: [PATCH 07/17] crypto: ansi_cprng - Shrink rand_read_pos & flags Cc: linux-crypto@vger.kernel.org, linux@horizon.com, smueller@chronox.de In-Reply-To: <20141202083314.17647.qmail@ns.horizon.com> 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 rand_read_pos is never more than 16, while there's only 1 flag bit allocated, so we can shrink the context a little. Signed-off-by: George Spelvin --- crypto/ansi_cprng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) They're also reordered to avoid alignment holes. diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index 93ed00f6..f40f54cd 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c @@ -51,9 +51,9 @@ struct prng_context { unsigned char rand_data[DEFAULT_BLK_SZ]; unsigned char DT[DEFAULT_BLK_SZ]; unsigned char V[DEFAULT_BLK_SZ]; - u32 rand_read_pos; /* Offset into rand_data[] */ + unsigned char rand_read_pos; /* Offset into rand_data[] */ + unsigned char flags; struct crypto_cipher *tfm; - u32 flags; }; static int dbg;