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

Commit 4325f6ca authored by Johannes Berg's avatar Johannes Berg
Browse files

wireless: move crypto constants to ieee80211.h



mac80211 and the Intel drivers all define crypto
constants, move them to ieee80211.h instead.

Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 04a161f4
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1347,14 +1347,6 @@ struct il_rx_mpdu_res_start {
#define TX_CMD_SEC_SHIFT	6
#define TX_CMD_SEC_KEY128	0x08

/*
 * security overhead sizes
 */
#define WEP_IV_LEN 4
#define WEP_ICV_LEN 4
#define CCMP_MIC_LEN 8
#define TKIP_ICV_LEN 4

/*
 * C_TX = 0x1c (command)
 */
+0 −8
Original line number Diff line number Diff line
@@ -1224,14 +1224,6 @@ struct iwl_rx_mpdu_res_start {
#define TX_CMD_SEC_SHIFT	6
#define TX_CMD_SEC_KEY128	0x08

/*
 * security overhead sizes
 */
#define WEP_IV_LEN 4
#define WEP_ICV_LEN 4
#define CCMP_MIC_LEN 8
#define TKIP_ICV_LEN 4

/*
 * REPLY_TX = 0x1c (command)
 */
+3 −3
Original line number Diff line number Diff line
@@ -224,13 +224,13 @@ static void iwl_pcie_txq_update_byte_cnt_tbl(struct iwl_trans *trans,

	switch (sec_ctl & TX_CMD_SEC_MSK) {
	case TX_CMD_SEC_CCM:
		len += CCMP_MIC_LEN;
		len += IEEE80211_CCMP_MIC_LEN;
		break;
	case TX_CMD_SEC_TKIP:
		len += TKIP_ICV_LEN;
		len += IEEE80211_TKIP_ICV_LEN;
		break;
	case TX_CMD_SEC_WEP:
		len += WEP_IV_LEN + WEP_ICV_LEN;
		len += IEEE80211_WEP_IV_LEN + IEEE80211_WEP_ICV_LEN;
		break;
	}

+9 −0
Original line number Diff line number Diff line
@@ -1829,6 +1829,15 @@ enum ieee80211_key_len {
	WLAN_KEY_LEN_AES_CMAC = 16,
};

#define IEEE80211_WEP_IV_LEN		4
#define IEEE80211_WEP_ICV_LEN		4
#define IEEE80211_CCMP_HDR_LEN		8
#define IEEE80211_CCMP_MIC_LEN		8
#define IEEE80211_CCMP_PN_LEN		6
#define IEEE80211_TKIP_IV_LEN		8
#define IEEE80211_TKIP_ICV_LEN		4
#define IEEE80211_CMAC_PN_LEN		6

/* Public action codes */
enum ieee80211_pub_actioncode {
	WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
+3 −3
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
			*cpos++ = *pos++ ^ e[i];
	}

	for (i = 0; i < CCMP_MIC_LEN; i++)
	for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
		mic[i] = b[i] ^ s_0[i];
}

@@ -123,7 +123,7 @@ int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
		crypto_cipher_encrypt_one(tfm, a, a);
	}

	for (i = 0; i < CCMP_MIC_LEN; i++) {
	for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
		if ((mic[i] ^ s_0[i]) != a[i])
			return -1;
	}
@@ -138,7 +138,7 @@ struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])

	tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
	if (!IS_ERR(tfm))
		crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN);
		crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);

	return tfm;
}
Loading