Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1405230ybz; Fri, 1 May 2020 22:34:37 -0700 (PDT) X-Google-Smtp-Source: APiQypLPGusWGD6khAyla78gKrV9kfohi0S/q8p39ptwaqIgy68PscXD+ENaPArLtS9snWW2haWW X-Received: by 2002:a50:9e6a:: with SMTP id z97mr6019827ede.375.1588397677568; Fri, 01 May 2020 22:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588397677; cv=none; d=google.com; s=arc-20160816; b=lzlohCMs4mNvwKHdbStdbW4fdiFprhJkKVFhoQ1NfpeaBIR40BDanwpgzmOY77x+As QnbRhjZCImC29X2dfUvDHY+HLq6ci3daIiTVuCbO0W5TiZYWlLErb5QRH0xem0rj4hGy m8KMF/AJNe3TYnyXKOkYaVn9JVKWn7Ddv+rb4TfCfttXH8BIdlKsD++2HxsoifpTnpiK cdWUKXHMBG7KzUkHwPqhZCq/bZRRn9wXMY9wfvvG0FJcuX45UhXfPynNxMX+ceH+/ZM9 N/4K5pXZ4hVLqPNeTqrNOSkAGgtiYzSwoYrKBXKLQ+OycNqkO8GFTvw8UkcsBEEy+VNp nsLw== 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 :dkim-signature; bh=BA8GARr9CbfHw2dyfRroKiRCn/eJxKlka08m61P6Rlk=; b=GODcbNqxXGahDacnkpaTBfdEccgY8YcWZOxVD5+kzdlOkvyOBk91EhD7Xhg5vdpwWF JuYMsg+fTaxC/4lvmdTk92a5/4Uu0IXaRqQ1Pj+o9IqMklt0xhoY9E0gjQPf5GTP/guv 2a9mDQVg6BWMQAtPLJ7x8PkwH39bdrxt3rC1g66jxdx8yYPI3VOStYmRIqyEroicIYkQ Pkk1OjVZvA5JryOH57OkQ8CkIGccMZMcyjwJRQ3+7+2MUfBg4cukfKGrbBPBjGntmsLm 7qSD6QPbRJMWjLbsy7X20uEfv5ZmSgQa7DzQPO+JFsrFtWcY0e0WPbv6Pi93AWW5OjA8 TRew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PTGKbB6C; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si3196184edr.204.2020.05.01.22.34.14; Fri, 01 May 2020 22:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PTGKbB6C; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727829AbgEBFdt (ORCPT + 99 others); Sat, 2 May 2020 01:33:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:39294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbgEBFdq (ORCPT ); Sat, 2 May 2020 01:33:46 -0400 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A0C6924956; Sat, 2 May 2020 05:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588397625; bh=aRnhsnypAWsWXKVWbib/6Chk6PgcC0D+Q1jEbEW+EEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTGKbB6CEORZGYYUIt9JxkJSWjc4AMdJy/Ebcqg1ZEvcjNV7zjU8yAoCxLfvgP6p/ GpQs4ja/Otvda6MMGOV78JogJg2t6gr+50RB3vkM0+xAL3oIxIeqJdhj0Hb1ot5mo0 /x72PV9ExK8jtq2rF5WYPlnNqYV+DnwY/s5p22iA= From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-bluetooth@vger.kernel.org Subject: [PATCH 17/20] Bluetooth: use crypto_shash_tfm_digest() Date: Fri, 1 May 2020 22:31:19 -0700 Message-Id: <20200502053122.995648-18-ebiggers@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200502053122.995648-1-ebiggers@kernel.org> References: <20200502053122.995648-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Eric Biggers Instead of manually allocating a 'struct shash_desc' on the stack and calling crypto_shash_digest(), switch to using the new helper function crypto_shash_tfm_digest() which does this for us. Cc: linux-bluetooth@vger.kernel.org Signed-off-by: Eric Biggers --- net/bluetooth/smp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 1476a91ce93572..d022f126eb026b 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -170,7 +170,6 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m, size_t len, u8 mac[16]) { uint8_t tmp[16], mac_msb[16], msg_msb[CMAC_MSG_MAX]; - SHASH_DESC_ON_STACK(desc, tfm); int err; if (len > CMAC_MSG_MAX) @@ -181,8 +180,6 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m, return -EINVAL; } - desc->tfm = tfm; - /* Swap key and message from LSB to MSB */ swap_buf(k, tmp, 16); swap_buf(m, msg_msb, len); @@ -196,8 +193,7 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m, return err; } - err = crypto_shash_digest(desc, msg_msb, len, mac_msb); - shash_desc_zero(desc); + err = crypto_shash_tfm_digest(tfm, msg_msb, len, mac_msb); if (err) { BT_ERR("Hash computation error %d", err); return err; -- 2.26.2