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
This commit is contained in:
Srikanth Marepalli 2024-01-29 20:45:05 +05:30 • committed by Ravindra Konda
commit 95eee69154
4 changed files with 206 additions and 0 deletions

View file

@ -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;
/**

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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_ */