Revert "[wpa_supplicant] Cumulative patch from b8491ae5a"
This reverts commit 878cf7bcbf2d7d8f08c3d060b8c5fbfcf0743eda.
Reason for revert: git_master/sdk_phone_armv7-sdk
Change-Id: I6070fc5c1f9c20867f6dfce90e529e35578d572e
diff --git a/src/utils/common.c b/src/utils/common.c
index 27bf435..b9c8bfd 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -230,16 +230,6 @@
}
-void buf_shift_right(u8 *buf, size_t len, size_t bits)
-{
- size_t i;
-
- for (i = len - 1; i > 0; i--)
- buf[i] = (buf[i - 1] << (8 - bits)) | (buf[i] >> bits);
- buf[0] >>= bits;
-}
-
-
void wpa_get_ntp_timestamp(u8 *buf)
{
struct os_time now;
@@ -970,7 +960,7 @@
{
if (str) {
size_t len = os_strlen(str);
- forced_memzero(str, len);
+ os_memset(str, 0, len);
os_free(str);
}
}
@@ -979,7 +969,7 @@
void bin_clear_free(void *bin, size_t len)
{
if (bin) {
- forced_memzero(bin, len);
+ os_memset(bin, 0, len);
os_free(bin);
}
}
@@ -1259,22 +1249,3 @@
val[len] = '\0';
return val;
}
-
-
-/* Try to prevent most compilers from optimizing out clearing of memory that
- * becomes unaccessible after this function is called. This is mostly the case
- * for clearing local stack variables at the end of a function. This is not
- * exactly perfect, i.e., someone could come up with a compiler that figures out
- * the pointer is pointing to memset and then end up optimizing the call out, so
- * try go a bit further by storing the first octet (now zero) to make this even
- * a bit more difficult to optimize out. Once memset_s() is available, that
- * could be used here instead. */
-static void * (* const volatile memset_func)(void *, int, size_t) = memset;
-static u8 forced_memzero_val;
-
-void forced_memzero(void *ptr, size_t len)
-{
- memset_func(ptr, 0, len);
- if (len)
- forced_memzero_val = ((u8 *) ptr)[0];
-}