aboutsummaryrefslogtreecommitdiffstats
path: root/epan/crypt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2007-10-31 00:15:17 +0000
committerGerald Combs <gerald@wireshark.org>2007-10-31 00:15:17 +0000
commit6327c19912074cbca33b48581bf1337edcf96328 (patch)
treef9ccecf7fcafa6f2e69bf8b671431f1aa4498541 /epan/crypt
parent5753ea42ceec0188e3edb765c2fe740eb2354f61 (diff)
From Christopher McKenzie: Zero out our SAs before we use them.
Remove an unneeded for loop in AirPDcapCleanKeys(), and make it static. svn path=/trunk/; revision=23314
Diffstat (limited to 'epan/crypt')
-rw-r--r--epan/crypt/airpdcap.c16
-rw-r--r--epan/crypt/airpdcap_system.h14
2 files changed, 8 insertions, 22 deletions
diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c
index 757ab18f82..87297056e3 100644
--- a/epan/crypt/airpdcap.c
+++ b/epan/crypt/airpdcap.c
@@ -231,6 +231,8 @@ static void AirPDcapRsnaPrfX(
UCHAR *ptk)
;
+static void AirPDcapCleanKeys(PAIRPDCAP_CONTEXT ctx);
+
#ifdef __cplusplus
}
#endif
@@ -474,28 +476,24 @@ INT AirPDcapSetKeys(
return success;
}
-INT AirPDcapCleanKeys(
+static void
+AirPDcapCleanKeys(
PAIRPDCAP_CONTEXT ctx)
{
- INT i;
AIRPDCAP_DEBUG_TRACE_START("AirPDcapCleanKeys");
if (ctx==NULL) {
AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapCleanKeys", "NULL context", AIRPDCAP_DEBUG_LEVEL_5);
AIRPDCAP_DEBUG_TRACE_END("AirPDcapCleanKeys");
- return 0;
+ return;
}
- for (i=0; i<AIRPDCAP_MAX_KEYS_NR; i++) {
- memset(&ctx->keys[i], 0, sizeof(AIRPDCAP_KEY_ITEM));
- }
+ memset(ctx->keys, 0, sizeof(AIRPDCAP_KEY_ITEM) * AIRPDCAP_MAX_KEYS_NR);
ctx->keys_nr=0;
AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapCleanKeys", "Keys collection cleaned!", AIRPDCAP_DEBUG_LEVEL_5);
AIRPDCAP_DEBUG_TRACE_END("AirPDcapCleanKeys");
-
- return i;
}
INT AirPDcapGetKeys(
@@ -565,6 +563,8 @@ INT AirPDcapInitContext(
ctx->last_stored_index=-1;
ctx->pkt_ssid_len = 0;
+ memset(ctx->sa, 0, AIRPDCAP_MAX_SEC_ASSOCIATIONS_NR * sizeof(AIRPDCAP_SEC_ASSOCIATION));
+
AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapInitContext", "Context initialized!", AIRPDCAP_DEBUG_LEVEL_5);
AIRPDCAP_DEBUG_TRACE_END("AirPDcapInitContext");
return AIRPDCAP_RET_SUCCESS;
diff --git a/epan/crypt/airpdcap_system.h b/epan/crypt/airpdcap_system.h
index 91846d3f58..758beed8d3 100644
--- a/epan/crypt/airpdcap_system.h
+++ b/epan/crypt/airpdcap_system.h
@@ -256,20 +256,6 @@ extern INT AirPDcapSetKeys(
;
/**
- * Remove all keys from the active database
- * @param ctx [IN] pointer to the current context
- * @return The number of keys correctly removed.
- *
- * @note
- * This function is not thread-safe when used in parallel with context
- * management functions and the packet process function on the same
- * context.
- */
-INT AirPDcapCleanKeys(
- PAIRPDCAP_CONTEXT ctx)
- ;
-
-/**
* It gets the keys collection fom the specified context.
* @param ctx [IN] pointer to the current context
* @param key [IN] a preallocated array of keys to be returned