From patchwork Mon Mar 23 13:41:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 6073571 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 084FF9F318 for ; Mon, 23 Mar 2015 13:41:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 490FE20253 for ; Mon, 23 Mar 2015 13:41:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43BB820259 for ; Mon, 23 Mar 2015 13:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752278AbbCWNln (ORCPT ); Mon, 23 Mar 2015 09:41:43 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:28482 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752187AbbCWNln (ORCPT ); Mon, 23 Mar 2015 09:41:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1427118103; x=1458654103; h=from:to:cc:subject:date:message-id:mime-version; bh=8pKU7CeAZ52qqSSHq7p8phN+pdfCkuUE4mitLM3SL2o=; b=L4HtGGOliLE4ds3jstyhsuoG+YsoCA5yqfNWlyGtutV2f7M9TLrqD8+J cvBKw55E0ELu10PWKddv186M0j8uJnZHuaiccKAYKeRkXKvzskDt9uzCL smIks90oQALM6qJqVNy8eiDWELwASTog0SRIjlIVbPYfrlDYM+O/H8fcp Y=; X-IronPort-AV: E=McAfee;i="5600,1067,7748"; a="201939111" Received: from ironmsg02-lv.qualcomm.com ([10.47.202.183]) by wolverine02.qualcomm.com with ESMTP; 23 Mar 2015 06:41:42 -0700 X-IronPort-AV: E=Sophos;i="5.11,452,1422950400"; d="scan'208";a="32067468" Received: from nasanexm01e.na.qualcomm.com ([10.85.0.31]) by ironmsg02-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 23 Mar 2015 06:41:42 -0700 Received: from jouni.qca.qualcomm.com (10.80.80.8) by NASANEXM01E.na.qualcomm.com (10.85.0.31) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Mon, 23 Mar 2015 06:41:41 -0700 From: Jouni Malinen To: Johannes Berg CC: Subject: [PATCH] mac80211: Fix misplaced return in AES-GMAC key setup Date: Mon, 23 Mar 2015 15:41:15 +0200 Message-ID: <1427118075-30959-1-git-send-email-jouni@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To NASANEXM01E.na.qualcomm.com (10.85.0.31) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable 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 Commit 8ade538bf39b ("mac80111: Add BIP-GMAC-128 and BIP-GMAC-256 ciphers") had the success return in incorrect place before the crypto_aead_setauthsize() call which practically ended up skipping that call unconditionally. The missing call did not actually change any functionality since GMAC_MIC_LEN (16) is identical to the maxauthsize in gcm(aes) and as such, the default value used for the authsize parameter. Reported-by: Dan Carpenter Signed-off-by: Jouni Malinen --- net/mac80211/aes_gmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mac80211/aes_gmac.c b/net/mac80211/aes_gmac.c index 1c72edc..f1321b7 100644 --- a/net/mac80211/aes_gmac.c +++ b/net/mac80211/aes_gmac.c @@ -69,10 +69,10 @@ struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], return tfm; err = crypto_aead_setkey(tfm, key, key_len); - if (!err) - return tfm; if (!err) err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN); + if (!err) + return tfm; crypto_free_aead(tfm); return ERR_PTR(err);