summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_both.c
diff options
context:
space:
mode:
authorjsing <>2017-10-08 16:24:02 +0000
committerjsing <>2017-10-08 16:24:02 +0000
commit759dd02e3ff981ea9d2869cfe079c8f201eba19d (patch)
tree3353b68b503515d359d87d0e023b6b9bc1e1453c /src/lib/libssl/d1_both.c
parenta5b4d2c04b558a0cdaf1eaacb3f83fcc27e23de7 (diff)
downloadopenbsd-759dd02e3ff981ea9d2869cfe079c8f201eba19d.tar.gz
openbsd-759dd02e3ff981ea9d2869cfe079c8f201eba19d.tar.bz2
openbsd-759dd02e3ff981ea9d2869cfe079c8f201eba19d.zip
Convert ssl3_send_change_cipher_spec() to use CBB and make it handle DTLS,
which allows us to drop dtls1_send_change_cipher_spec() entirely. ok inoguchi@
Diffstat (limited to 'src/lib/libssl/d1_both.c')
-rw-r--r--src/lib/libssl/d1_both.c41
1 files changed, 2 insertions, 39 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index 6b86cfc03e..42f8cbd537 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.51 2017/05/07 04:22:24 beck Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.52 2017/10/08 16:24:02 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -162,9 +162,6 @@ static unsigned int dtls1_guess_mtu(unsigned int curr_mtu);
162static void dtls1_fix_message_header(SSL *s, unsigned long frag_off, 162static void dtls1_fix_message_header(SSL *s, unsigned long frag_off,
163 unsigned long frag_len); 163 unsigned long frag_len);
164static unsigned char *dtls1_write_message_header(SSL *s, unsigned char *p); 164static unsigned char *dtls1_write_message_header(SSL *s, unsigned char *p);
165static void dtls1_set_message_header_int(SSL *s, unsigned char mt,
166 unsigned long len, unsigned short seq_num, unsigned long frag_off,
167 unsigned long frag_len);
168static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, 165static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max,
169 int *ok); 166 int *ok);
170 167
@@ -895,40 +892,6 @@ f_err:
895 return (-1); 892 return (-1);
896} 893}
897 894
898/*
899 * for these 2 messages, we need to
900 * ssl->enc_read_ctx re-init
901 * ssl->s3->internal->read_sequence zero
902 * ssl->s3->internal->read_mac_secret re-init
903 * ssl->session->read_sym_enc assign
904 * ssl->session->read_hash assign
905 */
906int
907dtls1_send_change_cipher_spec(SSL *s, int a, int b)
908{
909 unsigned char *p;
910
911 if (S3I(s)->hs.state == a) {
912 p = (unsigned char *)s->internal->init_buf->data;
913 *p++=SSL3_MT_CCS;
914 D1I(s)->handshake_write_seq = D1I(s)->next_handshake_write_seq;
915 s->internal->init_num = DTLS1_CCS_HEADER_LENGTH;
916
917 s->internal->init_off = 0;
918
919 dtls1_set_message_header_int(s, SSL3_MT_CCS, 0,
920 D1I(s)->handshake_write_seq, 0, 0);
921
922 /* buffer the message to handle re-xmits */
923 dtls1_buffer_message(s, 1);
924
925 S3I(s)->hs.state = b;
926 }
927
928 /* SSL3_ST_CW_CHANGE_B */
929 return (dtls1_do_write(s, SSL3_RT_CHANGE_CIPHER_SPEC));
930}
931
932int 895int
933dtls1_read_failed(SSL *s, int code) 896dtls1_read_failed(SSL *s, int code)
934{ 897{
@@ -1182,7 +1145,7 @@ dtls1_set_message_header(SSL *s, unsigned char mt, unsigned long len,
1182} 1145}
1183 1146
1184/* don't actually do the writing, wait till the MTU has been retrieved */ 1147/* don't actually do the writing, wait till the MTU has been retrieved */
1185static void 1148void
1186dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len, 1149dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len,
1187 unsigned short seq_num, unsigned long frag_off, unsigned long frag_len) 1150 unsigned short seq_num, unsigned long frag_off, unsigned long frag_len)
1188{ 1151{