aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2009-11-22 19:11:53 +0000
committerGreg Hudson <ghudson@mit.edu>2009-11-22 19:11:53 +0000
commit57c6b7049e6c2025cb020927f5f731e9f16bb702 (patch)
tree0ba00081b313f4a55a704ebf2fd65c45a99ec49c
parent7cfa6111bcf6f1dc4f111803819c523d1d830a7f (diff)
downloadkrb5-57c6b7049e6c2025cb020927f5f731e9f16bb702.zip
krb5-57c6b7049e6c2025cb020927f5f731e9f16bb702.tar.gz
krb5-57c6b7049e6c2025cb020927f5f731e9f16bb702.tar.bz2
Make zap() work with non-gcc C++ compilers.
Eliminate the intermediate name krb5int_zap_data. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23311 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/include/k5-int.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index dee37de..dbc50e3 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -752,19 +752,18 @@ krb5int_hmac_iov_keyblock(const struct krb5_hash_provider *hash,
krb5_error_code krb5int_pbkdf2_hmac_sha1(const krb5_data *, unsigned long,
const krb5_data *, const krb5_data *);
-/* Make this a function eventually? */
+/* Attempt to zero memory in a way that compilers won't optimize out. */
#ifdef _WIN32
-# define krb5int_zap_data(ptr, len) SecureZeroMemory(ptr, len)
+# define zap(ptr, len) SecureZeroMemory(ptr, len)
#elif defined(__GNUC__)
-static inline void krb5int_zap_data(void *ptr, size_t len)
+static inline void zap(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)
+# define zap(ptr, len) memset((void *)(volatile void *)ptr, 0, len)
#endif /* WIN32 */
-#define zap(p,l) krb5int_zap_data(p,l)
/* Convenience function: zap and free ptr if it is non-NULL. */
static inline void