From 4c0eaac13ac6901977085e43c5e108b99b8b5d95 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Wed, 19 Sep 2018 13:45:47 -0700 Subject: [PATCH] qcacld-3.0: crypto convergence support for SET KEY Make changes to the legacy code to support the new SET KEY converged infrastructure. Change-Id: Ic5359e3a9035ac5f2a937a9a1013fa92764cda9d CRs-Fixed: 2358795 --- mlme/dispatcher/inc/wlan_mlme_api.h | 6 +++-- mlme/dispatcher/src/wlan_mlme_api.c | 35 +++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/mlme/dispatcher/inc/wlan_mlme_api.h b/mlme/dispatcher/inc/wlan_mlme_api.h index 65804bf3e9..8774bfcd83 100644 --- a/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/mlme/dispatcher/inc/wlan_mlme_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. 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 @@ -64,6 +64,7 @@ QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params, /* * mlme_get_wep_key() - get the wep key to process during auth frame + * @vdev: VDEV object for which the wep key is being requested * @wep_params: cfg wep parameters structure * @wep_key_id: default key number * @default_key: default key to be copied @@ -71,7 +72,8 @@ QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params, * * Return QDF_STATUS */ -QDF_STATUS mlme_get_wep_key(struct wlan_mlme_wep_cfg *wep_params, +QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev, + struct wlan_mlme_wep_cfg *wep_params, enum wep_key_id wep_keyid, uint8_t *default_key, qdf_size_t *key_len); diff --git a/mlme/dispatcher/src/wlan_mlme_api.c b/mlme/dispatcher/src/wlan_mlme_api.c index ce2bcad40a..3b1e4cbbdf 100644 --- a/mlme/dispatcher/src/wlan_mlme_api.c +++ b/mlme/dispatcher/src/wlan_mlme_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. 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 @@ -26,6 +26,7 @@ #include "wmi_unified.h" #include "wma.h" #include "wma_internal.h" +#include "wlan_crypto_global_api.h" QDF_STATUS wlan_mlme_get_cfg_str(uint8_t *dst, struct mlme_cfg_str *cfg_str, qdf_size_t *len) @@ -2140,7 +2141,36 @@ QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params, return QDF_STATUS_SUCCESS; } -QDF_STATUS mlme_get_wep_key(struct wlan_mlme_wep_cfg *wep_params, +#ifdef CRYPTO_SET_KEY_CONVERGED +QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev, + struct wlan_mlme_wep_cfg *wep_params, + enum wep_key_id wep_keyid, uint8_t *default_key, + qdf_size_t *key_len) +{ + struct wlan_crypto_key *crypto_key = NULL; + + if (wep_keyid >= WLAN_CRYPTO_MAXKEYIDX) { + mlme_err("Incorrect wep key index %d", wep_keyid); + return QDF_STATUS_E_INVAL; + } + crypto_key = wlan_crypto_get_key(vdev, wep_keyid); + if (crypto_key == NULL) { + mlme_err("Crypto KEY not present"); + return QDF_STATUS_E_INVAL; + } + + if (crypto_key->keylen > WLAN_CRYPTO_KEY_WEP104_LEN) { + mlme_err("Key too large to hold"); + return QDF_STATUS_E_INVAL; + } + *key_len = crypto_key->keylen; + qdf_mem_copy(default_key, &crypto_key->keyval, crypto_key->keylen); + + return QDF_STATUS_SUCCESS; +} +#else +QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev, + struct wlan_mlme_wep_cfg *wep_params, enum wep_key_id wep_keyid, uint8_t *default_key, qdf_size_t *key_len) { @@ -2176,6 +2206,7 @@ QDF_STATUS mlme_get_wep_key(struct wlan_mlme_wep_cfg *wep_params, mlme_debug("key_id:%d key_len:%zd", wep_keyid, *key_len); return QDF_STATUS_SUCCESS; } +#endif /* CRYPTO_SET_KEY_CONVERGED */ QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params, enum wep_key_id wep_keyid, uint8_t *key_to_set,