diff options
author | David Shaw <[email protected]> | 2002-11-06 17:32:37 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2002-11-06 17:32:37 +0000 |
commit | c4d58f14e079bdef1639cc56b4cc5f782c56bba7 (patch) | |
tree | e4521659c1b8f9a1f71007dc136c9ac44b807841 /cipher/random.c | |
parent | * pubkey-enc.c (get_session_key): With hidden recipients or try a given (diff) | |
download | gnupg-c4d58f14e079bdef1639cc56b4cc5f782c56bba7.tar.gz gnupg-c4d58f14e079bdef1639cc56b4cc5f782c56bba7.zip |
* rndw32.c [__CYGWIN32__]: Don't include winioctl.h - it is not required
anymore. (From Werner)
* random.c (read_seed_file,update_random_seed_file): Use binary mode for
__CYGWIN__. (From Werner)
* blowfish.c (burn_stack), cast5.c (burn_stack), des.c (burn_stack), md5.c
(burn_stack), random.c (burn_stack, read_pool, fast_random_poll),
rijndael.c (burn_stack), rmd160.c (burn_stack), rndegd.c
(rndegd_gather_random), rndlinux.c (rndlinux_gather_random), sha1.c
(burn_stack), tiger.c (burn_stack), twofish.c (burn_stack): Replace
various calls to memset() with the more secure wipememory().
Diffstat (limited to 'cipher/random.c')
-rw-r--r-- | cipher/random.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cipher/random.c b/cipher/random.c index c2dea9c28..8b750a7ff 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -205,7 +205,7 @@ burn_stack (int bytes) { char buf[128]; - memset (buf, 0, sizeof buf); + wipememory(buf,sizeof buf); bytes -= sizeof buf; if (bytes > 0) burn_stack (bytes); @@ -311,9 +311,9 @@ mix_pool(byte *pool) RMD160_CONTEXT md; rmd160_init( &md ); - #if DIGESTLEN != 20 +#if DIGESTLEN != 20 #error must have a digest length of 20 for ripe-md-160 - #endif +#endif /* loop over the pool */ pend = pool + POOLSIZE; memcpy(hashbuf, pend - DIGESTLEN, DIGESTLEN ); @@ -367,11 +367,11 @@ read_seed_file(void) if( !seed_file_name ) return 0; - #ifdef HAVE_DOSISH_SYSTEM +#if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__) fd = open( seed_file_name, O_RDONLY | O_BINARY ); - #else +#else fd = open( seed_file_name, O_RDONLY ); - #endif +#endif if( fd == -1 && errno == ENOENT) { allow_seed_file_update = 1; return 0; @@ -457,12 +457,12 @@ update_random_seed_file() mix_pool(rndpool); rndstats.mixrnd++; mix_pool(keypool); rndstats.mixkey++; - #ifdef HAVE_DOSISH_SYSTEM +#if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__) fd = open( seed_file_name, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, S_IRUSR|S_IWUSR ); - #else +#else fd = open( seed_file_name, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR ); - #endif +#endif if( fd == -1 ) { log_info(_("can't create `%s': %s\n"), seed_file_name, strerror(errno) ); return; @@ -564,7 +564,7 @@ read_pool( byte *buffer, size_t length, int level ) if( pool_balance < 0 ) pool_balance = 0; /* and clear the keypool */ - memset( keypool, 0, POOLSIZE ); + wipememory(keypool, POOLSIZE); } } @@ -673,7 +673,7 @@ fast_random_poll() getrusage( RUSAGE_SELF, &buf ); add_randomness( &buf, sizeof buf, 1 ); - memset( &buf, 0, sizeof buf ); + wipememory( &buf, sizeof buf ); } #endif #endif |