diff options
| author | jsing <> | 2015-09-12 13:25:26 +0000 |
|---|---|---|
| committer | jsing <> | 2015-09-12 13:25:26 +0000 |
| commit | 0174f2843e80723463666078857f50ee41852d31 (patch) | |
| tree | 5207bd77c36525b604ec8471723e136ff12c815c /src/lib/libssl/d1_srvr.c | |
| parent | 229d27cfe422c13c6db0cfc2ae6dab7b097c10fb (diff) | |
| download | openbsd-0174f2843e80723463666078857f50ee41852d31.tar.gz openbsd-0174f2843e80723463666078857f50ee41852d31.tar.bz2 openbsd-0174f2843e80723463666078857f50ee41852d31.zip | |
Uncopy and unpaste dtls1_send_server_hello().
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/d1_srvr.c | 68 |
1 files changed, 2 insertions, 66 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 | ||
| 702 | int | 702 | int |
| 703 | dtls1_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 | |||
| 766 | int | ||
| 767 | dtls1_send_server_done(SSL *s) | 703 | dtls1_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) { |
