mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
qcacmn: Error handling in Crypto API
Incorporate cleanup in the error handling for Crypto API. Change-Id: I223d8149eada20b7bf5b2c92d485a26b88d1a00e
This commit is contained in:
parent
2b0ec006bd
commit
bc64bbccf3
1 changed files with 76 additions and 24 deletions
|
|
@ -254,7 +254,7 @@ QDF_STATUS wlan_crypto_set_peer_param(struct wlan_objmgr_peer *peer,
|
|||
static int32_t wlan_crypto_get_param_value(wlan_crypto_param_type param,
|
||||
struct wlan_crypto_params *crypto_params)
|
||||
{
|
||||
int32_t value = -1;
|
||||
int32_t value;
|
||||
|
||||
switch (param) {
|
||||
case WLAN_CRYPTO_PARAM_AUTH_MODE:
|
||||
|
|
@ -279,7 +279,7 @@ static int32_t wlan_crypto_get_param_value(wlan_crypto_param_type param,
|
|||
value = wlan_crypto_get_key_mgmt(crypto_params);
|
||||
break;
|
||||
default:
|
||||
value = QDF_STATUS_E_INVAL;
|
||||
value = -1;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
@ -305,7 +305,7 @@ int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev,
|
|||
|
||||
if (!crypto_priv) {
|
||||
crypto_err("crypto_priv NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
return value;
|
||||
}
|
||||
|
||||
crypto_params = &(crypto_priv->crypto_params);
|
||||
|
|
@ -334,7 +334,7 @@ int32_t wlan_crypto_get_peer_param(struct wlan_objmgr_peer *peer,
|
|||
|
||||
if (!crypto_params) {
|
||||
crypto_err("crypto_params NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
return value;
|
||||
}
|
||||
value = wlan_crypto_get_param_value(param, crypto_params);
|
||||
|
||||
|
|
@ -628,6 +628,11 @@ uint8_t wlan_crypto_is_htallowed(struct wlan_objmgr_vdev *vdev,
|
|||
ucast_cipher = wlan_crypto_get_peer_param(peer,
|
||||
WLAN_CRYPTO_PARAM_UCAST_CIPHER);
|
||||
|
||||
if (ucast_cipher == -1) {
|
||||
crypto_err("Invalid params");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_WEP)) ||
|
||||
((ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_TKIP)) &&
|
||||
!(ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_CCM)) &&
|
||||
|
|
@ -1866,7 +1871,7 @@ bool wlan_crypto_vdev_is_pmf_enabled(struct wlan_objmgr_vdev *vdev)
|
|||
&crypto_priv);
|
||||
if (!crypto_priv) {
|
||||
crypto_err("crypto_priv NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((vdev_crypto_params->rsn_caps &
|
||||
|
|
@ -1899,7 +1904,7 @@ bool wlan_crypto_vdev_is_pmf_required(struct wlan_objmgr_vdev *vdev)
|
|||
&crypto_priv);
|
||||
if (!crypto_priv) {
|
||||
crypto_err("crypto_priv NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vdev_crypto_params->rsn_caps & WLAN_CRYPTO_RSN_CAP_MFP_REQUIRED)
|
||||
|
|
@ -1930,14 +1935,14 @@ bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev,
|
|||
&crypto_priv);
|
||||
if (!crypto_priv) {
|
||||
crypto_err("crypto_priv NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
peer_crypto_params = wlan_crypto_peer_get_comp_params(peer,
|
||||
&crypto_priv);
|
||||
if (!crypto_priv) {
|
||||
crypto_err("crypto_priv NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
return false;
|
||||
}
|
||||
if (((vdev_crypto_params->rsn_caps &
|
||||
WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) &&
|
||||
|
|
@ -3533,8 +3538,13 @@ qdf_export_symbol(wlan_crypto_get_crypto_rx_ops);
|
|||
bool wlan_crypto_vdev_has_auth_mode(struct wlan_objmgr_vdev *vdev,
|
||||
wlan_crypto_auth_mode authvalue)
|
||||
{
|
||||
return wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_AUTH_MODE)
|
||||
& authvalue;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_AUTH_MODE);
|
||||
|
||||
if (res != -1)
|
||||
return (res & authvalue) ? true : false;
|
||||
return false;
|
||||
}
|
||||
qdf_export_symbol(wlan_crypto_vdev_has_auth_mode);
|
||||
|
||||
|
|
@ -3550,8 +3560,14 @@ qdf_export_symbol(wlan_crypto_vdev_has_auth_mode);
|
|||
bool wlan_crypto_peer_has_auth_mode(struct wlan_objmgr_peer *peer,
|
||||
wlan_crypto_auth_mode authvalue)
|
||||
{
|
||||
return wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_AUTH_MODE)
|
||||
& authvalue;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_AUTH_MODE);
|
||||
|
||||
if (res != -1)
|
||||
return (res & authvalue) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
qdf_export_symbol(wlan_crypto_peer_has_auth_mode);
|
||||
|
||||
|
|
@ -3567,8 +3583,14 @@ qdf_export_symbol(wlan_crypto_peer_has_auth_mode);
|
|||
bool wlan_crypto_vdev_has_ucastcipher(struct wlan_objmgr_vdev *vdev,
|
||||
wlan_crypto_cipher_type ucastcipher)
|
||||
{
|
||||
return wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_UCAST_CIPHER)
|
||||
& ucastcipher;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_UCAST_CIPHER);
|
||||
|
||||
if (res != -1)
|
||||
return (res & ucastcipher) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
qdf_export_symbol(wlan_crypto_vdev_has_ucastcipher);
|
||||
|
||||
|
|
@ -3584,8 +3606,14 @@ qdf_export_symbol(wlan_crypto_vdev_has_ucastcipher);
|
|||
bool wlan_crypto_peer_has_ucastcipher(struct wlan_objmgr_peer *peer,
|
||||
wlan_crypto_cipher_type ucastcipher)
|
||||
{
|
||||
return wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_UCAST_CIPHER)
|
||||
& ucastcipher;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_UCAST_CIPHER);
|
||||
|
||||
if (res != -1)
|
||||
return (res & ucastcipher) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
qdf_export_symbol(wlan_crypto_peer_has_ucastcipher);
|
||||
|
||||
|
|
@ -3601,8 +3629,14 @@ qdf_export_symbol(wlan_crypto_peer_has_ucastcipher);
|
|||
bool wlan_crypto_vdev_has_mcastcipher(struct wlan_objmgr_vdev *vdev,
|
||||
wlan_crypto_cipher_type mcastcipher)
|
||||
{
|
||||
return wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_MCAST_CIPHER)
|
||||
& mcastcipher;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_MCAST_CIPHER);
|
||||
|
||||
if (res != -1)
|
||||
return (res & mcastcipher) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
qdf_export_symbol(wlan_crypto_vdev_has_mcastcipher);
|
||||
|
||||
|
|
@ -3618,8 +3652,14 @@ qdf_export_symbol(wlan_crypto_vdev_has_mcastcipher);
|
|||
bool wlan_crypto_peer_has_mcastcipher(struct wlan_objmgr_peer *peer,
|
||||
wlan_crypto_cipher_type mcastcipher)
|
||||
{
|
||||
return wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_MCAST_CIPHER)
|
||||
& mcastcipher;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_MCAST_CIPHER);
|
||||
|
||||
if (res != -1)
|
||||
return (res & mcastcipher) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
qdf_export_symbol(wlan_crypto_peer_has_mcastcipher);
|
||||
|
||||
|
|
@ -3635,8 +3675,14 @@ qdf_export_symbol(wlan_crypto_peer_has_mcastcipher);
|
|||
bool wlan_crypto_vdev_has_mgmtcipher(struct wlan_objmgr_vdev *vdev,
|
||||
uint32_t mgmtcipher)
|
||||
{
|
||||
return (wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_MGMT_CIPHER)
|
||||
& mgmtcipher) != 0;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_MGMT_CIPHER);
|
||||
|
||||
if (res != -1)
|
||||
return (res & mgmtcipher) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
qdf_export_symbol(wlan_crypto_vdev_has_mgmtcipher);
|
||||
|
|
@ -3653,8 +3699,14 @@ qdf_export_symbol(wlan_crypto_vdev_has_mgmtcipher);
|
|||
bool wlan_crypto_peer_has_mgmtcipher(struct wlan_objmgr_peer *peer,
|
||||
uint32_t mgmtcipher)
|
||||
{
|
||||
return (wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_MGMT_CIPHER)
|
||||
& mgmtcipher) != 0;
|
||||
int res;
|
||||
|
||||
res = wlan_crypto_get_peer_param(peer, WLAN_CRYPTO_PARAM_MGMT_CIPHER);
|
||||
|
||||
if (res != -1)
|
||||
return (res & mgmtcipher) ? true : false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
qdf_export_symbol(wlan_crypto_peer_has_mgmtcipher);
|
||||
|
|
|
|||
Loading…
Reference in a new issue