Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07862e13 authored by Johannes Berg's avatar Johannes Berg
Browse files

mac80111: aes_gcm: clean up ieee80211_aes_gcm_key_setup_encrypt()



This code is written using an anti-pattern called "success handling"
which makes it hard to read, especially if you are used to normal kernel
style.  It should instead be written as a list of directives in a row
with branches for error handling.

(Basically copied from Dan's previous patch for CCM)

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 45fd6329
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -80,11 +80,15 @@ struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
		return tfm;

	err = crypto_aead_setkey(tfm, key, key_len);
	if (!err)
	if (err)
		goto free_aead;
	err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
	if (!err)
	if (err)
		goto free_aead;

	return tfm;

free_aead:
	crypto_free_aead(tfm);
	return ERR_PTR(err);
}