qcacmn: Store default keyix in wlan_crypto_setkey for each peer

Store default keyix in crypto_priv for each peer.

Change-Id: Ieb77c390fddd667f99fd97c5ecdd4f3de61ae045
This commit is contained in:
Sai Pratyusha Magam
2021-12-29 10:20:28 +05:30
committed by Madan Koyyalamudi
父節點 6bbb8971e2
當前提交 5d58a41518
共有 2 個文件被更改,包括 54 次插入1 次删除

查看文件

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021 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
@@ -99,6 +100,20 @@ uint8_t wlan_crypto_is_htallowed(struct wlan_objmgr_vdev *vdev,
QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
struct wlan_crypto_req_key *req_key);
/**
* store_def_keyix_peer - called by wlan_crypto_setkey
* to store default key index for each peer in the vdev.
* @vdev: vdev
* @object: Peer object
* @arg: Argument passed by caller
*
* This function gets called from wlan_crypto_setkey
*
* Return: None
*/
void store_def_keyix_peer(struct wlan_objmgr_vdev *vdev, void *object,
void *arg);
/**
* wlan_crypto_getkey - called by ucfg to get key
* @vdev: vdev

查看文件

@@ -915,6 +915,7 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
return QDF_STATUS_E_NOMEM;
}
key = crypto_priv->key[req_key->keyix];
crypto_priv->def_tx_keyid = req_key->keyix;
}
if (vdev_mode == QDF_STA_MODE) {
peer = wlan_objmgr_vdev_try_get_bsspeer(vdev,
@@ -1112,12 +1113,19 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
if ((req_key->flags & WLAN_CRYPTO_KEY_DEFAULT) &&
(req_key->keyix != WLAN_CRYPTO_KEYIX_NONE) &&
(!IS_MGMT_CIPHER(req_key->type))) {
(!IS_MGMT_CIPHER(req_key->type)) && isbcast) {
/* default xmit key */
wlan_crypto_default_key(vdev,
req_key->macaddr,
req_key->keyix,
!isbcast);
/*Iterate through the peer list on this vdev
*and store the keyix in the peer's crypto_priv
*/
wlan_objmgr_iterate_peerobj_list(vdev, store_def_keyix_peer,
(void *)&req_key->keyix,
WLAN_CRYPTO_ID);
}
err:
if (peer)
@@ -1125,6 +1133,36 @@ err:
return status;
}
/**
* store_def_keyix_peer - store default keyix
* @vdev: vdev
* @object: Peer object
* @arg: Argument passed by caller
*
* This function gets called from wlan_crypto_setkey
*
* Return: None
*/
void store_def_keyix_peer(struct wlan_objmgr_vdev *vdev, void *object,
void *arg)
{
struct wlan_objmgr_peer *peer = NULL;
struct wlan_crypto_comp_priv *crypto_priv;
struct wlan_crypto_params *crypto_params;
uint16_t kid = *(uint16_t *)arg;
peer = (struct wlan_objmgr_peer *)object;
crypto_params = wlan_crypto_peer_get_comp_params(peer, &crypto_priv);
if (!crypto_priv) {
crypto_err("crypto_priv NULL");
return;
}
crypto_priv->def_tx_keyid = kid;
}
qdf_export_symbol(store_def_keyix_peer);
/**
* wlan_crypto_get_keytype - get keytype
* @key: key