From b680cf39ed5bc37e0eb7eb86ad8599bf92df3f2b Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 23 Jan 2011 19:50:13 +0000 Subject: Updated to openssl-1.0.0c --- openssl/crypto/rand/md_rand.c | 11 +++++++---- openssl/crypto/rand/rand_nw.c | 4 ++-- openssl/crypto/rand/randfile.c | 4 +--- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'openssl/crypto/rand') diff --git a/openssl/crypto/rand/md_rand.c b/openssl/crypto/rand/md_rand.c index 88088ce73..b2f04ff13 100644 --- a/openssl/crypto/rand/md_rand.c +++ b/openssl/crypto/rand/md_rand.c @@ -476,11 +476,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); #ifndef PURIFY /* purify complains */ - /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */ + /* The following line uses the supplied buffer as a small + * source of entropy: since this buffer is often uninitialised + * it may cause programs such as purify or valgrind to + * complain. So for those builds it is not used: the removal + * of such a small source of entropy has negligible impact on + * security. + */ MD_Update(&m,buf,j); - /* We know that line may cause programs such as - purify and valgrind to complain about use of - uninitialized data. */ #endif k=(st_idx+MD_DIGEST_LENGTH/2)-st_num; diff --git a/openssl/crypto/rand/rand_nw.c b/openssl/crypto/rand/rand_nw.c index f177ffbe8..8d5b8d2e3 100644 --- a/openssl/crypto/rand/rand_nw.c +++ b/openssl/crypto/rand/rand_nw.c @@ -160,8 +160,8 @@ int RAND_poll(void) rdtsc mov tsc, eax } -#else - asm volatile("rdtsc":"=A" (tsc)); +#elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) + asm volatile("rdtsc":"=a"(tsc)::"edx"); #endif RAND_add(&tsc, sizeof(tsc), 1); diff --git a/openssl/crypto/rand/randfile.c b/openssl/crypto/rand/randfile.c index 4ed40b7b7..f9b709e6d 100644 --- a/openssl/crypto/rand/randfile.c +++ b/openssl/crypto/rand/randfile.c @@ -269,7 +269,6 @@ err: const char *RAND_file_name(char *buf, size_t size) { char *s=NULL; - int ok = 0; #ifdef __OpenBSD__ struct stat sb; #endif @@ -298,7 +297,6 @@ const char *RAND_file_name(char *buf, size_t size) BUF_strlcat(buf,"/",size); #endif BUF_strlcat(buf,RFILE,size); - ok = 1; } else buf[0] = '\0'; /* no file name */ @@ -312,7 +310,7 @@ const char *RAND_file_name(char *buf, size_t size) * to something hopefully decent if that isn't available. */ - if (!ok) + if (!buf[0]) if (BUF_strlcpy(buf,"/dev/arandom",size) >= size) { return(NULL); } -- cgit v1.2.3