From 95eee69154be4bb38e41353142eb980b22bc0285 Mon Sep 17 00:00:00 2001 From: Srikanth Marepalli Date: Mon, 29 Jan 2024 20:45:05 +0530 Subject: [PATCH] qcacmn: Add support for handling the NL crypto params Added support for handling the crypto params from NL connect request that has all the supported AKMs, unicast and multicast ciphers to store them in the crypto and retrieve them later to update the scan filter params. Change-Id: I040c908c85d530ea4c86ec3e5b71044ffcf4b7d9 CRs-Fixed: 3767477 --- .../crypto/inc/wlan_crypto_global_def.h | 9 ++ .../crypto/src/wlan_crypto_global_api.c | 18 ++++ .../crypto/src/wlan_crypto_param_handling.c | 102 ++++++++++++++++++ .../crypto/src/wlan_crypto_param_handling_i.h | 77 +++++++++++++ 4 files changed, 206 insertions(+) diff --git a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h index 63a31975100a..f7468a78f083 100644 --- a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h +++ b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h @@ -309,6 +309,9 @@ struct wlan_crypto_pmksa { * @key_mgmt: key mgmt * @pmksa: pmksa * @rsn_caps: rsn_capability + * @orig_ucastcipher: connection request unicast ciphers + * @orig_mcastcipher: connection request multicast cipher + * @orig_key_mgmt: connection request key mgmt * * This structure holds crypto params for peer or vdev */ @@ -321,6 +324,9 @@ struct wlan_crypto_params { uint32_t key_mgmt; struct wlan_crypto_pmksa *pmksa[WLAN_CRYPTO_MAX_PMKID]; uint16_t rsn_caps; + uint32_t orig_ucastcipher; + uint32_t orig_mcastcipher; + uint32_t orig_key_mgmt; }; typedef enum wlan_crypto_param_type { @@ -332,6 +338,9 @@ typedef enum wlan_crypto_param_type { WLAN_CRYPTO_PARAM_RSN_CAP, WLAN_CRYPTO_PARAM_KEY_MGMT, WLAN_CRYPTO_PARAM_PMKSA, + WLAN_CRYPTO_PARAM_ORIG_UCAST_CIPHER, + WLAN_CRYPTO_PARAM_ORIG_MCAST_CIPHER, + WLAN_CRYPTO_PARAM_ORIG_KEY_MGMT, } wlan_crypto_param_type; /** diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index 5206b265b05f..f7ec591a6263 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -172,6 +172,15 @@ static QDF_STATUS wlan_crypto_set_param(struct wlan_crypto_params *crypto_params case WLAN_CRYPTO_PARAM_KEY_MGMT: status = wlan_crypto_set_key_mgmt(crypto_params, value); break; + case WLAN_CRYPTO_PARAM_ORIG_UCAST_CIPHER: + status = wlan_crypto_set_orig_ucastcipher(crypto_params, value); + break; + case WLAN_CRYPTO_PARAM_ORIG_MCAST_CIPHER: + status = wlan_crypto_set_orig_mcastcipher(crypto_params, value); + break; + case WLAN_CRYPTO_PARAM_ORIG_KEY_MGMT: + status = wlan_crypto_set_orig_key_mgmt(crypto_params, value); + break; default: status = QDF_STATUS_E_INVAL; } @@ -279,6 +288,15 @@ static int32_t wlan_crypto_get_param_value(wlan_crypto_param_type param, case WLAN_CRYPTO_PARAM_KEY_MGMT: value = wlan_crypto_get_key_mgmt(crypto_params); break; + case WLAN_CRYPTO_PARAM_ORIG_UCAST_CIPHER: + value = wlan_crypto_get_orig_ucastcipher(crypto_params); + break; + case WLAN_CRYPTO_PARAM_ORIG_MCAST_CIPHER: + value = wlan_crypto_get_orig_mcastcipher(crypto_params); + break; + case WLAN_CRYPTO_PARAM_ORIG_KEY_MGMT: + value = wlan_crypto_get_orig_key_mgmt(crypto_params); + break; default: value = -1; } diff --git a/umac/cmn_services/crypto/src/wlan_crypto_param_handling.c b/umac/cmn_services/crypto/src/wlan_crypto_param_handling.c index 33d24db046d3..68b79f07e87e 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_param_handling.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_param_handling.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -302,3 +303,104 @@ int32_t wlan_crypto_get_key_mgmt(struct wlan_crypto_params *crypto_params) { return crypto_params->key_mgmt; } + +/** + * wlan_crypto_set_orig_ucastcipher - called by ucfg to configure connection + * request unicast ciphers in vdev + * @crypto_params: pointer to crypto params structure + * @value: bitmap value of all supported unicast ciphers + * + * This function gets called from ucfg to configure unicast ciphers in vdev + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS +wlan_crypto_set_orig_ucastcipher(struct wlan_crypto_params *crypto_params, + uint32_t value) +{ + crypto_params->orig_ucastcipher = value; + + return QDF_STATUS_SUCCESS; +} + +/** + * wlan_crypto_get_orig_ucastcipher - called by ucfg to get connection request + * ucastcipher value from vdev + * @crypto_params: pointer to crypto params structure + * + * This function gets called from ucfg to get supported unicast ciphers + * + * Return: bitmap value of all supported unicast ciphers + */ +int32_t +wlan_crypto_get_orig_ucastcipher(struct wlan_crypto_params *crypto_params) +{ + return crypto_params->orig_ucastcipher; +} + +/** + * wlan_crypto_set_orig_mcastcipher - called by ucfg to configure connection + * request mcastcipher in vdev + * @crypto_params: pointer to crypto params structure + * @value: mcast cipher value. + * + * This function gets called from ucfg to configure mcastcipher in vdev + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS +wlan_crypto_set_orig_mcastcipher(struct wlan_crypto_params *crypto_params, + wlan_crypto_cipher_type value) +{ + crypto_params->orig_mcastcipher = value; + + return QDF_STATUS_SUCCESS; +} + +/** + * wlan_crypto_get_orig_mcastcipher - called by ucfg to get connection request + * mcastcipher value from vdev + * @crypto_params: pointer to crypto params structure + * + * This function gets called from ucfg to get mcastcipher of particular vdev + * + * Return: mcast cipher + */ +int32_t +wlan_crypto_get_orig_mcastcipher(struct wlan_crypto_params *crypto_params) +{ + return crypto_params->orig_mcastcipher; +} + +/** + * wlan_crypto_set_orig_key_mgmt - called by ucfg to configure connection + * request key_mgmt in vdev + * @crypto_params: pointer to crypto params structure + * @value: bitmap value of all supported AKMs + * + * This function gets called from ucfg to configure AKMs in vdev + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS +wlan_crypto_set_orig_key_mgmt(struct wlan_crypto_params *crypto_params, + uint32_t value) +{ + crypto_params->orig_key_mgmt = value; + + return QDF_STATUS_SUCCESS; +} + +/** + * wlan_crypto_get_orig_key_mgmt - called by ucfg to get connection request + * key mgmt value from vdev + * @crypto_params: pointer to crypto params structure + * + * This function gets called from ucfg to get supported AKMs + * + * Return: bitmap value of all supported AKMs + */ +int32_t wlan_crypto_get_orig_key_mgmt(struct wlan_crypto_params *crypto_params) +{ + return crypto_params->orig_key_mgmt; +} diff --git a/umac/cmn_services/crypto/src/wlan_crypto_param_handling_i.h b/umac/cmn_services/crypto/src/wlan_crypto_param_handling_i.h index d6198b4b2aa1..17d0edd0daf5 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_param_handling_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_param_handling_i.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -179,4 +180,80 @@ QDF_STATUS wlan_crypto_set_key_mgmt(struct wlan_crypto_params *crypto_params, * Return: bitmap value of all supported unicast ciphers */ int32_t wlan_crypto_get_key_mgmt(struct wlan_crypto_params *crypto_params); + +/** + * wlan_crypto_set_orig_ucastcipher - called by ucfg to configure connection + * request unicast ciphers in vdev + * @crypto_params: pointer to crypto params structure + * @value: bitmap value of all supported unicast ciphers + * + * This function gets called from ucfg to configure unicast ciphers in vdev + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS +wlan_crypto_set_orig_ucastcipher(struct wlan_crypto_params *crypto_params, + uint32_t value); + +/** + * wlan_crypto_get_orig_ucastcipher - called by ucfg to get connection request + * unicast cipher from vdev + * @crypto_params: pointer to crypto params structure + * + * This function gets called from ucfg to get supported unicast ciphers + * + * Return: bitmap value of all supported unicast ciphers + */ +int32_t +wlan_crypto_get_orig_ucastcipher(struct wlan_crypto_params *crypto_params); + +/** + * wlan_crypto_set_orig_mcastcipher - called by ucfg to configure connection + * request mcastcipher in vdev + * @crypto_params: pointer to crypto params structure + * @wlan_crypto_cipher_type: mcast cipher value. + * + * This function gets called from ucfg to configure mcastcipher in vdev + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS +wlan_crypto_set_orig_mcastcipher(struct wlan_crypto_params *crypto_params, + wlan_crypto_cipher_type cipher); +/** + * wlan_crypto_get_orig_mcastcipher - called by ucfg to get connection request + * mcastcipher from vdev + * @crypto_params: pointer to crypto params structure + * + * This function gets called from ucfg to get mcastcipher of particular vdev + * + * Return: mcast cipher + */ +int32_t +wlan_crypto_get_orig_mcastcipher(struct wlan_crypto_params *crypto_params); + +/** + * wlan_crypto_set_orig_key_mgmt - called by ucfg to configure connection + * request key_mgmt in vdev + * @crypto_params: pointer to crypto params structure + * @value: bitmap value of all supported AKMs + * + * This function gets called from ucfg to configure AKMs in vdev + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS +wlan_crypto_set_orig_key_mgmt(struct wlan_crypto_params *crypto_params, + uint32_t value); + +/** + * wlan_crypto_get_orig_key_mgmt - called by ucfg to get connection request key + * mgmt from vdev + * @crypto_params: pointer to crypto params structure + * + * This function gets called from ucfg to get supported AKMs + * + * Return: bitmap value of all supported AKMs + */ +int32_t wlan_crypto_get_orig_key_mgmt(struct wlan_crypto_params *crypto_params); #endif /* __WLAN_CRYPTO_PARAM_HANDLING_I_H_ */