linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Fix misplaced return in AES-GMAC key setup
@ 2015-03-23 13:41 Jouni Malinen
  2015-03-30  8:38 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Jouni Malinen @ 2015-03-23 13:41 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

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 <dan.carpenter@oracle.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
---
 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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211: Fix misplaced return in AES-GMAC key setup
  2015-03-23 13:41 [PATCH] mac80211: Fix misplaced return in AES-GMAC key setup Jouni Malinen
@ 2015-03-30  8:38 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-03-30  8:38 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless

On Mon, 2015-03-23 at 15:41 +0200, Jouni Malinen wrote:
> 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.

Applied.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-30  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 13:41 [PATCH] mac80211: Fix misplaced return in AES-GMAC key setup Jouni Malinen
2015-03-30  8:38 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).