xref: /linux/net/mac80211/tkip.h (revision 9ae4fda332df616ef47d5bb710c39681641d4303)
1f0706e82SJiri Benc /*
2f0706e82SJiri Benc  * Copyright 2002-2004, Instant802 Networks, Inc.
3f0706e82SJiri Benc  *
4f0706e82SJiri Benc  * This program is free software; you can redistribute it and/or modify
5f0706e82SJiri Benc  * it under the terms of the GNU General Public License version 2 as
6f0706e82SJiri Benc  * published by the Free Software Foundation.
7f0706e82SJiri Benc  */
8f0706e82SJiri Benc 
9f0706e82SJiri Benc #ifndef TKIP_H
10f0706e82SJiri Benc #define TKIP_H
11f0706e82SJiri Benc 
12f0706e82SJiri Benc #include <linux/types.h>
13f0706e82SJiri Benc #include <linux/crypto.h>
14f0706e82SJiri Benc #include "ieee80211_key.h"
15f0706e82SJiri Benc 
16f0706e82SJiri Benc u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
17f0706e82SJiri Benc 			   u8 iv0, u8 iv1, u8 iv2);
18f0706e82SJiri Benc void ieee80211_tkip_gen_phase1key(struct ieee80211_key *key, u8 *ta,
19f0706e82SJiri Benc 				  u16 *phase1key);
20f0706e82SJiri Benc void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
21f0706e82SJiri Benc 			       u8 *rc4key);
22f0706e82SJiri Benc void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
23f0706e82SJiri Benc 				 struct ieee80211_key *key,
24f0706e82SJiri Benc 				 u8 *pos, size_t payload_len, u8 *ta);
25f0706e82SJiri Benc enum {
26f0706e82SJiri Benc 	TKIP_DECRYPT_OK = 0,
27f0706e82SJiri Benc 	TKIP_DECRYPT_NO_EXT_IV = -1,
28f0706e82SJiri Benc 	TKIP_DECRYPT_INVALID_KEYIDX = -2,
29f0706e82SJiri Benc 	TKIP_DECRYPT_REPLAY = -3,
30f0706e82SJiri Benc };
31f0706e82SJiri Benc int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
32f0706e82SJiri Benc 				struct ieee80211_key *key,
33f0706e82SJiri Benc 				u8 *payload, size_t payload_len, u8 *ta,
34*9ae4fda3SEmmanuel Grumbach 				u8 *ra, int only_iv, int queue,
3550741ae0SJohannes Berg 				u32 *out_iv32, u16 *out_iv16);
36f0706e82SJiri Benc 
37f0706e82SJiri Benc #endif /* TKIP_H */
38