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, 12 insertions, 9 deletions
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c
index afcaca3c43..6ba3d4bfce 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.27 2014/08/07 19:46:31 miod Exp $ */ 1/* $OpenBSD: s3_both.c,v 1.28 2014/08/07 20:02:23 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,14 +171,15 @@ 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);
175 if (s->type == SSL_ST_CONNECT) { 174 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);
180 memcpy(s->s3->previous_server_finished, 181 memcpy(s->s3->previous_server_finished,
181 s->s3->tmp.finish_md, i); 182 s->s3->tmp.finish_md, i);
182 s->s3->previous_server_finished_len = i; 183 s->s3->previous_server_finished_len = i;
183 } 184 }
184 185
@@ -215,7 +216,7 @@ ssl3_take_mac(SSL *s)
215 } 216 }
216 217
217 s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, 218 s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s,
218 sender, slen, s->s3->tmp.peer_finish_md); 219 sender, slen, s->s3->tmp.peer_finish_md);
219} 220}
220#endif 221#endif
221 222
@@ -249,7 +250,7 @@ ssl3_get_finished(SSL *s, int a, int b)
249 p = (unsigned char *)s->init_msg; 250 p = (unsigned char *)s->init_msg;
250 i = s->s3->tmp.peer_finish_md_len; 251 i = s->s3->tmp.peer_finish_md_len;
251 252
252 if (i != n || i > EVP_MAX_MD_SIZE) { 253 if (i != n) {
253 al = SSL_AD_DECODE_ERROR; 254 al = SSL_AD_DECODE_ERROR;
254 SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_BAD_DIGEST_LENGTH); 255 SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_BAD_DIGEST_LENGTH);
255 goto f_err; 256 goto f_err;
@@ -264,12 +265,14 @@ ssl3_get_finished(SSL *s, int a, int b)
264 /* Copy the finished so we can use it for 265 /* Copy the finished so we can use it for
265 renegotiation checks */ 266 renegotiation checks */
266 if (s->type == SSL_ST_ACCEPT) { 267 if (s->type == SSL_ST_ACCEPT) {
268 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
267 memcpy(s->s3->previous_client_finished, 269 memcpy(s->s3->previous_client_finished,
268 s->s3->tmp.peer_finish_md, i); 270 s->s3->tmp.peer_finish_md, i);
269 s->s3->previous_client_finished_len = i; 271 s->s3->previous_client_finished_len = i;
270 } else { 272 } else {
273 OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
271 memcpy(s->s3->previous_server_finished, 274 memcpy(s->s3->previous_server_finished,
272 s->s3->tmp.peer_finish_md, i); 275 s->s3->tmp.peer_finish_md, i);
273 s->s3->previous_server_finished_len = i; 276 s->s3->previous_server_finished_len = i;
274 } 277 }
275 278