summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2007-05-21 21:44:40 +0000
committerKen Raeburn <raeburn@mit.edu>2007-05-21 21:44:40 +0000
commit659539f21538312c0871ff42e31b826c3f99b72f (patch)
tree33683c278507c1dd5d9aac3531cc2d02ba2e6635 /src/include
parent0be84296eaaa7432b0e13edd1e9bc5d1557befef (diff)
downloadkrb5-659539f21538312c0871ff42e31b826c3f99b72f.tar.gz
krb5-659539f21538312c0871ff42e31b826c3f99b72f.tar.xz
krb5-659539f21538312c0871ff42e31b826c3f99b72f.zip
Simplify UNIX krb5int_zap_data a little. Omit volatile cast, just call memset,
but for gcc, use a volatile asm afterwards to make the memory appear to be referenced and deter optimizations that would remove the memset. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19553 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
-rw-r--r--src/include/k5-int.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index 93a0b1abb2..0b01026ec4 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -684,18 +684,14 @@ krb5_error_code krb5int_pbkdf2_hmac_sha1 (const krb5_data *, unsigned long,
/* Make this a function eventually? */
#ifdef _WIN32
# define krb5int_zap_data(ptr, len) SecureZeroMemory(ptr, len)
-#elif defined(__palmos__) && !defined(__GNUC__)
-/* CodeWarrior 8.3 complains about passing a pointer to volatile in to
- memset. On the other hand, we probably want it for gcc. */
-# define krb5int_zap_data(ptr, len) memset(ptr, 0, len)
+#elif defined(__GNUC__)
+static inline void krb5int_zap_data(void *ptr, size_t len)
+{
+ memset(ptr, 0, len);
+ asm volatile ("" : : "g" (ptr), "g" (len));
+}
#else
# define krb5int_zap_data(ptr, len) memset((volatile void *)ptr, 0, len)
-# if defined(__GNUC__) && defined(__GLIBC__)
-/* GNU libc generates multiple bogus initialization warnings if we
- pass memset a volatile pointer. The compiler should do well enough
- with memset even without GNU libc's attempt at optimization. */
-# undef memset
-# endif
#endif /* WIN32 */
#define zap(p,l) krb5int_zap_data(p,l)