summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s3_both.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/s3_both.c')
-rw-r--r--src/lib/libssl/s3_both.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c
index 500387e372..afcaca3c43 100644
--- a/src/lib/libssl/s3_both.c
+++ b/src/lib/libssl/s3_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_both.c,v 1.26 2014/07/10 08:51:14 tedu Exp $ */ 1/* $OpenBSD: s3_both.c,v 1.27 2014/08/07 19:46:31 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -161,7 +161,7 @@ ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen)
161 p = &(d[4]); 161 p = &(d[4]);
162 162
163 i = s->method->ssl3_enc->final_finish_mac(s, 163 i = s->method->ssl3_enc->final_finish_mac(s,
164 sender, slen, s->s3->tmp.finish_md); 164 sender, slen, s->s3->tmp.finish_md);
165 if (i == 0) 165 if (i == 0)
166 return 0; 166 return 0;
167 s->s3->tmp.finish_md_len = i; 167 s->s3->tmp.finish_md_len = i;
@@ -171,15 +171,14 @@ ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen)
171 171
172 /* Copy the finished so we can use it for 172 /* Copy the finished so we can use it for
173 renegotiation checks */ 173 renegotiation checks */
174 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
174 if (s->type == SSL_ST_CONNECT) { 175 if (s->type == SSL_ST_CONNECT) {
175 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
176 memcpy(s->s3->previous_client_finished, 176 memcpy(s->s3->previous_client_finished,
177 s->s3->tmp.finish_md, i); 177 s->s3->tmp.finish_md, i);
178 s->s3->previous_client_finished_len = i; 178 s->s3->previous_client_finished_len = i;
179 } else { 179 } else {
180 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
181 memcpy(s->s3->previous_server_finished, 180 memcpy(s->s3->previous_server_finished,
182 s->s3->tmp.finish_md, i); 181 s->s3->tmp.finish_md, i);
183 s->s3->previous_server_finished_len = i; 182 s->s3->previous_server_finished_len = i;
184 } 183 }
185 184
@@ -216,7 +215,7 @@ ssl3_take_mac(SSL *s)
216 } 215 }
217 216
218 s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, 217 s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s,
219 sender, slen, s->s3->tmp.peer_finish_md); 218 sender, slen, s->s3->tmp.peer_finish_md);
220} 219}
221#endif 220#endif
222 221
@@ -250,7 +249,7 @@ ssl3_get_finished(SSL *s, int a, int b)
250 p = (unsigned char *)s->init_msg; 249 p = (unsigned char *)s->init_msg;
251 i = s->s3->tmp.peer_finish_md_len; 250 i = s->s3->tmp.peer_finish_md_len;
252 251
253 if (i != n) { 252 if (i != n || i > EVP_MAX_MD_SIZE) {
254 al = SSL_AD_DECODE_ERROR; 253 al = SSL_AD_DECODE_ERROR;
255 SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_BAD_DIGEST_LENGTH); 254 SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_BAD_DIGEST_LENGTH);
256 goto f_err; 255 goto f_err;
@@ -265,14 +264,12 @@ ssl3_get_finished(SSL *s, int a, int b)
265 /* Copy the finished so we can use it for 264 /* Copy the finished so we can use it for
266 renegotiation checks */ 265 renegotiation checks */
267 if (s->type == SSL_ST_ACCEPT) { 266 if (s->type == SSL_ST_ACCEPT) {
268 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
269 memcpy(s->s3->previous_client_finished, 267 memcpy(s->s3->previous_client_finished,
270 s->s3->tmp.peer_finish_md, i); 268 s->s3->tmp.peer_finish_md, i);
271 s->s3->previous_client_finished_len = i; 269 s->s3->previous_client_finished_len = i;
272 } else { 270 } else {
273 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
274 memcpy(s->s3->previous_server_finished, 271 memcpy(s->s3->previous_server_finished,
275 s->s3->tmp.peer_finish_md, i); 272 s->s3->tmp.peer_finish_md, i);
276 s->s3->previous_server_finished_len = i; 273 s->s3->previous_server_finished_len = i;
277 } 274 }
278 275