From 07c262f51d748fd3d3288f9e860d43cc834252fc Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 12 Sep 2015 13:25:26 +0000 Subject: Uncopy and unpaste dtls1_send_server_hello(). --- src/lib/libssl/d1_srvr.c | 68 ++------------------------------------- src/lib/libssl/src/ssl/d1_srvr.c | 68 ++------------------------------------- src/lib/libssl/src/ssl/ssl_locl.h | 3 +- src/lib/libssl/ssl_locl.h | 3 +- 4 files changed, 6 insertions(+), 136 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: d1_srvr.c,v 1.59 2015/09/12 13:09:07 jsing Exp $ */ +/* $OpenBSD: d1_srvr.c,v 1.60 2015/09/12 13:25:26 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -346,7 +346,7 @@ dtls1_accept(SSL *s) case SSL3_ST_SW_SRVR_HELLO_B: s->renegotiate = 2; dtls1_start_timer(s); - ret = dtls1_send_server_hello(s); + ret = ssl3_send_server_hello(s); if (ret <= 0) goto end; @@ -699,70 +699,6 @@ dtls1_send_hello_verify_request(SSL *s) return (ssl3_handshake_write(s)); } -int -dtls1_send_server_hello(SSL *s) -{ - unsigned char *bufend; - unsigned char *p, *d; - unsigned int sl; - - if (s->state == SSL3_ST_SW_SRVR_HELLO_A) { - d = p = ssl3_handshake_msg_start(s, SSL3_MT_SERVER_HELLO); - - *(p++) = s->version >> 8; - *(p++) = s->version & 0xff; - - /* Random stuff */ - arc4random_buf(s->s3->server_random, SSL3_RANDOM_SIZE); - memcpy(p, s->s3->server_random, SSL3_RANDOM_SIZE); - p += SSL3_RANDOM_SIZE; - - /* now in theory we have 3 options to sending back the - * session id. If it is a re-use, we send back the - * old session-id, if it is a new session, we send - * back the new session-id or we send back a 0 length - * session-id if we want it to be single use. - * Currently I will not implement the '0' length session-id - * 12-Jan-98 - I'll now support the '0' length stuff. - */ - if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)) - s->session->session_id_length = 0; - - sl = s->session->session_id_length; - if (sl > sizeof s->session->session_id) { - SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO, - ERR_R_INTERNAL_ERROR); - return -1; - } - *(p++) = sl; - memcpy(p, s->session->session_id, sl); - p += sl; - - /* put the cipher */ - if (s->s3->tmp.new_cipher == NULL) - return -1; - s2n(ssl3_cipher_get_value(s->s3->tmp.new_cipher), p); - - /* put the compression method */ - *(p++) = 0; - - bufend = (unsigned char *)s->init_buf->data + - SSL3_RT_MAX_PLAIN_LENGTH; - if ((p = ssl_add_serverhello_tlsext(s, p, bufend)) == NULL) { - SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO, - ERR_R_INTERNAL_ERROR); - return -1; - } - - ssl3_handshake_msg_finish(s, p - d); - - s->state = SSL3_ST_SW_SRVR_HELLO_B; - } - - /* SSL3_ST_SW_SRVR_HELLO_B */ - return (ssl3_handshake_write(s)); -} - int dtls1_send_server_done(SSL *s) { 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 @@ -/* $OpenBSD: d1_srvr.c,v 1.59 2015/09/12 13:09:07 jsing Exp $ */ +/* $OpenBSD: d1_srvr.c,v 1.60 2015/09/12 13:25:26 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -346,7 +346,7 @@ dtls1_accept(SSL *s) case SSL3_ST_SW_SRVR_HELLO_B: s->renegotiate = 2; dtls1_start_timer(s); - ret = dtls1_send_server_hello(s); + ret = ssl3_send_server_hello(s); if (ret <= 0) goto end; @@ -699,70 +699,6 @@ dtls1_send_hello_verify_request(SSL *s) return (ssl3_handshake_write(s)); } -int -dtls1_send_server_hello(SSL *s) -{ - unsigned char *bufend; - unsigned char *p, *d; - unsigned int sl; - - if (s->state == SSL3_ST_SW_SRVR_HELLO_A) { - d = p = ssl3_handshake_msg_start(s, SSL3_MT_SERVER_HELLO); - - *(p++) = s->version >> 8; - *(p++) = s->version & 0xff; - - /* Random stuff */ - arc4random_buf(s->s3->server_random, SSL3_RANDOM_SIZE); - memcpy(p, s->s3->server_random, SSL3_RANDOM_SIZE); - p += SSL3_RANDOM_SIZE; - - /* now in theory we have 3 options to sending back the - * session id. If it is a re-use, we send back the - * old session-id, if it is a new session, we send - * back the new session-id or we send back a 0 length - * session-id if we want it to be single use. - * Currently I will not implement the '0' length session-id - * 12-Jan-98 - I'll now support the '0' length stuff. - */ - if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)) - s->session->session_id_length = 0; - - sl = s->session->session_id_length; - if (sl > sizeof s->session->session_id) { - SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO, - ERR_R_INTERNAL_ERROR); - return -1; - } - *(p++) = sl; - memcpy(p, s->session->session_id, sl); - p += sl; - - /* put the cipher */ - if (s->s3->tmp.new_cipher == NULL) - return -1; - s2n(ssl3_cipher_get_value(s->s3->tmp.new_cipher), p); - - /* put the compression method */ - *(p++) = 0; - - bufend = (unsigned char *)s->init_buf->data + - SSL3_RT_MAX_PLAIN_LENGTH; - if ((p = ssl_add_serverhello_tlsext(s, p, bufend)) == NULL) { - SSLerr(SSL_F_DTLS1_SEND_SERVER_HELLO, - ERR_R_INTERNAL_ERROR); - return -1; - } - - ssl3_handshake_msg_finish(s, p - d); - - s->state = SSL3_ST_SW_SRVR_HELLO_B; - } - - /* SSL3_ST_SW_SRVR_HELLO_B */ - return (ssl3_handshake_write(s)); -} - int dtls1_send_server_done(SSL *s) { 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 @@ -/* $OpenBSD: ssl_locl.h,v 1.122 2015/09/12 13:09:07 jsing Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.123 2015/09/12 13:25:26 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -724,7 +724,6 @@ int ssl3_get_client_key_exchange(SSL *s); int ssl3_get_cert_verify(SSL *s); int ssl3_get_next_proto(SSL *s); -int dtls1_send_server_hello(SSL *s); int dtls1_send_server_certificate(SSL *s); int dtls1_send_server_key_exchange(SSL *s); int 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 @@ -/* $OpenBSD: ssl_locl.h,v 1.122 2015/09/12 13:09:07 jsing Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.123 2015/09/12 13:25:26 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -724,7 +724,6 @@ int ssl3_get_client_key_exchange(SSL *s); int ssl3_get_cert_verify(SSL *s); int ssl3_get_next_proto(SSL *s); -int dtls1_send_server_hello(SSL *s); int dtls1_send_server_certificate(SSL *s); int dtls1_send_server_key_exchange(SSL *s); int dtls1_send_certificate_request(SSL *s); -- cgit v1.2.3-55-g6feb