1 /* 2 * Copyright (c) 2019 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 #ifdef CONFIG_CRYPTO_COMPONENT 28 /** 29 * wlan_cfg80211_set_default_key() - to set the default key to be used 30 * @vdev: VDEV Object pointer 31 * @key_index: Index to be set as the default 32 * @bssid: BSSID for which the key is to be set 33 * 34 * Return: Zero for success and negative for failure. 35 */ 36 int wlan_cfg80211_set_default_key(struct wlan_objmgr_vdev *vdev, 37 uint8_t key_index, 38 struct qdf_mac_addr *bssid); 39 #else 40 static inline int wlan_cfg80211_set_default_key(struct wlan_objmgr_vdev *vdev, 41 uint8_t key_index, 42 struct qdf_mac_addr *bssid) 43 { 44 return 0; 45 } 46 #endif 47 48 /** 49 * wlan_cfg80211_store_key() - Store the key 50 * @vdev: VDEV Object pointer 51 * @key_index: Index to be set as the default 52 * @key_type: denotes if the key is pairwise or group key 53 * @mac_addr: BSSID for which the key is to be set 54 * @key_params: Params received from the kernel 55 * 56 * Return: Zero for success and negative for failure. 57 */ 58 int wlan_cfg80211_store_key(struct wlan_objmgr_vdev *vdev, 59 uint8_t key_index, 60 enum wlan_crypto_key_type key_type, 61 const u8 *mac_addr, struct key_params *params); 62 63 /** 64 * wlan_cfg80211_crypto_add_key() - Add key for the specified vdev 65 * @vdev: vdev object 66 * @key_type: denotes if the add key request is for pairwise or group key 67 * @key_index: Index of the key that needs to be added 68 * 69 * Return: Zero on Success, negative value on failure 70 */ 71 int wlan_cfg80211_crypto_add_key(struct wlan_objmgr_vdev *vdev, 72 enum wlan_crypto_key_type key_type, 73 uint8_t key_index); 74 #endif 75