1 /* 2 * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: declares crypto functions interfacing with linux kernel 22 */ 23 24 #ifndef _WLAN_CFG80211_CRYPTO_H_ 25 #define _WLAN_CFG80211_CRYPTO_H_ 26 #include <net/cfg80211.h> 27 #include "wlan_crypto_global_def.h" 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 /** 40 * wlan_cfg80211_translate_key() - Translate the cfg80211 keys to 41 * internal 42 * @vdev: Pointer to vdev object 43 * @key_index: Key index 44 * @key_type: key type 45 * @mac_addr: mac address 46 * @params: Params 47 * @crypto_key: Crypto keys 48 * 49 * Return: None 50 */ 51 void wlan_cfg80211_translate_key(struct wlan_objmgr_vdev *vdev, 52 uint8_t key_index, 53 enum wlan_crypto_key_type key_type, 54 const u8 *mac_addr, 55 struct key_params *params, 56 struct wlan_crypto_key *crypto_key); 57 58 /** 59 * wlan_cfg80211_store_key() - Store the key 60 * @vdev: VDEV Object pointer 61 * @key_index: Index to be set as the default 62 * @key_type: denotes if the key is pairwise or group key 63 * @mac_addr: BSSID for which the key is to be set 64 * @params: Key params received from the kernel 65 * 66 * Return: Zero for success and negative for failure. 67 */ 68 int wlan_cfg80211_store_key(struct wlan_objmgr_vdev *vdev, 69 uint8_t key_index, 70 enum wlan_crypto_key_type key_type, 71 const u8 *mac_addr, struct key_params *params); 72 73 /** 74 * wlan_cfg80211_crypto_add_key() - Add key for the specified vdev 75 * @vdev: vdev object 76 * @key_type: denotes if the add key request is for pairwise or group key 77 * @key_index: Index of the key that needs to be added 78 * @sync: flag to indicate whether or not to add key synchronously. 79 * DO NOT set to true if it's in scheduler context. 80 * 81 * Return: Zero on Success, negative value on failure 82 */ 83 int wlan_cfg80211_crypto_add_key(struct wlan_objmgr_vdev *vdev, 84 enum wlan_crypto_key_type key_type, 85 uint8_t key_index, bool sync); 86 #endif 87