diff options
| author | djm <> | 2011-11-03 02:34:33 +0000 |
|---|---|---|
| committer | djm <> | 2011-11-03 02:34:33 +0000 |
| commit | fc7396568e61a510b9336d6c220aaa889c03060f (patch) | |
| tree | a8fc08e33aecdd21cb07aa47c8a3a9db715f2ef3 /src/lib/libcrypto/rand | |
| parent | 1e8701dd2507fadf6d232d93eb4299a8b79c66d5 (diff) | |
| download | openbsd-fc7396568e61a510b9336d6c220aaa889c03060f.tar.gz openbsd-fc7396568e61a510b9336d6c220aaa889c03060f.tar.bz2 openbsd-fc7396568e61a510b9336d6c220aaa889c03060f.zip | |
openssl-1.0.0e: resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/rand')
| -rw-r--r-- | src/lib/libcrypto/rand/md_rand.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/rand/rand_vms.c | 16 | ||||
| -rw-r--r-- | src/lib/libcrypto/rand/randfile.c | 6 |
3 files changed, 24 insertions, 9 deletions
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index 88088ce73c..b2f04ff13e 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
| @@ -476,11 +476,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
| 476 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | 476 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); |
| 477 | 477 | ||
| 478 | #ifndef PURIFY /* purify complains */ | 478 | #ifndef PURIFY /* purify complains */ |
| 479 | /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */ | 479 | /* The following line uses the supplied buffer as a small |
| 480 | * source of entropy: since this buffer is often uninitialised | ||
| 481 | * it may cause programs such as purify or valgrind to | ||
| 482 | * complain. So for those builds it is not used: the removal | ||
| 483 | * of such a small source of entropy has negligible impact on | ||
| 484 | * security. | ||
| 485 | */ | ||
| 480 | MD_Update(&m,buf,j); | 486 | MD_Update(&m,buf,j); |
| 481 | /* We know that line may cause programs such as | ||
| 482 | purify and valgrind to complain about use of | ||
| 483 | uninitialized data. */ | ||
| 484 | #endif | 487 | #endif |
| 485 | 488 | ||
| 486 | k=(st_idx+MD_DIGEST_LENGTH/2)-st_num; | 489 | k=(st_idx+MD_DIGEST_LENGTH/2)-st_num; |
diff --git a/src/lib/libcrypto/rand/rand_vms.c b/src/lib/libcrypto/rand/rand_vms.c index 1267a3acae..0bfd8ff7e4 100644 --- a/src/lib/libcrypto/rand/rand_vms.c +++ b/src/lib/libcrypto/rand/rand_vms.c | |||
| @@ -69,6 +69,17 @@ | |||
| 69 | # pragma message disable DOLLARID | 69 | # pragma message disable DOLLARID |
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | /* Use 32-bit pointers almost everywhere. Define the type to which to | ||
| 73 | * cast a pointer passed to an external function. | ||
| 74 | */ | ||
| 75 | #if __INITIAL_POINTER_SIZE == 64 | ||
| 76 | # define PTR_T __void_ptr64 | ||
| 77 | # pragma pointer_size save | ||
| 78 | # pragma pointer_size 32 | ||
| 79 | #else /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 80 | # define PTR_T void * | ||
| 81 | #endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
| 82 | |||
| 72 | static struct items_data_st | 83 | static struct items_data_st |
| 73 | { | 84 | { |
| 74 | short length, code; /* length is amount of bytes */ | 85 | short length, code; /* length is amount of bytes */ |
| @@ -125,11 +136,12 @@ int RAND_poll(void) | |||
| 125 | { | 136 | { |
| 126 | if (status == SS$_NORMAL) | 137 | if (status == SS$_NORMAL) |
| 127 | { | 138 | { |
| 128 | RAND_add(data_buffer, total_length, total_length/2); | 139 | RAND_add( (PTR_T)data_buffer, total_length, |
| 140 | total_length/2); | ||
| 129 | } | 141 | } |
| 130 | } | 142 | } |
| 131 | sys$gettim(iosb); | 143 | sys$gettim(iosb); |
| 132 | RAND_add((unsigned char *)iosb, sizeof(iosb), sizeof(iosb)/2); | 144 | RAND_add( (PTR_T)iosb, sizeof(iosb), sizeof(iosb)/2); |
| 133 | return 1; | 145 | return 1; |
| 134 | } | 146 | } |
| 135 | 147 | ||
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index 4ed40b7b70..bc7d9c5804 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
| @@ -144,7 +144,9 @@ int RAND_load_file(const char *file, long bytes) | |||
| 144 | * I/O because we will waste system entropy. | 144 | * I/O because we will waste system entropy. |
| 145 | */ | 145 | */ |
| 146 | bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 2048 enough? */ | 146 | bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 2048 enough? */ |
| 147 | #ifndef OPENSSL_NO_SETVBUF_IONBF | ||
| 147 | setvbuf(in, NULL, _IONBF, 0); /* don't do buffered reads */ | 148 | setvbuf(in, NULL, _IONBF, 0); /* don't do buffered reads */ |
| 149 | #endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ | ||
| 148 | } | 150 | } |
| 149 | #endif | 151 | #endif |
| 150 | for (;;) | 152 | for (;;) |
| @@ -269,7 +271,6 @@ err: | |||
| 269 | const char *RAND_file_name(char *buf, size_t size) | 271 | const char *RAND_file_name(char *buf, size_t size) |
| 270 | { | 272 | { |
| 271 | char *s=NULL; | 273 | char *s=NULL; |
| 272 | int ok = 0; | ||
| 273 | #ifdef __OpenBSD__ | 274 | #ifdef __OpenBSD__ |
| 274 | struct stat sb; | 275 | struct stat sb; |
| 275 | #endif | 276 | #endif |
| @@ -298,7 +299,6 @@ const char *RAND_file_name(char *buf, size_t size) | |||
| 298 | BUF_strlcat(buf,"/",size); | 299 | BUF_strlcat(buf,"/",size); |
| 299 | #endif | 300 | #endif |
| 300 | BUF_strlcat(buf,RFILE,size); | 301 | BUF_strlcat(buf,RFILE,size); |
| 301 | ok = 1; | ||
| 302 | } | 302 | } |
| 303 | else | 303 | else |
| 304 | buf[0] = '\0'; /* no file name */ | 304 | buf[0] = '\0'; /* no file name */ |
| @@ -312,7 +312,7 @@ const char *RAND_file_name(char *buf, size_t size) | |||
| 312 | * to something hopefully decent if that isn't available. | 312 | * to something hopefully decent if that isn't available. |
| 313 | */ | 313 | */ |
| 314 | 314 | ||
| 315 | if (!ok) | 315 | if (!buf[0]) |
| 316 | if (BUF_strlcpy(buf,"/dev/arandom",size) >= size) { | 316 | if (BUF_strlcpy(buf,"/dev/arandom",size) >= size) { |
| 317 | return(NULL); | 317 | return(NULL); |
| 318 | } | 318 | } |
