xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/crypto/inc/wlan_cfg80211_crypto.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: declares crypto functions interfacing with linux kernel
21  */
22 
23 #ifndef _WLAN_CFG80211_CRYPTO_H_
24 #define _WLAN_CFG80211_CRYPTO_H_
25 #include <net/cfg80211.h>
26 #include "wlan_crypto_global_def.h"
27 /**
28  * wlan_cfg80211_set_default_key() - to set the default key to be used
29  * @vdev: VDEV Object pointer
30  * @key_index: Index to be set as the default
31  * @bssid: BSSID for which the key is to be set
32  *
33  * Return: Zero for success and negative for failure.
34  */
35 int wlan_cfg80211_set_default_key(struct wlan_objmgr_vdev *vdev,
36 				  uint8_t key_index,
37 				  struct qdf_mac_addr *bssid);
38 
39 /**
40  * wlan_cfg80211_store_key() - Store the key
41  * @vdev: VDEV Object pointer
42  * @key_index: Index to be set as the default
43  * @key_type: denotes if the key is pairwise or group key
44  * @mac_addr: BSSID for which the key is to be set
45  * @key_params: Params received from the kernel
46  *
47  * Return: Zero for success and negative for failure.
48  */
49 int wlan_cfg80211_store_key(struct wlan_objmgr_vdev *vdev,
50 			    uint8_t key_index,
51 			    enum wlan_crypto_key_type key_type,
52 			    const u8 *mac_addr, struct key_params *params);
53 
54 /**
55  * wlan_cfg80211_crypto_add_key() - Add key for the specified vdev
56  * @vdev: vdev object
57  * @key_type: denotes if the add key request is for pairwise or group key
58  * @key_index: Index of the key that needs to be added
59  * @sync: flag to indicate whether or not to add key synchronously.
60  *  DO NOT set to true if it's in scheduler context.
61  *
62  * Return: Zero on Success, negative value on failure
63  */
64 int wlan_cfg80211_crypto_add_key(struct wlan_objmgr_vdev *vdev,
65 				 enum wlan_crypto_key_type key_type,
66 				 uint8_t key_index, bool sync);
67 #endif
68