diff options
| author | Jeffrey Altman <jaltman@secure-endpoints.com> | 2004-07-15 07:38:09 +0000 |
|---|---|---|
| committer | Jeffrey Altman <jaltman@secure-endpoints.com> | 2004-07-15 07:38:09 +0000 |
| commit | 492e321bff67f150817dac59d9633bd17a07ccd7 (patch) | |
| tree | 6583a933b3845790a09d8ce05b928f9f8f2ef9ad /src/include | |
| parent | a72be1fe336ddc69a8f9fe6df9ff3ca947ac7fa0 (diff) | |
| download | krb5-492e321bff67f150817dac59d9633bd17a07ccd7.tar.gz krb5-492e321bff67f150817dac59d9633bd17a07ccd7.tar.xz krb5-492e321bff67f150817dac59d9633bd17a07ccd7.zip | |
* k5-int.h: define for WIN32 the macro krb5int_zap_data to
utilize the Win32 API SecureZeroMemory which is guaranteed
by Microsoft not to be optimized out by the compiler.
Both memset and ZeroMemory will be optimized out by the
compiler when possible.
ticket: new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16600 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ChangeLog | 9 | ||||
| -rw-r--r-- | src/include/k5-int.h | 12 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 9bceef3ad6..75eb6c6a62 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,11 @@ +2004-07-14 Jeffrey Altman <jaltman@mit.edu> + + * k5-int.h: define for WIN32 the macro krb5int_zap_data to + utilize the Win32 API SecureZeroMemory which is guaranteed + by Microsoft not to be optimized out by the compiler. + Both memset and ZeroMemory will be optimized out by the + compiler when possible. + 2004-07-13 Ken Raeburn <raeburn@mit.edu> * k5-platform.h (k5_call_init_function) [DELAY_INITIALIZER] @@ -24,6 +32,7 @@ * fake-addrinfo.h (in6addr_any): If we need to define a static copy, rename it with a macro first. +>>>>>>> 1.444 2004-07-09 Ken Raeburn <raeburn@mit.edu> * k5-thread.h: Test HAVE_PTHREAD instead of HAVE_PTHREAD_H. diff --git a/src/include/k5-int.h b/src/include/k5-int.h index fe7a5a113d..d668f1ec9a 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -672,13 +672,17 @@ krb5_error_code krb5int_pbkdf2_hmac_sha1 (const krb5_data *, unsigned long, const krb5_data *); /* Make this a function eventually? */ -#define krb5int_zap_data(ptr, len) memset((volatile void *)ptr, 0, len) -#if defined(__GNUC__) && defined(__GLIBC__) +#ifdef WIN32 +# define krb5int_zap_data(ptr, len) SecureZeroMemory(ptr, 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 +# undef memset +# endif +#endif /* WIN32 */ #define zap(p,l) krb5int_zap_data(p,l) /* A definition of init_state for DES based encryption systems. |
