]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mac80211: Fix misplaced return in AES-GMAC key setup
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 23 Mar 2015 13:41:15 +0000 (15:41 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 30 Mar 2015 08:38:07 +0000 (10:38 +0200)
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>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/aes_gmac.c

index 1c72edcb008312bcdf9d63ef1a9122d07f5ab86d..f1321b7d650675b725b3e96bdbf7611d3d0b1b42 100644 (file)
@@ -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);