qcacmn: Print Optimization
Came up with changes to replace “qdf_print” with crypto_err/ crypto_debug/crypto_info implementing QDF_TRACE in crypto component, to avoid flooding of error prints on the console. Change-Id: I411efd78f808f7c893ece9096ebc429c8753fc82 CRs-Fixed: 2299590
Esse commit está contido em:
@@ -9,6 +9,7 @@
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_mem.h>
|
||||
#include <qdf_util.h>
|
||||
@@ -45,8 +46,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L,
|
||||
wlan_crypto_aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
|
||||
|
||||
if (!aad_len) {
|
||||
qdf_print("%s[%d] aad length should be non zero",
|
||||
__func__, __LINE__);
|
||||
crypto_err("aad length should be non zero");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,7 @@ uint8_t *wlan_crypto_ccmp_decrypt(const uint8_t *tk,
|
||||
|
||||
plain = qdf_mem_malloc(data_len + AES_BLOCK_SIZE);
|
||||
if (plain == NULL) {
|
||||
qdf_print("%s[%d] mem alloc failed", __func__, __LINE__);
|
||||
crypto_err("mem alloc failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ uint8_t *wlan_crypto_ccmp_encrypt(const uint8_t *tk, uint8_t *frame,
|
||||
crypt = qdf_mem_malloc(hdrlen + CCMP_IV_SIZE + plen
|
||||
+ WLAN_CRYPTO_MIC_LEN + AES_BLOCK_SIZE);
|
||||
if (crypt == NULL) {
|
||||
qdf_print("%s[%d] mem alloc failed", __func__, __LINE__);
|
||||
crypto_err("mem alloc failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ uint8_t *wlan_crypto_ccmp_256_decrypt(const uint8_t *tk,
|
||||
|
||||
plain = qdf_mem_malloc(data_len + AES_BLOCK_SIZE);
|
||||
if (plain == NULL) {
|
||||
qdf_print("%s[%d] mem alloc failed", __func__, __LINE__);
|
||||
crypto_err("mem alloc failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ uint8_t *wlan_crypto_ccmp_256_encrypt(const uint8_t *tk, uint8_t *frame,
|
||||
crypt = qdf_mem_malloc(hdrlen + CCMP_IV_SIZE + plen
|
||||
+ WLAN_CRYPTO_MIC256_LEN + AES_BLOCK_SIZE);
|
||||
if (crypt == NULL) {
|
||||
qdf_print("%s[%d] mem alloc failed", __func__, __LINE__);
|
||||
crypto_err("mem alloc failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -39,8 +39,6 @@
|
||||
#include "wlan_crypto_aes_siv_i.h"
|
||||
#endif /* WLAN_SUPPORT_FILS */
|
||||
|
||||
#include <qdf_trace.h>
|
||||
|
||||
#define ASSOC_RESP_FIXED_FIELDS_LEN 6 /* cap info + status + assoc id */
|
||||
#define ASSOC_REQ_FIXED_FIELDS_LEN 4 /* cap info + listen interval */
|
||||
#define REASSOC_REQ_FIXED_FIELDS_LEN 10 /* cap info + listen interval + BSSID */
|
||||
@@ -77,8 +75,9 @@ fils_parse_ie(qdf_nbuf_t wbuf, uint8_t hdrlen, uint8_t **cap_info,
|
||||
pktlen_left = qdf_nbuf_len(wbuf);
|
||||
|
||||
if (pktlen_left < hdrlen) {
|
||||
qdf_err("Parse error.pktlen_left:%d Framehdr size:%d",
|
||||
pktlen_left, hdrlen);
|
||||
crypto_err(
|
||||
"Parse error.pktlen_left:%d Framehdr size:%d",
|
||||
pktlen_left, hdrlen);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
@@ -92,8 +91,9 @@ fils_parse_ie(qdf_nbuf_t wbuf, uint8_t hdrlen, uint8_t **cap_info,
|
||||
subtype == WLAN_FC0_STYPE_REASSOC_RESP) {
|
||||
/* assoc resp frame - capability (2), status (2), associd (2) */
|
||||
if (pktlen_left < ASSOC_RESP_FIXED_FIELDS_LEN) {
|
||||
qdf_err("Parse error.pktlen_left:%d Fixed Fields len:%d",
|
||||
pktlen_left, ASSOC_RESP_FIXED_FIELDS_LEN);
|
||||
crypto_err(
|
||||
"Parse error.pktlen_left:%d Fixed Fields len:%d",
|
||||
pktlen_left, ASSOC_RESP_FIXED_FIELDS_LEN);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
@@ -102,8 +102,9 @@ fils_parse_ie(qdf_nbuf_t wbuf, uint8_t hdrlen, uint8_t **cap_info,
|
||||
} else if (subtype == WLAN_FC0_STYPE_ASSOC_REQ) {
|
||||
/* assoc req frame - capability(2), listen interval (2) */
|
||||
if (pktlen_left < ASSOC_REQ_FIXED_FIELDS_LEN) {
|
||||
qdf_err("Parse Error.pktlen_left:%d Fixed Fields len:%d",
|
||||
pktlen_left, ASSOC_REQ_FIXED_FIELDS_LEN);
|
||||
crypto_err(
|
||||
"Parse Error.pktlen_left:%d Fixed Fields len:%d",
|
||||
pktlen_left, ASSOC_REQ_FIXED_FIELDS_LEN);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
@@ -115,11 +116,11 @@ fils_parse_ie(qdf_nbuf_t wbuf, uint8_t hdrlen, uint8_t **cap_info,
|
||||
* Current AP address(6)
|
||||
*/
|
||||
if (pktlen_left < REASSOC_REQ_FIXED_FIELDS_LEN) {
|
||||
qdf_err("Parse Error.pktlen_left:%d Fixed Fields len:%d",
|
||||
pktlen_left, REASSOC_REQ_FIXED_FIELDS_LEN);
|
||||
crypto_err(
|
||||
"Parse Error.pktlen_left:%d Fixed Fields len:%d",
|
||||
pktlen_left, REASSOC_REQ_FIXED_FIELDS_LEN);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
frm += REASSOC_REQ_FIXED_FIELDS_LEN;
|
||||
pktlen_left -= REASSOC_REQ_FIXED_FIELDS_LEN;
|
||||
}
|
||||
@@ -137,23 +138,25 @@ fils_parse_ie(qdf_nbuf_t wbuf, uint8_t hdrlen, uint8_t **cap_info,
|
||||
/* for extension element, check the sub element ID */
|
||||
if (elem_id == WLAN_ELEMID_EXTN_ELEM) {
|
||||
if ((len + 1) > pktlen_left) {
|
||||
qdf_err("Parse Error.pktlen_left:%did:%d",
|
||||
pktlen_left, elem_id);
|
||||
qdf_err("len:%dextid:%d", len, *frm);
|
||||
crypto_err(
|
||||
"Parse Error.pktlen_left:%did:%d",
|
||||
pktlen_left, elem_id);
|
||||
crypto_err("len:%dextid:%d", len, *frm);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (*frm == WLAN_ELEMID_EXT_FILS_SESSION) {
|
||||
fils_found = 1;
|
||||
break;
|
||||
if (*frm == WLAN_ELEMID_EXT_FILS_SESSION) {
|
||||
fils_found = 1;
|
||||
break;
|
||||
}
|
||||
frm++;
|
||||
pktlen_left--;
|
||||
frm++;
|
||||
pktlen_left--;
|
||||
}
|
||||
|
||||
if (len > pktlen_left) {
|
||||
qdf_err("Parse Error.pktlen_left:%did:%dlen:%dextid:%d",
|
||||
pktlen_left, elem_id, len, *frm);
|
||||
crypto_err(
|
||||
"Parse Error.pktlen_left:%d id:%dlen:%d extid:%d",
|
||||
pktlen_left, elem_id, len, *frm);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
@@ -163,7 +166,7 @@ fils_parse_ie(qdf_nbuf_t wbuf, uint8_t hdrlen, uint8_t **cap_info,
|
||||
}
|
||||
|
||||
if (!fils_found) {
|
||||
qdf_err("FILS session element not found. Parse failed");
|
||||
crypto_err("FILS session element not found. Parse failed");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
@@ -185,13 +188,13 @@ static QDF_STATUS fils_aead_setkey(struct wlan_crypto_key *key)
|
||||
struct wlan_crypto_fils_aad_key *fils_key;
|
||||
|
||||
if (!key || !key->private) {
|
||||
qdf_err("Failed to set FILS key");
|
||||
crypto_err("Failed to set FILS key");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
req_key = key->private;
|
||||
fils_key = qdf_mem_malloc(sizeof(struct wlan_crypto_fils_aad_key));
|
||||
if (!fils_key) {
|
||||
qdf_err("FILS key alloc failed");
|
||||
crypto_err("FILS key alloc failed");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
qdf_mem_copy(fils_key, &req_key->filsaad,
|
||||
@@ -229,24 +232,24 @@ fils_aead_encap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
uint8_t subtype = 0;
|
||||
|
||||
if (!key) {
|
||||
qdf_err("Invalid Input");
|
||||
crypto_err("Invalid Input");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
fils_key = (struct wlan_crypto_fils_aad_key *)key->private;
|
||||
if (!fils_key) {
|
||||
qdf_err("Key is not set");
|
||||
crypto_err("Key is not set");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (!fils_key->kek_len) {
|
||||
qdf_err("Key len is zero. Returning error");
|
||||
crypto_err("Key len is zero. Returning error");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
hdr = (struct ieee80211_hdr *)qdf_nbuf_data(wbuf);
|
||||
if (!hdr) {
|
||||
qdf_err("Invalid header");
|
||||
crypto_err("Invalid header");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
@@ -257,7 +260,7 @@ fils_aead_encap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
|
||||
if (fils_parse_ie(wbuf, hdrlen, &cap_info, &fils_session, &ie_start)
|
||||
!= QDF_STATUS_SUCCESS) {
|
||||
qdf_err("FILS Parsing failed");
|
||||
crypto_err("FILS Parsing failed");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
@@ -283,7 +286,7 @@ fils_aead_encap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
+ AES_BLOCK_SIZE;
|
||||
buf = qdf_mem_malloc(bufsize);
|
||||
if (!buf) {
|
||||
qdf_err("temp buf allocation failed");
|
||||
crypto_err("temp buf allocation failed");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
qdf_mem_copy(buf, ie_start, bufsize);
|
||||
@@ -292,13 +295,13 @@ fils_aead_encap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
fils_session, crypt_len, 5, address,
|
||||
length, buf + (fils_session - ie_start))
|
||||
< 0) {
|
||||
qdf_err("aes siv_encryption failed");
|
||||
crypto_err("aes siv_encryption failed");
|
||||
qdf_mem_free(buf);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (!qdf_nbuf_put_tail(wbuf, AES_BLOCK_SIZE))
|
||||
qdf_err("Unable to put data in nbuf");
|
||||
crypto_err("Unable to put data in nbuf");
|
||||
|
||||
qdf_mem_copy(ie_start, buf, bufsize);
|
||||
qdf_mem_free(buf);
|
||||
@@ -331,30 +334,30 @@ fils_aead_decap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
uint32_t bufsize = 0;
|
||||
|
||||
if (!key) {
|
||||
qdf_err("Invalid Input");
|
||||
crypto_err("Invalid Input");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
fils_key = (struct wlan_crypto_fils_aad_key *)key->private;
|
||||
if (!fils_key) {
|
||||
qdf_err("Key is not set");
|
||||
crypto_err("Key is not set");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (!fils_key->kek_len) {
|
||||
qdf_err("Key len is zero. Returning error");
|
||||
crypto_err("Key len is zero. Returning error");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (fils_parse_ie(wbuf, hdrlen, &cap_info, &fils_session, &ie_start)
|
||||
!= QDF_STATUS_SUCCESS) {
|
||||
qdf_err("IE parse failed");
|
||||
crypto_err("IE parse failed");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
hdr = (struct ieee80211_hdr *)qdf_nbuf_data(wbuf);
|
||||
if (!hdr) {
|
||||
qdf_err("Invalid header");
|
||||
crypto_err("Invalid header");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
@@ -377,9 +380,11 @@ fils_aead_decap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
crypt_len = ((uint8_t *)hdr + (uint32_t)qdf_nbuf_len(wbuf))
|
||||
- fils_session;
|
||||
if (crypt_len < AES_BLOCK_SIZE) {
|
||||
qdf_err("Not enough room for AES-SIV data after FILS Session");
|
||||
qdf_err(" element in (Re)Association Request frame from %pM",
|
||||
hdr->addr1);
|
||||
crypto_err(
|
||||
"Not enough room for AES-SIV data after FILS Session");
|
||||
crypto_err(
|
||||
" element in (Re)Association Request frame from %pM",
|
||||
hdr->addr1);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
@@ -387,7 +392,7 @@ fils_aead_decap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
bufsize = (uint8_t *)hdr + (uint32_t)qdf_nbuf_len(wbuf) - ie_start;
|
||||
buf = qdf_mem_malloc(bufsize);
|
||||
if (!buf) {
|
||||
qdf_err("temp buf allocation failed");
|
||||
crypto_err("temp buf allocation failed");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
qdf_mem_copy(buf, ie_start, bufsize);
|
||||
@@ -396,8 +401,8 @@ fils_aead_decap(struct wlan_crypto_key *key, qdf_nbuf_t wbuf,
|
||||
fils_session, crypt_len, 5, address,
|
||||
length, buf + (fils_session - ie_start))
|
||||
< 0) {
|
||||
qdf_err("AES decrypt of assocreq frame from %s failed",
|
||||
ether_sprintf(hdr->addr1));
|
||||
crypto_err("AES decrypt of assocreq frame from %s failed",
|
||||
ether_sprintf(hdr->addr1));
|
||||
qdf_mem_free(buf);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
@@ -414,13 +419,13 @@ void wlan_crypto_fils_delkey(struct wlan_objmgr_peer *peer)
|
||||
struct wlan_crypto_key *key = NULL;
|
||||
|
||||
if (!peer) {
|
||||
qdf_err("Invalid Input");
|
||||
crypto_err("Invalid Input");
|
||||
return;
|
||||
}
|
||||
|
||||
crypto_priv = wlan_get_peer_crypto_obj(peer);
|
||||
if (!crypto_priv) {
|
||||
qdf_err("crypto_priv NULL");
|
||||
crypto_err("crypto_priv NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Referência em uma nova issue
Block a user