summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2015-09-12 13:25:26 +0000
committerjsing <>2015-09-12 13:25:26 +0000
commit07c262f51d748fd3d3288f9e860d43cc834252fc (patch)
tree5207bd77c36525b604ec8471723e136ff12c815c /src/lib
parent13d586194b455eb52b94d1b5b2e3e174d59833a5 (diff)
downloadopenbsd-07c262f51d748fd3d3288f9e860d43cc834252fc.tar.gz
openbsd-07c262f51d748fd3d3288f9e860d43cc834252fc.tar.bz2
openbsd-07c262f51d748fd3d3288f9e860d43cc834252fc.zip
Uncopy and unpaste dtls1_send_server_hello().
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/d1_srvr.c68
-rw-r--r--src/lib/libssl/src/ssl/d1_srvr.c68
-rw-r--r--src/lib/libssl/src/ssl/ssl_locl.h3
-rw-r--r--src/lib/libssl/ssl_locl.h3
4 files changed, 6 insertions, 136 deletions
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c
index ab5c3fcb2c..5c77a62e1d 100644
--- a/src/lib/libssl/d1_srvr.c
+++ b/src/lib/libssl/d1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srvr.c,v 1.59 2015/09/12 13:09:07 jsing Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.60 2015/09/12 13:25:26 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.
@@ -346,7 +346,7 @@ dtls1_accept(SSL *s)
346 case SSL3_ST_SW_SRVR_HELLO_B: 346 case SSL3_ST_SW_SRVR_HELLO_B:
347 s->renegotiate = 2; 347 s->renegotiate = 2;
348 dtls1_start_timer(s); 348 dtls1_start_timer(s);
349 ret = dtls1_send_server_hello(s); 349 ret = ssl3_send_server_hello(s);
350 if (ret <= 0) 350 if (ret <= 0)
351 goto end; 351 goto end;
352 352
@@ -700,70 +700,6 @@ dtls1_send_hello_verify_request(SSL *s)
700} 700}
701 701
702int 702int
703dtls1_send_server_hello(SSL *s)
704{
705 unsigned char *bufend;
706 unsigned char *p, *d;
707 unsigned int sl;
708
709 if (s->state == SSL3_ST_SW_SRVR_HELLO_A) {
710 d = p = ssl3_handshake_msg_start(s, SSL3_MT_SERVER_HELLO);
711
712 *(p++) = s->version >> 8;
713 *(p++) = s->version & 0xff;
714
715 /* Random stuff */
716 arc4random_buf(s->s3->server_random, SSL3_RANDOM_SIZE);
717 memcpy(p, s->s3->server_random, SSL3_RANDOM_SIZE);
718 p += SSL3_RANDOM_SIZE;
719
720 /* now in theory we have 3 options to sending back the
721 * session id. If it is a re-use, we send back the
722 * old session-id, if it is a new session, we send
723 * back the new session-id or we send back a 0 length
724 * session-id if we want it to be single use.
725 * Currently I will not implement the '0' length session-id
726 * 12-Jan-98 - I'll now support the '0' length stuff.
727 */
728 if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER))
729 s->session->session_id_length = 0;
730
731 sl = s->session->session_id_length;
732 if (sl > sizeof s->session->session_id) {
733 SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO,
734 ERR_R_INTERNAL_ERROR);
735 return -1;
736 }
737 *(p++) = sl;
738 memcpy(p, s->session->session_id, sl);
739 p += sl;
740
741 /* put the cipher */
742 if (s->s3->tmp.new_cipher == NULL)
743 return -1;
744 s2n(ssl3_cipher_get_value(s->s3->tmp.new_cipher), p);
745
746 /* put the compression method */
747 *(p++) = 0;
748
749 bufend = (unsigned char *)s->init_buf->data +
750 SSL3_RT_MAX_PLAIN_LENGTH;
751 if ((p = ssl_add_serverhello_tlsext(s, p, bufend)) == NULL) {
752 SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO,
753 ERR_R_INTERNAL_ERROR);
754 return -1;
755 }
756
757 ssl3_handshake_msg_finish(s, p - d);
758
759 s->state = SSL3_ST_SW_SRVR_HELLO_B;
760 }
761
762 /* SSL3_ST_SW_SRVR_HELLO_B */
763 return (ssl3_handshake_write(s));
764}
765
766int
767dtls1_send_server_done(SSL *s) 703dtls1_send_server_done(SSL *s)
768{ 704{
769 if (s->state == SSL3_ST_SW_SRVR_DONE_A) { 705 if (s->state == SSL3_ST_SW_SRVR_DONE_A) {
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c
index ab5c3fcb2c..5c77a62e1d 100644
--- a/src/lib/libssl/src/ssl/d1_srvr.c
+++ b/src/lib/libssl/src/ssl/d1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srvr.c,v 1.59 2015/09/12 13:09:07 jsing Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.60 2015/09/12 13:25:26 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.
@@ -346,7 +346,7 @@ dtls1_accept(SSL *s)
346 case SSL3_ST_SW_SRVR_HELLO_B: 346 case SSL3_ST_SW_SRVR_HELLO_B:
347 s->renegotiate = 2; 347 s->renegotiate = 2;
348 dtls1_start_timer(s); 348 dtls1_start_timer(s);
349 ret = dtls1_send_server_hello(s); 349 ret = ssl3_send_server_hello(s);
350 if (ret <= 0) 350 if (ret <= 0)
351 goto end; 351 goto end;
352 352
@@ -700,70 +700,6 @@ dtls1_send_hello_verify_request(SSL *s)
700} 700}
701 701
702int 702int
703dtls1_send_server_hello(SSL *s)
704{
705 unsigned char *bufend;
706 unsigned char *p, *d;
707 unsigned int sl;
708
709 if (s->state == SSL3_ST_SW_SRVR_HELLO_A) {
710 d = p = ssl3_handshake_msg_start(s, SSL3_MT_SERVER_HELLO);
711
712 *(p++) = s->version >> 8;
713 *(p++) = s->version & 0xff;
714
715 /* Random stuff */
716 arc4random_buf(s->s3->server_random, SSL3_RANDOM_SIZE);
717 memcpy(p, s->s3->server_random, SSL3_RANDOM_SIZE);
718 p += SSL3_RANDOM_SIZE;
719
720 /* now in theory we have 3 options to sending back the
721 * session id. If it is a re-use, we send back the
722 * old session-id, if it is a new session, we send
723 * back the new session-id or we send back a 0 length
724 * session-id if we want it to be single use.
725 * Currently I will not implement the '0' length session-id
726 * 12-Jan-98 - I'll now support the '0' length stuff.
727 */
728 if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER))
729 s->session->session_id_length = 0;
730
731 sl = s->session->session_id_length;
732 if (sl > sizeof s->session->session_id) {
733 SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO,
734 ERR_R_INTERNAL_ERROR);
735 return -1;
736 }
737 *(p++) = sl;
738 memcpy(p, s->session->session_id, sl);
739 p += sl;
740
741 /* put the cipher */
742 if (s->s3->tmp.new_cipher == NULL)
743 return -1;
744 s2n(ssl3_cipher_get_value(s->s3->tmp.new_cipher), p);
745
746 /* put the compression method */
747 *(p++) = 0;
748
749 bufend = (unsigned char *)s->init_buf->data +
750 SSL3_RT_MAX_PLAIN_LENGTH;
751 if ((p = ssl_add_serverhello_tlsext(s, p, bufend)) == NULL) {
752 SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO,
753 ERR_R_INTERNAL_ERROR);
754 return -1;
755 }
756
757 ssl3_handshake_msg_finish(s, p - d);
758
759 s->state = SSL3_ST_SW_SRVR_HELLO_B;
760 }
761
762 /* SSL3_ST_SW_SRVR_HELLO_B */
763 return (ssl3_handshake_write(s));
764}
765
766int
767dtls1_send_server_done(SSL *s) 703dtls1_send_server_done(SSL *s)
768{ 704{
769 if (s->state == SSL3_ST_SW_SRVR_DONE_A) { 705 if (s->state == SSL3_ST_SW_SRVR_DONE_A) {
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h
index e817620d8b..aa615055df 100644
--- a/src/lib/libssl/src/ssl/ssl_locl.h
+++ b/src/lib/libssl/src/ssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.122 2015/09/12 13:09:07 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.123 2015/09/12 13:25:26 jsing 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 *
@@ -724,7 +724,6 @@ int ssl3_get_client_key_exchange(SSL *s);
724int ssl3_get_cert_verify(SSL *s); 724int ssl3_get_cert_verify(SSL *s);
725int ssl3_get_next_proto(SSL *s); 725int ssl3_get_next_proto(SSL *s);
726 726
727int dtls1_send_server_hello(SSL *s);
728int dtls1_send_server_certificate(SSL *s); 727int dtls1_send_server_certificate(SSL *s);
729int dtls1_send_server_key_exchange(SSL *s); 728int dtls1_send_server_key_exchange(SSL *s);
730int dtls1_send_certificate_request(SSL *s); 729int dtls1_send_certificate_request(SSL *s);
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index e817620d8b..aa615055df 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.122 2015/09/12 13:09:07 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.123 2015/09/12 13:25:26 jsing 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 *
@@ -724,7 +724,6 @@ int ssl3_get_client_key_exchange(SSL *s);
724int ssl3_get_cert_verify(SSL *s); 724int ssl3_get_cert_verify(SSL *s);
725int ssl3_get_next_proto(SSL *s); 725int ssl3_get_next_proto(SSL *s);
726 726
727int dtls1_send_server_hello(SSL *s);
728int dtls1_send_server_certificate(SSL *s); 727int dtls1_send_server_certificate(SSL *s);
729int dtls1_send_server_key_exchange(SSL *s); 728int dtls1_send_server_key_exchange(SSL *s);
730int dtls1_send_certificate_request(SSL *s); 729int dtls1_send_certificate_request(SSL *s);