ruby-changes:40748
From: nobu <ko1@a...>
Date: Tue, 1 Dec 2015 12:52:41 +0900 (JST)
Subject: [ruby-changes:40748] nobu:r52827 (trunk): explicit_bzero.c: needs windows.h
nobu 2015-12-01 12:52:20 +0900 (Tue, 01 Dec 2015) New Revision: 52827 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52827 Log: explicit_bzero.c: needs windows.h * missing/explicit_bzero.c, random.c (explicit_bzero): SecureZeroMemory() needs windows.h. Modified files: trunk/include/ruby/missing.h trunk/missing/explicit_bzero.c trunk/random.c trunk/win32/Makefile.sub Index: include/ruby/missing.h =================================================================== --- include/ruby/missing.h (revision 52826) +++ include/ruby/missing.h (revision 52827) @@ -252,7 +252,7 @@ explicit_bzero_by_memset_s(void *b, size https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L252 memset_s(b, len, 0, len); } # define explicit_bzero(b, len) explicit_bzero_by_memset_s(b, len) -# elif defined _WIN32 +# elif defined SecureZeroMemory # define explicit_bzero(b, len) SecureZeroMemory(b, len) # endif #endif Index: win32/Makefile.sub =================================================================== --- win32/Makefile.sub (revision 52826) +++ win32/Makefile.sub (revision 52827) @@ -244,6 +244,7 @@ MISSING = crypt.obj ffs.obj langinfo.obj https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L244 !if $(RT_VER) < 120 MISSING = $(MISSING) acosh.obj cbrt.obj erf.obj tgamma.obj !endif +MISSING = $(MISSING) explicit_bzero.obj !endif DLNOBJ = dln.obj Index: random.c =================================================================== --- random.c (revision 52826) +++ random.c (revision 52827) @@ -89,6 +89,7 @@ The original copyright notice follows. https://github.com/ruby/ruby/blob/trunk/random.c#L89 # define _WIN32_WINNT 0x400 # undef __WINCRYPT_H__ # endif +#include <windows.h> #include <wincrypt.h> #endif #include "ruby_atomic.h" Index: missing/explicit_bzero.c =================================================================== --- missing/explicit_bzero.c (revision 52826) +++ missing/explicit_bzero.c (revision 52827) @@ -1,6 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/missing/explicit_bzero.c#L1 #include "ruby/missing.h" #include <string.h> +#ifdef _WIN32 +#include <windows.h> +#endif + /* *BSD have explicit_bzero(). Windows, OS-X have memset_s(). @@ -30,6 +34,8 @@ explicit_bzero(void *b, size_t len) https://github.com/ruby/ruby/blob/trunk/missing/explicit_bzero.c#L34 { #ifdef HAVE_MEMSET_S memset_s(b, len, 0, len); +#elif defined SecureZeroMemory + SecureZeroMemory(b, len); #else { /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/