com php-src: better way to zero away sensitive data: ext/standard/php_crypt_r.c
| From: | Anatol Belski | Date: | Sun, 14 Sep 2014 09:48:51 +0000 |
| Subject: | com php-src: better way to zero away sensitive data: ext/standard/php_crypt_r.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81593@lists.php.net to get a copy of this message | ||
Commit: 8d075b6e4dbf4599e7d26aa3f7043e81089ca078
Author: Anatol Belski <ab@php.net> Sun, 14 Sep 2014 11:48:51 +0200
Parents: 041302a8f7c6162116bf30019c5eeeb9dafd26b2
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8d075b6e4dbf4599e7d26aa3f7043e81089ca078
Log:
better way to zero away sensitive data
memset could be optimized away by the compiler
Changed paths:
M ext/standard/php_crypt_r.c
Diff:
diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index 3098f24..4917ebc 100644
--- a/ext/standard/php_crypt_r.c
+++ b/ext/standard/php_crypt_r.c
@@ -206,7 +206,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
}
/* Don't leave anything around in vm they could use. */
- memset(final, 0, sizeof(final));
+ RtlSecureZeroMemory(final, sizeof(final));
/* Then something really weird... */
for (i = pwl; i != 0; i >>= 1) {
@@ -288,7 +288,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
*p = '\0';
- memset(final, 0, sizeof(final));
+ RtlSecureZeroMemory(final, sizeof(final));
_destroyCtx1: