summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2014-04-14 17:45:38 +0000
committerderaadt <>2014-04-14 17:45:38 +0000
commitfbbc137e481f092be7bdc3fedb505f5c2d89eba0 (patch)
tree9a82fc040475abf4e516b4c99e34037b7ef267da
parent64b5c0c827fdf0a319303f85f2a6cecdf997f204 (diff)
downloadopenbsd-fbbc137e481f092be7bdc3fedb505f5c2d89eba0.tar.gz
openbsd-fbbc137e481f092be7bdc3fedb505f5c2d89eba0.tar.bz2
openbsd-fbbc137e481f092be7bdc3fedb505f5c2d89eba0.zip
So the OpenSSL codebase does "get the time, add it as a random seed"
in a bunch of places inside the TLS engine, to try to keep entropy high. I wonder if their moto is "If you can't solve a problem, at least try to do it badly". ok miod
-rw-r--r--src/lib/libcrypto/bn/bn_rand.c3
-rw-r--r--src/lib/libssl/d1_clnt.c2
-rw-r--r--src/lib/libssl/d1_srvr.c2
-rw-r--r--src/lib/libssl/s23_clnt.c2
-rw-r--r--src/lib/libssl/s23_srvr.c2
-rw-r--r--src/lib/libssl/s3_clnt.c2
-rw-r--r--src/lib/libssl/s3_srvr.c3
-rw-r--r--src/lib/libssl/src/crypto/bn/bn_rand.c3
-rw-r--r--src/lib/libssl/src/ssl/d1_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/d1_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/s23_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s23_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/s2_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s2_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/s3_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s3_srvr.c3
16 files changed, 2 insertions, 34 deletions
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c
index b376c28ff3..5cbb1f33c1 100644
--- a/src/lib/libcrypto/bn/bn_rand.c
+++ b/src/lib/libcrypto/bn/bn_rand.c
@@ -119,7 +119,6 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
119 { 119 {
120 unsigned char *buf=NULL; 120 unsigned char *buf=NULL;
121 int ret=0,bit,bytes,mask; 121 int ret=0,bit,bytes,mask;
122 time_t tim;
123 122
124 if (bits == 0) 123 if (bits == 0)
125 { 124 {
@@ -139,8 +138,6 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
139 } 138 }
140 139
141 /* make a random number and set the top and bottom bits */ 140 /* make a random number and set the top and bottom bits */
142 time(&tim);
143 RAND_add(&tim,sizeof(tim),0.0);
144 141
145 if (pseudorand) 142 if (pseudorand)
146 { 143 {
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index 15c4bca58c..4c6aac7536 100644
--- a/src/lib/libssl/d1_clnt.c
+++ b/src/lib/libssl/d1_clnt.c
@@ -147,7 +147,6 @@ int
147dtls1_connect(SSL *s) 147dtls1_connect(SSL *s)
148{ 148{
149 BUF_MEM *buf = NULL; 149 BUF_MEM *buf = NULL;
150 unsigned long Time = (unsigned long)time(NULL);
151 void (*cb)(const SSL *ssl, int type, int val) = NULL; 150 void (*cb)(const SSL *ssl, int type, int val) = NULL;
152 int ret = -1; 151 int ret = -1;
153 int new_state, state, skip = 0; 152 int new_state, state, skip = 0;
@@ -156,7 +155,6 @@ dtls1_connect(SSL *s)
156 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; 155 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
157#endif 156#endif
158 157
159 RAND_add(&Time, sizeof(Time), 0);
160 ERR_clear_error(); 158 ERR_clear_error();
161 errno = 0; 159 errno = 0;
162 160
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c
index 95dffe9484..164fcfbf1f 100644
--- a/src/lib/libssl/d1_srvr.c
+++ b/src/lib/libssl/d1_srvr.c
@@ -145,7 +145,6 @@ int
145dtls1_accept(SSL *s) 145dtls1_accept(SSL *s)
146{ 146{
147 BUF_MEM *buf; 147 BUF_MEM *buf;
148 unsigned long Time = (unsigned long)time(NULL);
149 void (*cb)(const SSL *ssl, int type, int val) = NULL; 148 void (*cb)(const SSL *ssl, int type, int val) = NULL;
150 unsigned long alg_k; 149 unsigned long alg_k;
151 int ret = -1; 150 int ret = -1;
@@ -156,7 +155,6 @@ dtls1_accept(SSL *s)
156 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; 155 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
157#endif 156#endif
158 157
159 RAND_add(&Time, sizeof(Time), 0);
160 ERR_clear_error(); 158 ERR_clear_error();
161 errno = 0; 159 errno = 0;
162 160
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c
index 0fd388a05a..8ed79c3d55 100644
--- a/src/lib/libssl/s23_clnt.c
+++ b/src/lib/libssl/s23_clnt.c
@@ -145,12 +145,10 @@ int
145ssl23_connect(SSL *s) 145ssl23_connect(SSL *s)
146{ 146{
147 BUF_MEM *buf = NULL; 147 BUF_MEM *buf = NULL;
148 unsigned long Time = (unsigned long)time(NULL);
149 void (*cb)(const SSL *ssl, int type, int val) = NULL; 148 void (*cb)(const SSL *ssl, int type, int val) = NULL;
150 int ret = -1; 149 int ret = -1;
151 int new_state, state; 150 int new_state, state;
152 151
153 RAND_add(&Time, sizeof(Time), 0);
154 ERR_clear_error(); 152 ERR_clear_error();
155 errno = 0; 153 errno = 0;
156 154
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c
index 35db7b4992..2aad21e93c 100644
--- a/src/lib/libssl/s23_srvr.c
+++ b/src/lib/libssl/s23_srvr.c
@@ -147,12 +147,10 @@ int
147ssl23_accept(SSL *s) 147ssl23_accept(SSL *s)
148{ 148{
149 BUF_MEM *buf; 149 BUF_MEM *buf;
150 unsigned long Time = (unsigned long)time(NULL);
151 void (*cb)(const SSL *ssl, int type, int val) = NULL; 150 void (*cb)(const SSL *ssl, int type, int val) = NULL;
152 int ret = -1; 151 int ret = -1;
153 int new_state, state; 152 int new_state, state;
154 153
155 RAND_add(&Time, sizeof(Time), 0);
156 ERR_clear_error(); 154 ERR_clear_error();
157 errno = 0; 155 errno = 0;
158 156
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c
index b9ca6b6f9b..4ad8d3943e 100644
--- a/src/lib/libssl/s3_clnt.c
+++ b/src/lib/libssl/s3_clnt.c
@@ -186,12 +186,10 @@ int
186ssl3_connect(SSL *s) 186ssl3_connect(SSL *s)
187{ 187{
188 BUF_MEM *buf = NULL; 188 BUF_MEM *buf = NULL;
189 unsigned long Time = (unsigned long)time(NULL);
190 void (*cb)(const SSL *ssl, int type, int val) = NULL; 189 void (*cb)(const SSL *ssl, int type, int val) = NULL;
191 int ret = -1; 190 int ret = -1;
192 int new_state, state, skip = 0; 191 int new_state, state, skip = 0;
193 192
194 RAND_add(&Time, sizeof(Time), 0);
195 ERR_clear_error(); 193 ERR_clear_error();
196 errno = 0; 194 errno = 0;
197 195
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c
index eeadb160d1..14066031ca 100644
--- a/src/lib/libssl/s3_srvr.c
+++ b/src/lib/libssl/s3_srvr.c
@@ -210,12 +210,11 @@ int
210ssl3_accept(SSL *s) 210ssl3_accept(SSL *s)
211{ 211{
212 BUF_MEM *buf; 212 BUF_MEM *buf;
213 unsigned long alg_k, Time = (unsigned long)time(NULL); 213 unsigned long alg_k;
214 void (*cb)(const SSL *ssl, int type, int val) = NULL; 214 void (*cb)(const SSL *ssl, int type, int val) = NULL;
215 int ret = -1; 215 int ret = -1;
216 int new_state, state, skip = 0; 216 int new_state, state, skip = 0;
217 217
218 RAND_add(&Time, sizeof(Time), 0);
219 ERR_clear_error(); 218 ERR_clear_error();
220 errno = 0; 219 errno = 0;
221 220
diff --git a/src/lib/libssl/src/crypto/bn/bn_rand.c b/src/lib/libssl/src/crypto/bn/bn_rand.c
index b376c28ff3..5cbb1f33c1 100644
--- a/src/lib/libssl/src/crypto/bn/bn_rand.c
+++ b/src/lib/libssl/src/crypto/bn/bn_rand.c
@@ -119,7 +119,6 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
119 { 119 {
120 unsigned char *buf=NULL; 120 unsigned char *buf=NULL;
121 int ret=0,bit,bytes,mask; 121 int ret=0,bit,bytes,mask;
122 time_t tim;
123 122
124 if (bits == 0) 123 if (bits == 0)
125 { 124 {
@@ -139,8 +138,6 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
139 } 138 }
140 139
141 /* make a random number and set the top and bottom bits */ 140 /* make a random number and set the top and bottom bits */
142 time(&tim);
143 RAND_add(&tim,sizeof(tim),0.0);
144 141
145 if (pseudorand) 142 if (pseudorand)
146 { 143 {
diff --git a/src/lib/libssl/src/ssl/d1_clnt.c b/src/lib/libssl/src/ssl/d1_clnt.c
index 15c4bca58c..4c6aac7536 100644
--- a/src/lib/libssl/src/ssl/d1_clnt.c
+++ b/src/lib/libssl/src/ssl/d1_clnt.c
@@ -147,7 +147,6 @@ int
147dtls1_connect(SSL *s) 147dtls1_connect(SSL *s)
148{ 148{
149 BUF_MEM *buf = NULL; 149 BUF_MEM *buf = NULL;
150 unsigned long Time = (unsigned long)time(NULL);
151 void (*cb)(const SSL *ssl, int type, int val) = NULL; 150 void (*cb)(const SSL *ssl, int type, int val) = NULL;
152 int ret = -1; 151 int ret = -1;
153 int new_state, state, skip = 0; 152 int new_state, state, skip = 0;
@@ -156,7 +155,6 @@ dtls1_connect(SSL *s)
156 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; 155 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
157#endif 156#endif
158 157
159 RAND_add(&Time, sizeof(Time), 0);
160 ERR_clear_error(); 158 ERR_clear_error();
161 errno = 0; 159 errno = 0;
162 160
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c
index 95dffe9484..164fcfbf1f 100644
--- a/src/lib/libssl/src/ssl/d1_srvr.c
+++ b/src/lib/libssl/src/ssl/d1_srvr.c
@@ -145,7 +145,6 @@ int
145dtls1_accept(SSL *s) 145dtls1_accept(SSL *s)
146{ 146{
147 BUF_MEM *buf; 147 BUF_MEM *buf;
148 unsigned long Time = (unsigned long)time(NULL);
149 void (*cb)(const SSL *ssl, int type, int val) = NULL; 148 void (*cb)(const SSL *ssl, int type, int val) = NULL;
150 unsigned long alg_k; 149 unsigned long alg_k;
151 int ret = -1; 150 int ret = -1;
@@ -156,7 +155,6 @@ dtls1_accept(SSL *s)
156 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; 155 char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
157#endif 156#endif
158 157
159 RAND_add(&Time, sizeof(Time), 0);
160 ERR_clear_error(); 158 ERR_clear_error();
161 errno = 0; 159 errno = 0;
162 160
diff --git a/src/lib/libssl/src/ssl/s23_clnt.c b/src/lib/libssl/src/ssl/s23_clnt.c
index 0fd388a05a..8ed79c3d55 100644
--- a/src/lib/libssl/src/ssl/s23_clnt.c
+++ b/src/lib/libssl/src/ssl/s23_clnt.c
@@ -145,12 +145,10 @@ int
145ssl23_connect(SSL *s) 145ssl23_connect(SSL *s)
146{ 146{
147 BUF_MEM *buf = NULL; 147 BUF_MEM *buf = NULL;
148 unsigned long Time = (unsigned long)time(NULL);
149 void (*cb)(const SSL *ssl, int type, int val) = NULL; 148 void (*cb)(const SSL *ssl, int type, int val) = NULL;
150 int ret = -1; 149 int ret = -1;
151 int new_state, state; 150 int new_state, state;
152 151
153 RAND_add(&Time, sizeof(Time), 0);
154 ERR_clear_error(); 152 ERR_clear_error();
155 errno = 0; 153 errno = 0;
156 154
diff --git a/src/lib/libssl/src/ssl/s23_srvr.c b/src/lib/libssl/src/ssl/s23_srvr.c
index 35db7b4992..2aad21e93c 100644
--- a/src/lib/libssl/src/ssl/s23_srvr.c
+++ b/src/lib/libssl/src/ssl/s23_srvr.c
@@ -147,12 +147,10 @@ int
147ssl23_accept(SSL *s) 147ssl23_accept(SSL *s)
148{ 148{
149 BUF_MEM *buf; 149 BUF_MEM *buf;
150 unsigned long Time = (unsigned long)time(NULL);
151 void (*cb)(const SSL *ssl, int type, int val) = NULL; 150 void (*cb)(const SSL *ssl, int type, int val) = NULL;
152 int ret = -1; 151 int ret = -1;
153 int new_state, state; 152 int new_state, state;
154 153
155 RAND_add(&Time, sizeof(Time), 0);
156 ERR_clear_error(); 154 ERR_clear_error();
157 errno = 0; 155 errno = 0;
158 156
diff --git a/src/lib/libssl/src/ssl/s2_clnt.c b/src/lib/libssl/src/ssl/s2_clnt.c
index a1cfab6f2d..6c48c25064 100644
--- a/src/lib/libssl/src/ssl/s2_clnt.c
+++ b/src/lib/libssl/src/ssl/s2_clnt.c
@@ -146,13 +146,11 @@ IMPLEMENT_ssl2_meth_func(SSLv2_client_method,
146int 146int
147ssl2_connect(SSL *s) 147ssl2_connect(SSL *s)
148{ 148{
149 unsigned long l = (unsigned long)time(NULL);
150 BUF_MEM *buf = NULL; 149 BUF_MEM *buf = NULL;
151 int ret = -1; 150 int ret = -1;
152 void (*cb)(const SSL *ssl, int type, int val) = NULL; 151 void (*cb)(const SSL *ssl, int type, int val) = NULL;
153 int new_state, state; 152 int new_state, state;
154 153
155 RAND_add(&l, sizeof(l), 0);
156 ERR_clear_error(); 154 ERR_clear_error();
157 errno = 0; 155 errno = 0;
158 156
diff --git a/src/lib/libssl/src/ssl/s2_srvr.c b/src/lib/libssl/src/ssl/s2_srvr.c
index aa63fe85ba..8023243e9a 100644
--- a/src/lib/libssl/src/ssl/s2_srvr.c
+++ b/src/lib/libssl/src/ssl/s2_srvr.c
@@ -146,14 +146,12 @@ IMPLEMENT_ssl2_meth_func(SSLv2_server_method,
146int 146int
147ssl2_accept(SSL *s) 147ssl2_accept(SSL *s)
148{ 148{
149 unsigned long l = (unsigned long)time(NULL);
150 BUF_MEM *buf = NULL; 149 BUF_MEM *buf = NULL;
151 int ret = -1; 150 int ret = -1;
152 long num1; 151 long num1;
153 void (*cb)(const SSL *ssl, int type, int val) = NULL; 152 void (*cb)(const SSL *ssl, int type, int val) = NULL;
154 int new_state, state; 153 int new_state, state;
155 154
156 RAND_add(&l, sizeof(l), 0);
157 ERR_clear_error(); 155 ERR_clear_error();
158 errno = 0; 156 errno = 0;
159 157
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c
index b9ca6b6f9b..4ad8d3943e 100644
--- a/src/lib/libssl/src/ssl/s3_clnt.c
+++ b/src/lib/libssl/src/ssl/s3_clnt.c
@@ -186,12 +186,10 @@ int
186ssl3_connect(SSL *s) 186ssl3_connect(SSL *s)
187{ 187{
188 BUF_MEM *buf = NULL; 188 BUF_MEM *buf = NULL;
189 unsigned long Time = (unsigned long)time(NULL);
190 void (*cb)(const SSL *ssl, int type, int val) = NULL; 189 void (*cb)(const SSL *ssl, int type, int val) = NULL;
191 int ret = -1; 190 int ret = -1;
192 int new_state, state, skip = 0; 191 int new_state, state, skip = 0;
193 192
194 RAND_add(&Time, sizeof(Time), 0);
195 ERR_clear_error(); 193 ERR_clear_error();
196 errno = 0; 194 errno = 0;
197 195
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c
index eeadb160d1..14066031ca 100644
--- a/src/lib/libssl/src/ssl/s3_srvr.c
+++ b/src/lib/libssl/src/ssl/s3_srvr.c
@@ -210,12 +210,11 @@ int
210ssl3_accept(SSL *s) 210ssl3_accept(SSL *s)
211{ 211{
212 BUF_MEM *buf; 212 BUF_MEM *buf;
213 unsigned long alg_k, Time = (unsigned long)time(NULL); 213 unsigned long alg_k;
214 void (*cb)(const SSL *ssl, int type, int val) = NULL; 214 void (*cb)(const SSL *ssl, int type, int val) = NULL;
215 int ret = -1; 215 int ret = -1;
216 int new_state, state, skip = 0; 216 int new_state, state, skip = 0;
217 217
218 RAND_add(&Time, sizeof(Time), 0);
219 ERR_clear_error(); 218 ERR_clear_error();
220 errno = 0; 219 errno = 0;
221 220