Clear wpa_supplicant configuration keys explicitly

Use an explicit memset call to clear any wpa_supplicant configuration
parameter that contains private information like keys or identity. This
brings in an additional layer of protection by reducing the length of
time this type of private data is kept in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-06-30 01:32:07 +03:00
parent 28bfa29117
commit 19c48da06b
6 changed files with 63 additions and 39 deletions

View file

@ -827,3 +827,22 @@ void int_array_add_unique(int **res, int a)
*res = n;
}
void str_clear_free(char *str)
{
if (str) {
size_t len = os_strlen(str);
os_memset(str, 0, len);
os_free(str);
}
}
void bin_clear_free(void *bin, size_t len)
{
if (bin) {
os_memset(bin, 0, len);
os_free(bin);
}
}