diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2015-09-11 15:59:22 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2015-09-11 15:59:22 +0000 |
commit | 583c1cd5510185e9cbca6d98fa6871daa8e0611e (patch) | |
tree | 961af1a04d151d7d78d500b7a7c87af45ed04418 /lib | |
parent | e651d966bf3feb29abe8c8fdd09488d7d1080fd7 (diff) |
Convert dtls1_send_finished() and ssl3_send_finished() to
ssl3_handshake_msg_start()/ssl3_handshake_msg_finish().
ok beck@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libssl/src/ssl/d1_both.c | 17 | ||||
-rw-r--r-- | lib/libssl/src/ssl/s3_both.c | 15 |
2 files changed, 10 insertions, 22 deletions
diff --git a/lib/libssl/src/ssl/d1_both.c b/lib/libssl/src/ssl/d1_both.c index 567a0745358..4d2827a2c0b 100644 --- a/lib/libssl/src/ssl/d1_both.c +++ b/lib/libssl/src/ssl/d1_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_both.c,v 1.35 2015/09/10 17:57:50 jsing Exp $ */ +/* $OpenBSD: d1_both.c,v 1.36 2015/09/11 15:59:21 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -905,13 +905,12 @@ f_err: int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen) { - unsigned char *p, *d; + unsigned char *p; int i; unsigned long l; if (s->state == a) { - d = (unsigned char *)s->init_buf->data; - p = &(d[DTLS1_HM_HEADER_LENGTH]); + p = ssl3_handshake_msg_start(s, SSL3_MT_FINISHED); i = s->method->ssl3_enc->final_finish_mac(s, sender, slen, s->s3->tmp.finish_md); @@ -936,18 +935,12 @@ dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen) s->s3->previous_server_finished_len = i; } - d = dtls1_set_message_header(s, d, SSL3_MT_FINISHED, l, 0, l); - s->init_num = (int)l + DTLS1_HM_HEADER_LENGTH; - s->init_off = 0; - - /* buffer the message to handle re-xmits */ - dtls1_buffer_message(s, 0); + ssl3_handshake_msg_finish(s, l); s->state = b; } - /* SSL3_ST_SEND_xxxxxx_HELLO_B */ - return (dtls1_do_write(s, SSL3_RT_HANDSHAKE)); + return (ssl3_handshake_write(s)); } /* diff --git a/lib/libssl/src/ssl/s3_both.c b/lib/libssl/src/ssl/s3_both.c index 5a1d1e74433..6448f27a03f 100644 --- a/lib/libssl/src/ssl/s3_both.c +++ b/lib/libssl/src/ssl/s3_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_both.c,v 1.43 2015/07/18 19:41:54 doug Exp $ */ +/* $OpenBSD: s3_both.c,v 1.44 2015/09/11 15:59:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -155,13 +155,12 @@ ssl3_do_write(SSL *s, int type) int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen) { - unsigned char *p, *d; + unsigned char *p; unsigned long l; int md_len; if (s->state == a) { - d = (unsigned char *)s->init_buf->data; - p = &(d[4]); + p = ssl3_handshake_msg_start(s, SSL3_MT_FINISHED); md_len = s->method->ssl3_enc->finish_mac_length; if (s->method->ssl3_enc->final_finish_mac(s, sender, slen, @@ -184,16 +183,12 @@ ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen) s->s3->previous_server_finished_len = md_len; } - *(d++) = SSL3_MT_FINISHED; - l2n3(l, d); - s->init_num = (int)l + 4; - s->init_off = 0; + ssl3_handshake_msg_finish(s, l); s->state = b; } - /* SSL3_ST_SEND_xxxxxx_HELLO_B */ - return (ssl3_do_write(s, SSL3_RT_HANDSHAKE)); + return (ssl3_handshake_write(s)); } /* ssl3_take_mac calculates the Finished MAC for the handshakes messages seen to far. */ |