Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp608948ybx; Wed, 6 Nov 2019 05:50:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyKT0+JfKSKvpUFirCrrUbB8P+yimnFwkg4gbqrCe8+5XsoqdVUA2ieqg//qoLwUeH8tKwU X-Received: by 2002:a17:906:6d59:: with SMTP id a25mr7273209ejt.57.1573048228924; Wed, 06 Nov 2019 05:50:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573048228; cv=none; d=google.com; s=arc-20160816; b=WPXc9HENnxHg3UmaEDgmLjpa6X1eRCV/MRTjHZGo+Cg5o8PtyOYLrSmlwMkdvTPOWR vS2PNnUjsdRyQhrWmV1dKVV2BRGevCSJZUJsc6n3JBay/TgPymAFM3X2yB1S19YBpU8Z jor38EL4gprgDJJzDMv0qLANuw+wltffCQUr3x6dfvbiO9RyPTqFCy0TLAVXMegtHhpC bcs5uNhlVzWDzbx+TGtaPv0xc8tBvfYbX6C9SPW8IQ70GOT7HQfiGkOmm/dKiBdD5tDr 0Y9l37G5V7aPNloIgoR7hLchJJ6Ydn2hqe67yET2rcmV9yG4fDUcc+5RYmvwtaFyEzwr 5Svg== 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; bh=9pklDT2786QjOJ7iA4Zn8FeP54tCBi7y723vz1N4rzM=; b=ekbcQui6H6MfvRDRzJVzRHhRfYWls1YqNAH+a1ZA7X3Fyqs3h2qD6b5wb4YW0DuNOy +x5rt4YoTTVG0gB1EkKOdDwwWXhkb3k63FIrsIgbXQHVWINs0UTjgruQbC92ZkyZgnbB UJSb5a8MS4ix+8Bu8mQz2uKbUS+oGH/t75cMaVZ8oMfbEVqeqYDK6tP0Mc4UJggXv+cY nmCzDmKXoJdknFOj67r9u2oLl5WwANyVS7UY3u8vejA3IstHsLcvXCYzYLzLlYepjQq+ aXGOK6O2u3qKMewqioaySeLnuGciGR1ljhlMrU6sSEI7PIiK5ZbXvJFKDo0IREYtNosS rdNg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e10si15509403ejk.416.2019.11.06.05.50.04; Wed, 06 Nov 2019 05:50:28 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731731AbfKFNsy (ORCPT + 99 others); Wed, 6 Nov 2019 08:48:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:32954 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726673AbfKFNsy (ORCPT ); Wed, 6 Nov 2019 08:48:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 19E05B387; Wed, 6 Nov 2019 13:48:52 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id CF982DA79A; Wed, 6 Nov 2019 14:48:58 +0100 (CET) From: David Sterba To: linux-crypto@vger.kernel.org Cc: ebiggers@kernel.org, David Sterba Subject: [PATCH 7/7] crypto: blake2b: rename tfm context Date: Wed, 6 Nov 2019 14:48:31 +0100 Message-Id: <848741ecbafbe7c7be81fd9b3a8e4229a43c3eaf.1573047517.git.dsterba@suse.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The TFM context can be renamed to a more appropriate name and the local varaibles as well, using 'tctx' which seems to be more common than 'mctx'. Signed-off-by: David Sterba --- crypto/blake2b_generic.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crypto/blake2b_generic.c b/crypto/blake2b_generic.c index b05dfc2724e8..38d49deceae6 100644 --- a/crypto/blake2b_generic.c +++ b/crypto/blake2b_generic.c @@ -137,7 +137,7 @@ static void blake2b_compress(struct blake2b_state *S, #undef G #undef ROUND -struct digest_tfm_ctx { +struct blake2b_tfm_ctx { u8 key[BLAKE2B_KEYBYTES]; unsigned int keylen; }; @@ -145,22 +145,22 @@ struct digest_tfm_ctx { static int digest_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { - struct digest_tfm_ctx *mctx = crypto_shash_ctx(tfm); + struct blake2b_tfm_ctx *tctx = crypto_shash_ctx(tfm); if (keylen == 0 || keylen > BLAKE2B_KEYBYTES) { crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; } - memcpy(mctx->key, key, keylen); - mctx->keylen = keylen; + memcpy(tctx->key, key, keylen); + tctx->keylen = keylen; return 0; } static int blake2b_init(struct shash_desc *desc) { - struct digest_tfm_ctx *mctx = crypto_shash_ctx(desc->tfm); + struct blake2b_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm); struct blake2b_state *state = shash_desc_ctx(desc); const int digestsize = crypto_shash_digestsize(desc->tfm); @@ -168,14 +168,14 @@ static int blake2b_init(struct shash_desc *desc) memcpy(state->h, blake2b_IV, sizeof(state->h)); /* Parameter block is all zeros except index 0, no xor for 1..7 */ - state->h[0] ^= 0x01010000 | mctx->keylen << 8 | digestsize; + state->h[0] ^= 0x01010000 | tctx->keylen << 8 | digestsize; - if (mctx->keylen) { + if (tctx->keylen) { /* * Prefill the buffer with the key, next call to _update or * _final will process it */ - memcpy(state->buf, mctx->key, mctx->keylen); + memcpy(state->buf, tctx->key, tctx->keylen); state->buflen = BLAKE2B_BLOCKBYTES; } return 0; @@ -241,7 +241,7 @@ static struct shash_alg blake2b_algs[] = { .base.cra_priority = 100, .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .base.cra_blocksize = BLAKE2B_BLOCKBYTES, - .base.cra_ctxsize = sizeof(struct digest_tfm_ctx), + .base.cra_ctxsize = sizeof(struct blake2b_tfm_ctx), .base.cra_module = THIS_MODULE, .digestsize = BLAKE2B_160_DIGEST_SIZE, .setkey = digest_setkey, @@ -255,7 +255,7 @@ static struct shash_alg blake2b_algs[] = { .base.cra_priority = 100, .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .base.cra_blocksize = BLAKE2B_BLOCKBYTES, - .base.cra_ctxsize = sizeof(struct digest_tfm_ctx), + .base.cra_ctxsize = sizeof(struct blake2b_tfm_ctx), .base.cra_module = THIS_MODULE, .digestsize = BLAKE2B_256_DIGEST_SIZE, .setkey = digest_setkey, @@ -269,7 +269,7 @@ static struct shash_alg blake2b_algs[] = { .base.cra_priority = 100, .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .base.cra_blocksize = BLAKE2B_BLOCKBYTES, - .base.cra_ctxsize = sizeof(struct digest_tfm_ctx), + .base.cra_ctxsize = sizeof(struct blake2b_tfm_ctx), .base.cra_module = THIS_MODULE, .digestsize = BLAKE2B_384_DIGEST_SIZE, .setkey = digest_setkey, @@ -283,7 +283,7 @@ static struct shash_alg blake2b_algs[] = { .base.cra_priority = 100, .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .base.cra_blocksize = BLAKE2B_BLOCKBYTES, - .base.cra_ctxsize = sizeof(struct digest_tfm_ctx), + .base.cra_ctxsize = sizeof(struct blake2b_tfm_ctx), .base.cra_module = THIS_MODULE, .digestsize = BLAKE2B_512_DIGEST_SIZE, .setkey = digest_setkey, -- 2.23.0