diff options
| author | jsing <> | 2015-02-09 10:53:28 +0000 |
|---|---|---|
| committer | jsing <> | 2015-02-09 10:53:28 +0000 |
| commit | 02bf7aab1edd295f175128c3cbf04d8c1b69a7cf (patch) | |
| tree | 26c8e0794ca281a87b301ecbd4dde188ac6918e4 /src | |
| parent | 157b832965c968aac98859f2f0bc3494c13ef7ef (diff) | |
| download | openbsd-02bf7aab1edd295f175128c3cbf04d8c1b69a7cf.tar.gz openbsd-02bf7aab1edd295f175128c3cbf04d8c1b69a7cf.tar.bz2 openbsd-02bf7aab1edd295f175128c3cbf04d8c1b69a7cf.zip | |
Jettison DTLS over SCTP.
OpenBSD does not have SCTP support and it sees little use in the wild.
OPENSSL_NO_SCTP is already specified via opensslfeatures.h, hence this
is a code removal only and symbols should remain unchanged.
ok beck@ miod@ tedu@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/d1_both.c | 17 | ||||
| -rw-r--r-- | src/lib/libssl/d1_clnt.c | 146 | ||||
| -rw-r--r-- | src/lib/libssl/d1_lib.c | 9 | ||||
| -rw-r--r-- | src/lib/libssl/d1_pkt.c | 89 | ||||
| -rw-r--r-- | src/lib/libssl/d1_srvr.c | 131 | ||||
| -rw-r--r-- | src/lib/libssl/dtls1.h | 14 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_both.c | 17 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_clnt.c | 146 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_lib.c | 9 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_pkt.c | 89 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_srvr.c | 131 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/dtls1.h | 14 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/ssl3.h | 10 | ||||
| -rw-r--r-- | src/lib/libssl/ssl3.h | 10 |
14 files changed, 14 insertions, 818 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c index bff683d06c..534db59ee8 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.31 2014/12/14 16:07:26 jsing Exp $ */ | 1 | /* $OpenBSD: d1_both.c,v 1.32 2015/02/09 10:53:28 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. |
| @@ -1397,21 +1397,6 @@ dtls1_shutdown(SSL *s) | |||
| 1397 | { | 1397 | { |
| 1398 | int ret; | 1398 | int ret; |
| 1399 | 1399 | ||
| 1400 | #ifndef OPENSSL_NO_SCTP | ||
| 1401 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 1402 | !(s->shutdown & SSL_SENT_SHUTDOWN)) { | ||
| 1403 | ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); | ||
| 1404 | if (ret < 0) | ||
| 1405 | return -1; | ||
| 1406 | |||
| 1407 | if (ret == 0) | ||
| 1408 | BIO_ctrl(SSL_get_wbio(s), | ||
| 1409 | BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 1, NULL); | ||
| 1410 | } | ||
| 1411 | #endif | ||
| 1412 | ret = ssl3_shutdown(s); | 1400 | ret = ssl3_shutdown(s); |
| 1413 | #ifndef OPENSSL_NO_SCTP | ||
| 1414 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 0, NULL); | ||
| 1415 | #endif | ||
| 1416 | return ret; | 1401 | return ret; |
| 1417 | } | 1402 | } |
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c index c344c1bcdc..cf25183de5 100644 --- a/src/lib/libssl/d1_clnt.c +++ b/src/lib/libssl/d1_clnt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_clnt.c,v 1.42 2015/02/06 08:30:23 jsing Exp $ */ | 1 | /* $OpenBSD: d1_clnt.c,v 1.43 2015/02/09 10:53:28 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. |
| @@ -180,10 +180,6 @@ dtls1_connect(SSL *s) | |||
| 180 | void (*cb)(const SSL *ssl, int type, int val) = NULL; | 180 | void (*cb)(const SSL *ssl, int type, int val) = NULL; |
| 181 | int ret = -1; | 181 | int ret = -1; |
| 182 | int new_state, state, skip = 0; | 182 | int new_state, state, skip = 0; |
| 183 | #ifndef OPENSSL_NO_SCTP | ||
| 184 | unsigned char sctpauthkey[64]; | ||
| 185 | char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; | ||
| 186 | #endif | ||
| 187 | 183 | ||
| 188 | ERR_clear_error(); | 184 | ERR_clear_error(); |
| 189 | errno = 0; | 185 | errno = 0; |
| @@ -197,14 +193,6 @@ dtls1_connect(SSL *s) | |||
| 197 | if (!SSL_in_init(s) || SSL_in_before(s)) | 193 | if (!SSL_in_init(s) || SSL_in_before(s)) |
| 198 | SSL_clear(s); | 194 | SSL_clear(s); |
| 199 | 195 | ||
| 200 | #ifndef OPENSSL_NO_SCTP | ||
| 201 | /* Notify SCTP BIO socket to enter handshake | ||
| 202 | * mode and prevent stream identifier other | ||
| 203 | * than 0. Will be ignored if no SCTP is used. | ||
| 204 | */ | ||
| 205 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 206 | s->in_handshake, NULL); | ||
| 207 | #endif | ||
| 208 | 196 | ||
| 209 | for (;;) { | 197 | for (;;) { |
| 210 | state = s->state; | 198 | state = s->state; |
| @@ -271,40 +259,6 @@ dtls1_connect(SSL *s) | |||
| 271 | s->hit = 0; | 259 | s->hit = 0; |
| 272 | break; | 260 | break; |
| 273 | 261 | ||
| 274 | #ifndef OPENSSL_NO_SCTP | ||
| 275 | case DTLS1_SCTP_ST_CR_READ_SOCK: | ||
| 276 | |||
| 277 | if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 278 | s->s3->in_read_app_data = 2; | ||
| 279 | s->rwstate = SSL_READING; | ||
| 280 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 281 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 282 | ret = -1; | ||
| 283 | goto end; | ||
| 284 | } | ||
| 285 | |||
| 286 | s->state = s->s3->tmp.next_state; | ||
| 287 | break; | ||
| 288 | |||
| 289 | case DTLS1_SCTP_ST_CW_WRITE_SOCK: | ||
| 290 | /* read app data until dry event */ | ||
| 291 | |||
| 292 | ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); | ||
| 293 | if (ret < 0) | ||
| 294 | goto end; | ||
| 295 | |||
| 296 | if (ret == 0) { | ||
| 297 | s->s3->in_read_app_data = 2; | ||
| 298 | s->rwstate = SSL_READING; | ||
| 299 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 300 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 301 | ret = -1; | ||
| 302 | goto end; | ||
| 303 | } | ||
| 304 | |||
| 305 | s->state = s->d1->next_state; | ||
| 306 | break; | ||
| 307 | #endif | ||
| 308 | 262 | ||
| 309 | case SSL3_ST_CW_CLNT_HELLO_A: | 263 | case SSL3_ST_CW_CLNT_HELLO_A: |
| 310 | case SSL3_ST_CW_CLNT_HELLO_B: | 264 | case SSL3_ST_CW_CLNT_HELLO_B: |
| @@ -330,16 +284,9 @@ dtls1_connect(SSL *s) | |||
| 330 | 284 | ||
| 331 | s->init_num = 0; | 285 | s->init_num = 0; |
| 332 | 286 | ||
| 333 | #ifndef OPENSSL_NO_SCTP | ||
| 334 | /* Disable buffering for SCTP */ | ||
| 335 | if (!BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 336 | #endif | ||
| 337 | /* turn on buffering for the next lot of output */ | 287 | /* turn on buffering for the next lot of output */ |
| 338 | if (s->bbio != s->wbio) | 288 | if (s->bbio != s->wbio) |
| 339 | s->wbio = BIO_push(s->bbio, s->wbio); | 289 | s->wbio = BIO_push(s->bbio, s->wbio); |
| 340 | #ifndef OPENSSL_NO_SCTP | ||
| 341 | } | ||
| 342 | #endif | ||
| 343 | break; | 290 | break; |
| 344 | 291 | ||
| 345 | case SSL3_ST_CR_SRVR_HELLO_A: | 292 | case SSL3_ST_CR_SRVR_HELLO_A: |
| @@ -349,20 +296,6 @@ dtls1_connect(SSL *s) | |||
| 349 | goto end; | 296 | goto end; |
| 350 | else { | 297 | else { |
| 351 | if (s->hit) { | 298 | if (s->hit) { |
| 352 | #ifndef OPENSSL_NO_SCTP | ||
| 353 | /* Add new shared key for SCTP-Auth, | ||
| 354 | * will be ignored if no SCTP used. | ||
| 355 | */ | ||
| 356 | snprintf((char*) labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 357 | DTLS1_SCTP_AUTH_LABEL); | ||
| 358 | |||
| 359 | SSL_export_keying_material(s, sctpauthkey, | ||
| 360 | sizeof(sctpauthkey), labelbuffer, | ||
| 361 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 362 | |||
| 363 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 364 | sizeof(sctpauthkey), sctpauthkey); | ||
| 365 | #endif | ||
| 366 | 299 | ||
| 367 | s->state = SSL3_ST_CR_FINISHED_A; | 300 | s->state = SSL3_ST_CR_FINISHED_A; |
| 368 | } else | 301 | } else |
| @@ -453,12 +386,6 @@ dtls1_connect(SSL *s) | |||
| 453 | s->s3->tmp.next_state = SSL3_ST_CW_KEY_EXCH_A; | 386 | s->s3->tmp.next_state = SSL3_ST_CW_KEY_EXCH_A; |
| 454 | s->init_num = 0; | 387 | s->init_num = 0; |
| 455 | 388 | ||
| 456 | #ifndef OPENSSL_NO_SCTP | ||
| 457 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 458 | state == SSL_ST_RENEGOTIATE) | ||
| 459 | s->state = DTLS1_SCTP_ST_CR_READ_SOCK; | ||
| 460 | else | ||
| 461 | #endif | ||
| 462 | s->state = s->s3->tmp.next_state; | 389 | s->state = s->s3->tmp.next_state; |
| 463 | break; | 390 | break; |
| 464 | 391 | ||
| @@ -481,22 +408,6 @@ dtls1_connect(SSL *s) | |||
| 481 | if (ret <= 0) | 408 | if (ret <= 0) |
| 482 | goto end; | 409 | goto end; |
| 483 | 410 | ||
| 484 | #ifndef OPENSSL_NO_SCTP | ||
| 485 | /* Add new shared key for SCTP-Auth, | ||
| 486 | * will be ignored if no SCTP used. | ||
| 487 | */ | ||
| 488 | snprintf((char*)labelbuffer, | ||
| 489 | sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 490 | DTLS1_SCTP_AUTH_LABEL); | ||
| 491 | |||
| 492 | SSL_export_keying_material(s, sctpauthkey, | ||
| 493 | sizeof(sctpauthkey), labelbuffer, | ||
| 494 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 495 | |||
| 496 | BIO_ctrl(SSL_get_wbio(s), | ||
| 497 | BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 498 | sizeof(sctpauthkey), sctpauthkey); | ||
| 499 | #endif | ||
| 500 | 411 | ||
| 501 | /* EAY EAY EAY need to check for DH fix cert | 412 | /* EAY EAY EAY need to check for DH fix cert |
| 502 | * sent back */ | 413 | * sent back */ |
| @@ -505,12 +416,6 @@ dtls1_connect(SSL *s) | |||
| 505 | if (s->s3->tmp.cert_req == 1) { | 416 | if (s->s3->tmp.cert_req == 1) { |
| 506 | s->state = SSL3_ST_CW_CERT_VRFY_A; | 417 | s->state = SSL3_ST_CW_CERT_VRFY_A; |
| 507 | } else { | 418 | } else { |
| 508 | #ifndef OPENSSL_NO_SCTP | ||
| 509 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 510 | s->d1->next_state = SSL3_ST_CW_CHANGE_A; | ||
| 511 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 512 | } else | ||
| 513 | #endif | ||
| 514 | s->state = SSL3_ST_CW_CHANGE_A; | 419 | s->state = SSL3_ST_CW_CHANGE_A; |
| 515 | s->s3->change_cipher_spec = 0; | 420 | s->s3->change_cipher_spec = 0; |
| 516 | } | 421 | } |
| @@ -524,12 +429,6 @@ dtls1_connect(SSL *s) | |||
| 524 | ret = dtls1_send_client_verify(s); | 429 | ret = dtls1_send_client_verify(s); |
| 525 | if (ret <= 0) | 430 | if (ret <= 0) |
| 526 | goto end; | 431 | goto end; |
| 527 | #ifndef OPENSSL_NO_SCTP | ||
| 528 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 529 | s->d1->next_state = SSL3_ST_CW_CHANGE_A; | ||
| 530 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 531 | } else | ||
| 532 | #endif | ||
| 533 | s->state = SSL3_ST_CW_CHANGE_A; | 432 | s->state = SSL3_ST_CW_CHANGE_A; |
| 534 | s->init_num = 0; | 433 | s->init_num = 0; |
| 535 | s->s3->change_cipher_spec = 0; | 434 | s->s3->change_cipher_spec = 0; |
| @@ -559,15 +458,6 @@ dtls1_connect(SSL *s) | |||
| 559 | goto end; | 458 | goto end; |
| 560 | } | 459 | } |
| 561 | 460 | ||
| 562 | #ifndef OPENSSL_NO_SCTP | ||
| 563 | if (s->hit) { | ||
| 564 | /* Change to new shared key of SCTP-Auth, | ||
| 565 | * will be ignored if no SCTP used. | ||
| 566 | */ | ||
| 567 | BIO_ctrl(SSL_get_wbio(s), | ||
| 568 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 569 | } | ||
| 570 | #endif | ||
| 571 | 461 | ||
| 572 | dtls1_reset_seq_numbers(s, SSL3_CC_WRITE); | 462 | dtls1_reset_seq_numbers(s, SSL3_CC_WRITE); |
| 573 | break; | 463 | break; |
| @@ -588,31 +478,12 @@ dtls1_connect(SSL *s) | |||
| 588 | s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; | 478 | s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; |
| 589 | if (s->hit) { | 479 | if (s->hit) { |
| 590 | s->s3->tmp.next_state = SSL_ST_OK; | 480 | s->s3->tmp.next_state = SSL_ST_OK; |
| 591 | #ifndef OPENSSL_NO_SCTP | ||
| 592 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 593 | s->d1->next_state = s->s3->tmp.next_state; | ||
| 594 | s->s3->tmp.next_state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 595 | } | ||
| 596 | #endif | ||
| 597 | if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { | 481 | if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { |
| 598 | s->state = SSL_ST_OK; | 482 | s->state = SSL_ST_OK; |
| 599 | #ifndef OPENSSL_NO_SCTP | ||
| 600 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 601 | s->d1->next_state = SSL_ST_OK; | ||
| 602 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 603 | } | ||
| 604 | #endif | ||
| 605 | s->s3->flags |= SSL3_FLAGS_POP_BUFFER; | 483 | s->s3->flags |= SSL3_FLAGS_POP_BUFFER; |
| 606 | s->s3->delay_buf_pop_ret = 0; | 484 | s->s3->delay_buf_pop_ret = 0; |
| 607 | } | 485 | } |
| 608 | } else { | 486 | } else { |
| 609 | #ifndef OPENSSL_NO_SCTP | ||
| 610 | /* Change to new shared key of SCTP-Auth, | ||
| 611 | * will be ignored if no SCTP used. | ||
| 612 | */ | ||
| 613 | BIO_ctrl(SSL_get_wbio(s), | ||
| 614 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 615 | #endif | ||
| 616 | 487 | ||
| 617 | /* Allow NewSessionTicket if ticket expected */ | 488 | /* Allow NewSessionTicket if ticket expected */ |
| 618 | if (s->tlsext_ticket_expected) | 489 | if (s->tlsext_ticket_expected) |
| @@ -657,13 +528,6 @@ dtls1_connect(SSL *s) | |||
| 657 | else | 528 | else |
| 658 | s->state = SSL_ST_OK; | 529 | s->state = SSL_ST_OK; |
| 659 | 530 | ||
| 660 | #ifndef OPENSSL_NO_SCTP | ||
| 661 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 662 | state == SSL_ST_RENEGOTIATE) { | ||
| 663 | s->d1->next_state = s->state; | ||
| 664 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 665 | } | ||
| 666 | #endif | ||
| 667 | 531 | ||
| 668 | s->init_num = 0; | 532 | s->init_num = 0; |
| 669 | break; | 533 | break; |
| @@ -742,14 +606,6 @@ dtls1_connect(SSL *s) | |||
| 742 | end: | 606 | end: |
| 743 | s->in_handshake--; | 607 | s->in_handshake--; |
| 744 | 608 | ||
| 745 | #ifndef OPENSSL_NO_SCTP | ||
| 746 | /* Notify SCTP BIO socket to leave handshake | ||
| 747 | * mode and allow stream identifier other | ||
| 748 | * than 0. Will be ignored if no SCTP is used. | ||
| 749 | */ | ||
| 750 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 751 | s->in_handshake, NULL); | ||
| 752 | #endif | ||
| 753 | 609 | ||
| 754 | if (buf != NULL) | 610 | if (buf != NULL) |
| 755 | BUF_MEM_free(buf); | 611 | BUF_MEM_free(buf); |
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index 26f5901cc4..9d9a90d76a 100644 --- a/src/lib/libssl/d1_lib.c +++ b/src/lib/libssl/d1_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_lib.c,v 1.26 2014/12/14 15:30:50 jsing Exp $ */ | 1 | /* $OpenBSD: d1_lib.c,v 1.27 2015/02/09 10:53:28 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. |
| @@ -297,13 +297,6 @@ dtls1_get_cipher(unsigned int u) | |||
| 297 | void | 297 | void |
| 298 | dtls1_start_timer(SSL *s) | 298 | dtls1_start_timer(SSL *s) |
| 299 | { | 299 | { |
| 300 | #ifndef OPENSSL_NO_SCTP | ||
| 301 | /* Disable timer for SCTP */ | ||
| 302 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 303 | memset(&(s->d1->next_timeout), 0, sizeof(struct timeval)); | ||
| 304 | return; | ||
| 305 | } | ||
| 306 | #endif | ||
| 307 | 300 | ||
| 308 | /* If timer is not set, initialize duration with 1 second */ | 301 | /* If timer is not set, initialize duration with 1 second */ |
| 309 | if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { | 302 | if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { |
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 91e9c146ac..c997b7f212 100644 --- a/src/lib/libssl/d1_pkt.c +++ b/src/lib/libssl/d1_pkt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_pkt.c,v 1.39 2015/01/21 00:15:50 doug Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.40 2015/02/09 10:53:28 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. |
| @@ -231,13 +231,6 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
| 231 | 231 | ||
| 232 | item->data = rdata; | 232 | item->data = rdata; |
| 233 | 233 | ||
| 234 | #ifndef OPENSSL_NO_SCTP | ||
| 235 | /* Store bio_dgram_sctp_rcvinfo struct */ | ||
| 236 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 237 | (s->state == SSL3_ST_SR_FINISHED_A || s->state == SSL3_ST_CR_FINISHED_A)) { | ||
| 238 | BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(rdata->recordinfo), &rdata->recordinfo); | ||
| 239 | } | ||
| 240 | #endif | ||
| 241 | 234 | ||
| 242 | s->packet = NULL; | 235 | s->packet = NULL; |
| 243 | s->packet_length = 0; | 236 | s->packet_length = 0; |
| @@ -582,10 +575,6 @@ again: | |||
| 582 | /* get another record */ | 575 | /* get another record */ |
| 583 | } | 576 | } |
| 584 | 577 | ||
| 585 | #ifndef OPENSSL_NO_SCTP | ||
| 586 | /* Only do replay check if no SCTP bio */ | ||
| 587 | if (!BIO_dgram_is_sctp(SSL_get_rbio(s))) { | ||
| 588 | #endif | ||
| 589 | /* Check whether this is a repeat, or aged record. | 578 | /* Check whether this is a repeat, or aged record. |
| 590 | * Don't check if we're listening and this message is | 579 | * Don't check if we're listening and this message is |
| 591 | * a ClientHello. They can look as if they're replayed, | 580 | * a ClientHello. They can look as if they're replayed, |
| @@ -600,9 +589,6 @@ again: | |||
| 600 | goto again; | 589 | goto again; |
| 601 | /* get another record */ | 590 | /* get another record */ |
| 602 | } | 591 | } |
| 603 | #ifndef OPENSSL_NO_SCTP | ||
| 604 | } | ||
| 605 | #endif | ||
| 606 | 592 | ||
| 607 | /* just read a 0 length packet */ | 593 | /* just read a 0 length packet */ |
| 608 | if (rr->length == 0) | 594 | if (rr->length == 0) |
| @@ -692,18 +678,7 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) | |||
| 692 | 678 | ||
| 693 | /* Now s->d1->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ | 679 | /* Now s->d1->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ |
| 694 | 680 | ||
| 695 | #ifndef OPENSSL_NO_SCTP | ||
| 696 | /* Continue handshake if it had to be interrupted to read | ||
| 697 | * app data with SCTP. | ||
| 698 | */ | ||
| 699 | if ((!s->in_handshake && SSL_in_init(s)) || | ||
| 700 | (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 701 | (s->state == DTLS1_SCTP_ST_SR_READ_SOCK || | ||
| 702 | s->state == DTLS1_SCTP_ST_CR_READ_SOCK) && | ||
| 703 | s->s3->in_read_app_data != 2)) | ||
| 704 | #else | ||
| 705 | if (!s->in_handshake && SSL_in_init(s)) | 681 | if (!s->in_handshake && SSL_in_init(s)) |
| 706 | #endif | ||
| 707 | { | 682 | { |
| 708 | /* type == SSL3_RT_APPLICATION_DATA */ | 683 | /* type == SSL3_RT_APPLICATION_DATA */ |
| 709 | i = s->handshake_func(s); | 684 | i = s->handshake_func(s); |
| @@ -732,13 +707,6 @@ start: | |||
| 732 | pitem *item; | 707 | pitem *item; |
| 733 | item = pqueue_pop(s->d1->buffered_app_data.q); | 708 | item = pqueue_pop(s->d1->buffered_app_data.q); |
| 734 | if (item) { | 709 | if (item) { |
| 735 | #ifndef OPENSSL_NO_SCTP | ||
| 736 | /* Restore bio_dgram_sctp_rcvinfo struct */ | ||
| 737 | if (BIO_dgram_is_sctp(SSL_get_rbio(s))) { | ||
| 738 | DTLS1_RECORD_DATA *rdata = (DTLS1_RECORD_DATA *) item->data; | ||
| 739 | BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO, sizeof(rdata->recordinfo), &rdata->recordinfo); | ||
| 740 | } | ||
| 741 | #endif | ||
| 742 | 710 | ||
| 743 | dtls1_copy_record(s, item); | 711 | dtls1_copy_record(s, item); |
| 744 | 712 | ||
| @@ -826,29 +794,6 @@ start: | |||
| 826 | } | 794 | } |
| 827 | } | 795 | } |
| 828 | 796 | ||
| 829 | #ifndef OPENSSL_NO_SCTP | ||
| 830 | /* We were about to renegotiate but had to read | ||
| 831 | * belated application data first, so retry. | ||
| 832 | */ | ||
| 833 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 834 | rr->type == SSL3_RT_APPLICATION_DATA && | ||
| 835 | (s->state == DTLS1_SCTP_ST_SR_READ_SOCK || | ||
| 836 | s->state == DTLS1_SCTP_ST_CR_READ_SOCK)) { | ||
| 837 | s->rwstate = SSL_READING; | ||
| 838 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 839 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 840 | } | ||
| 841 | |||
| 842 | /* We might had to delay a close_notify alert because | ||
| 843 | * of reordered app data. If there was an alert and there | ||
| 844 | * is no message to read anymore, finally set shutdown. | ||
| 845 | */ | ||
| 846 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 847 | s->d1->shutdown_received && !BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 848 | s->shutdown |= SSL_RECEIVED_SHUTDOWN; | ||
| 849 | return (0); | ||
| 850 | } | ||
| 851 | #endif | ||
| 852 | return (n); | 797 | return (n); |
| 853 | } | 798 | } |
| 854 | 799 | ||
| @@ -1006,20 +951,6 @@ start: | |||
| 1006 | { | 951 | { |
| 1007 | s->s3->warn_alert = alert_descr; | 952 | s->s3->warn_alert = alert_descr; |
| 1008 | if (alert_descr == SSL_AD_CLOSE_NOTIFY) { | 953 | if (alert_descr == SSL_AD_CLOSE_NOTIFY) { |
| 1009 | #ifndef OPENSSL_NO_SCTP | ||
| 1010 | /* With SCTP and streams the socket may deliver app data | ||
| 1011 | * after a close_notify alert. We have to check this | ||
| 1012 | * first so that nothing gets discarded. | ||
| 1013 | */ | ||
| 1014 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 1015 | BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 1016 | s->d1->shutdown_received = 1; | ||
| 1017 | s->rwstate = SSL_READING; | ||
| 1018 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 1019 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 1020 | return -1; | ||
| 1021 | } | ||
| 1022 | #endif | ||
| 1023 | s->shutdown |= SSL_RECEIVED_SHUTDOWN; | 954 | s->shutdown |= SSL_RECEIVED_SHUTDOWN; |
| 1024 | return (0); | 955 | return (0); |
| 1025 | } | 956 | } |
| @@ -1093,14 +1024,6 @@ start: | |||
| 1093 | if (s->version == DTLS1_BAD_VER) | 1024 | if (s->version == DTLS1_BAD_VER) |
| 1094 | s->d1->handshake_read_seq++; | 1025 | s->d1->handshake_read_seq++; |
| 1095 | 1026 | ||
| 1096 | #ifndef OPENSSL_NO_SCTP | ||
| 1097 | /* Remember that a CCS has been received, | ||
| 1098 | * so that an old key of SCTP-Auth can be | ||
| 1099 | * deleted when a CCS is sent. Will be ignored | ||
| 1100 | * if no SCTP is used | ||
| 1101 | */ | ||
| 1102 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD, 1, NULL); | ||
| 1103 | #endif | ||
| 1104 | 1027 | ||
| 1105 | goto start; | 1028 | goto start; |
| 1106 | } | 1029 | } |
| @@ -1217,17 +1140,7 @@ dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len) | |||
| 1217 | { | 1140 | { |
| 1218 | int i; | 1141 | int i; |
| 1219 | 1142 | ||
| 1220 | #ifndef OPENSSL_NO_SCTP | ||
| 1221 | /* Check if we have to continue an interrupted handshake | ||
| 1222 | * for reading belated app data with SCTP. | ||
| 1223 | */ | ||
| 1224 | if ((SSL_in_init(s) && !s->in_handshake) || | ||
| 1225 | (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 1226 | (s->state == DTLS1_SCTP_ST_SR_READ_SOCK || | ||
| 1227 | s->state == DTLS1_SCTP_ST_CR_READ_SOCK))) | ||
| 1228 | #else | ||
| 1229 | if (SSL_in_init(s) && !s->in_handshake) | 1143 | if (SSL_in_init(s) && !s->in_handshake) |
| 1230 | #endif | ||
| 1231 | { | 1144 | { |
| 1232 | i = s->handshake_func(s); | 1145 | i = s->handshake_func(s); |
| 1233 | if (i < 0) | 1146 | if (i < 0) |
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c index 1c732c5b08..4e6d0da3b3 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.48 2015/02/07 08:56:39 jsing Exp $ */ | 1 | /* $OpenBSD: d1_srvr.c,v 1.49 2015/02/09 10:53:28 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. |
| @@ -182,10 +182,6 @@ dtls1_accept(SSL *s) | |||
| 182 | int ret = -1; | 182 | int ret = -1; |
| 183 | int new_state, state, skip = 0; | 183 | int new_state, state, skip = 0; |
| 184 | int listen; | 184 | int listen; |
| 185 | #ifndef OPENSSL_NO_SCTP | ||
| 186 | unsigned char sctpauthkey[64]; | ||
| 187 | char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; | ||
| 188 | #endif | ||
| 189 | 185 | ||
| 190 | ERR_clear_error(); | 186 | ERR_clear_error(); |
| 191 | errno = 0; | 187 | errno = 0; |
| @@ -203,14 +199,6 @@ dtls1_accept(SSL *s) | |||
| 203 | SSL_clear(s); | 199 | SSL_clear(s); |
| 204 | 200 | ||
| 205 | s->d1->listen = listen; | 201 | s->d1->listen = listen; |
| 206 | #ifndef OPENSSL_NO_SCTP | ||
| 207 | /* Notify SCTP BIO socket to enter handshake | ||
| 208 | * mode and prevent stream identifier other | ||
| 209 | * than 0. Will be ignored if no SCTP is used. | ||
| 210 | */ | ||
| 211 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 212 | s->in_handshake, NULL); | ||
| 213 | #endif | ||
| 214 | 202 | ||
| 215 | if (s->cert == NULL) { | 203 | if (s->cert == NULL) { |
| 216 | SSLerr(SSL_F_DTLS1_ACCEPT, SSL_R_NO_CERTIFICATE_SET); | 204 | SSLerr(SSL_F_DTLS1_ACCEPT, SSL_R_NO_CERTIFICATE_SET); |
| @@ -266,9 +254,6 @@ dtls1_accept(SSL *s) | |||
| 266 | * the output is sent in a way that TCP likes :-) | 254 | * the output is sent in a way that TCP likes :-) |
| 267 | * ...but not with SCTP :-) | 255 | * ...but not with SCTP :-) |
| 268 | */ | 256 | */ |
| 269 | #ifndef OPENSSL_NO_SCTP | ||
| 270 | if (!BIO_dgram_is_sctp(SSL_get_wbio(s))) | ||
| 271 | #endif | ||
| 272 | if (!ssl_init_wbio_buffer(s, 1)) { | 257 | if (!ssl_init_wbio_buffer(s, 1)) { |
| 273 | ret = -1; | 258 | ret = -1; |
| 274 | goto end; | 259 | goto end; |
| @@ -368,40 +353,6 @@ dtls1_accept(SSL *s) | |||
| 368 | } | 353 | } |
| 369 | break; | 354 | break; |
| 370 | 355 | ||
| 371 | #ifndef OPENSSL_NO_SCTP | ||
| 372 | case DTLS1_SCTP_ST_SR_READ_SOCK: | ||
| 373 | |||
| 374 | if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 375 | s->s3->in_read_app_data = 2; | ||
| 376 | s->rwstate = SSL_READING; | ||
| 377 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 378 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 379 | ret = -1; | ||
| 380 | goto end; | ||
| 381 | } | ||
| 382 | |||
| 383 | s->state = SSL3_ST_SR_FINISHED_A; | ||
| 384 | break; | ||
| 385 | |||
| 386 | case DTLS1_SCTP_ST_SW_WRITE_SOCK: | ||
| 387 | ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); | ||
| 388 | if (ret < 0) | ||
| 389 | goto end; | ||
| 390 | |||
| 391 | if (ret == 0) { | ||
| 392 | if (s->d1->next_state != SSL_ST_OK) { | ||
| 393 | s->s3->in_read_app_data = 2; | ||
| 394 | s->rwstate = SSL_READING; | ||
| 395 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 396 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 397 | ret = -1; | ||
| 398 | goto end; | ||
| 399 | } | ||
| 400 | } | ||
| 401 | |||
| 402 | s->state = s->d1->next_state; | ||
| 403 | break; | ||
| 404 | #endif | ||
| 405 | 356 | ||
| 406 | case SSL3_ST_SW_SRVR_HELLO_A: | 357 | case SSL3_ST_SW_SRVR_HELLO_A: |
| 407 | case SSL3_ST_SW_SRVR_HELLO_B: | 358 | case SSL3_ST_SW_SRVR_HELLO_B: |
| @@ -412,22 +363,6 @@ dtls1_accept(SSL *s) | |||
| 412 | goto end; | 363 | goto end; |
| 413 | 364 | ||
| 414 | if (s->hit) { | 365 | if (s->hit) { |
| 415 | #ifndef OPENSSL_NO_SCTP | ||
| 416 | /* Add new shared key for SCTP-Auth, | ||
| 417 | * will be ignored if no SCTP used. | ||
| 418 | */ | ||
| 419 | snprintf((char*)labelbuffer, | ||
| 420 | sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 421 | DTLS1_SCTP_AUTH_LABEL); | ||
| 422 | |||
| 423 | SSL_export_keying_material(s, sctpauthkey, | ||
| 424 | sizeof(sctpauthkey), labelbuffer, | ||
| 425 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 426 | |||
| 427 | BIO_ctrl(SSL_get_wbio(s), | ||
| 428 | BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 429 | sizeof(sctpauthkey), sctpauthkey); | ||
| 430 | #endif | ||
| 431 | if (s->tlsext_ticket_expected) | 366 | if (s->tlsext_ticket_expected) |
| 432 | s->state = SSL3_ST_SW_SESSION_TICKET_A; | 367 | s->state = SSL3_ST_SW_SESSION_TICKET_A; |
| 433 | else | 368 | else |
| @@ -503,12 +438,6 @@ dtls1_accept(SSL *s) | |||
| 503 | skip = 1; | 438 | skip = 1; |
| 504 | s->s3->tmp.cert_request = 0; | 439 | s->s3->tmp.cert_request = 0; |
| 505 | s->state = SSL3_ST_SW_SRVR_DONE_A; | 440 | s->state = SSL3_ST_SW_SRVR_DONE_A; |
| 506 | #ifndef OPENSSL_NO_SCTP | ||
| 507 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 508 | s->d1->next_state = SSL3_ST_SW_SRVR_DONE_A; | ||
| 509 | s->state = DTLS1_SCTP_ST_SW_WRITE_SOCK; | ||
| 510 | } | ||
| 511 | #endif | ||
| 512 | } else { | 441 | } else { |
| 513 | s->s3->tmp.cert_request = 1; | 442 | s->s3->tmp.cert_request = 1; |
| 514 | dtls1_start_timer(s); | 443 | dtls1_start_timer(s); |
| @@ -516,12 +445,6 @@ dtls1_accept(SSL *s) | |||
| 516 | if (ret <= 0) | 445 | if (ret <= 0) |
| 517 | goto end; | 446 | goto end; |
| 518 | s->state = SSL3_ST_SW_SRVR_DONE_A; | 447 | s->state = SSL3_ST_SW_SRVR_DONE_A; |
| 519 | #ifndef OPENSSL_NO_SCTP | ||
| 520 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 521 | s->d1->next_state = SSL3_ST_SW_SRVR_DONE_A; | ||
| 522 | s->state = DTLS1_SCTP_ST_SW_WRITE_SOCK; | ||
| 523 | } | ||
| 524 | #endif | ||
| 525 | s->init_num = 0; | 448 | s->init_num = 0; |
| 526 | } | 449 | } |
| 527 | break; | 450 | break; |
| @@ -578,22 +501,6 @@ dtls1_accept(SSL *s) | |||
| 578 | ret = ssl3_get_client_key_exchange(s); | 501 | ret = ssl3_get_client_key_exchange(s); |
| 579 | if (ret <= 0) | 502 | if (ret <= 0) |
| 580 | goto end; | 503 | goto end; |
| 581 | #ifndef OPENSSL_NO_SCTP | ||
| 582 | /* Add new shared key for SCTP-Auth, | ||
| 583 | * will be ignored if no SCTP used. | ||
| 584 | */ | ||
| 585 | snprintf((char *)labelbuffer, | ||
| 586 | sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 587 | DTLS1_SCTP_AUTH_LABEL); | ||
| 588 | |||
| 589 | SSL_export_keying_material(s, sctpauthkey, | ||
| 590 | sizeof(sctpauthkey), labelbuffer, | ||
| 591 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 592 | |||
| 593 | BIO_ctrl(SSL_get_wbio(s), | ||
| 594 | BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 595 | sizeof(sctpauthkey), sctpauthkey); | ||
| 596 | #endif | ||
| 597 | 504 | ||
| 598 | s->state = SSL3_ST_SR_CERT_VRFY_A; | 505 | s->state = SSL3_ST_SR_CERT_VRFY_A; |
| 599 | s->init_num = 0; | 506 | s->init_num = 0; |
| @@ -628,12 +535,6 @@ dtls1_accept(SSL *s) | |||
| 628 | ret = ssl3_get_cert_verify(s); | 535 | ret = ssl3_get_cert_verify(s); |
| 629 | if (ret <= 0) | 536 | if (ret <= 0) |
| 630 | goto end; | 537 | goto end; |
| 631 | #ifndef OPENSSL_NO_SCTP | ||
| 632 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 633 | state == SSL_ST_RENEGOTIATE) | ||
| 634 | s->state = DTLS1_SCTP_ST_SR_READ_SOCK; | ||
| 635 | else | ||
| 636 | #endif | ||
| 637 | s->state = SSL3_ST_SR_FINISHED_A; | 538 | s->state = SSL3_ST_SR_FINISHED_A; |
| 638 | s->init_num = 0; | 539 | s->init_num = 0; |
| 639 | break; | 540 | break; |
| @@ -689,15 +590,6 @@ dtls1_accept(SSL *s) | |||
| 689 | if (ret <= 0) | 590 | if (ret <= 0) |
| 690 | goto end; | 591 | goto end; |
| 691 | 592 | ||
| 692 | #ifndef OPENSSL_NO_SCTP | ||
| 693 | if (!s->hit) { | ||
| 694 | /* Change to new shared key of SCTP-Auth, | ||
| 695 | * will be ignored if no SCTP used. | ||
| 696 | */ | ||
| 697 | BIO_ctrl(SSL_get_wbio(s), | ||
| 698 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 699 | } | ||
| 700 | #endif | ||
| 701 | 593 | ||
| 702 | s->state = SSL3_ST_SW_FINISHED_A; | 594 | s->state = SSL3_ST_SW_FINISHED_A; |
| 703 | s->init_num = 0; | 595 | s->init_num = 0; |
| @@ -723,21 +615,8 @@ dtls1_accept(SSL *s) | |||
| 723 | if (s->hit) { | 615 | if (s->hit) { |
| 724 | s->s3->tmp.next_state = SSL3_ST_SR_FINISHED_A; | 616 | s->s3->tmp.next_state = SSL3_ST_SR_FINISHED_A; |
| 725 | 617 | ||
| 726 | #ifndef OPENSSL_NO_SCTP | ||
| 727 | /* Change to new shared key of SCTP-Auth, | ||
| 728 | * will be ignored if no SCTP used. | ||
| 729 | */ | ||
| 730 | BIO_ctrl(SSL_get_wbio(s), | ||
| 731 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 732 | #endif | ||
| 733 | } else { | 618 | } else { |
| 734 | s->s3->tmp.next_state = SSL_ST_OK; | 619 | s->s3->tmp.next_state = SSL_ST_OK; |
| 735 | #ifndef OPENSSL_NO_SCTP | ||
| 736 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 737 | s->d1->next_state = s->s3->tmp.next_state; | ||
| 738 | s->s3->tmp.next_state = DTLS1_SCTP_ST_SW_WRITE_SOCK; | ||
| 739 | } | ||
| 740 | #endif | ||
| 741 | } | 620 | } |
| 742 | s->init_num = 0; | 621 | s->init_num = 0; |
| 743 | break; | 622 | break; |
| @@ -802,14 +681,6 @@ end: | |||
| 802 | /* BIO_flush(s->wbio); */ | 681 | /* BIO_flush(s->wbio); */ |
| 803 | 682 | ||
| 804 | s->in_handshake--; | 683 | s->in_handshake--; |
| 805 | #ifndef OPENSSL_NO_SCTP | ||
| 806 | /* Notify SCTP BIO socket to leave handshake | ||
| 807 | * mode and prevent stream identifier other | ||
| 808 | * than 0. Will be ignored if no SCTP is used. | ||
| 809 | */ | ||
| 810 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 811 | s->in_handshake, NULL); | ||
| 812 | #endif | ||
| 813 | 684 | ||
| 814 | if (cb != NULL) | 685 | if (cb != NULL) |
| 815 | cb(s, SSL_CB_ACCEPT_EXIT, ret); | 686 | cb(s, SSL_CB_ACCEPT_EXIT, ret); |
diff --git a/src/lib/libssl/dtls1.h b/src/lib/libssl/dtls1.h index 40940a494a..1d65dc5821 100644 --- a/src/lib/libssl/dtls1.h +++ b/src/lib/libssl/dtls1.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dtls1.h,v 1.16 2014/12/14 15:30:50 jsing Exp $ */ | 1 | /* $OpenBSD: dtls1.h,v 1.17 2015/02/09 10:53:28 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. |
| @@ -95,9 +95,6 @@ extern "C" { | |||
| 95 | 95 | ||
| 96 | #ifndef OPENSSL_NO_SSL_INTERN | 96 | #ifndef OPENSSL_NO_SSL_INTERN |
| 97 | 97 | ||
| 98 | #ifndef OPENSSL_NO_SCTP | ||
| 99 | #define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" | ||
| 100 | #endif | ||
| 101 | 98 | ||
| 102 | typedef struct dtls1_bitmap_st { | 99 | typedef struct dtls1_bitmap_st { |
| 103 | unsigned long map; /* track 32 packets on 32-bit systems | 100 | unsigned long map; /* track 32 packets on 32-bit systems |
| @@ -225,12 +222,6 @@ typedef struct dtls1_state_st { | |||
| 225 | unsigned int retransmitting; | 222 | unsigned int retransmitting; |
| 226 | unsigned int change_cipher_spec_ok; | 223 | unsigned int change_cipher_spec_ok; |
| 227 | 224 | ||
| 228 | #ifndef OPENSSL_NO_SCTP | ||
| 229 | /* used when SSL_ST_XX_FLUSH is entered */ | ||
| 230 | int next_state; | ||
| 231 | |||
| 232 | int shutdown_received; | ||
| 233 | #endif | ||
| 234 | 225 | ||
| 235 | } DTLS1_STATE; | 226 | } DTLS1_STATE; |
| 236 | 227 | ||
| @@ -239,9 +230,6 @@ typedef struct dtls1_record_data_st { | |||
| 239 | unsigned int packet_length; | 230 | unsigned int packet_length; |
| 240 | SSL3_BUFFER rbuf; | 231 | SSL3_BUFFER rbuf; |
| 241 | SSL3_RECORD rrec; | 232 | SSL3_RECORD rrec; |
| 242 | #ifndef OPENSSL_NO_SCTP | ||
| 243 | struct bio_dgram_sctp_rcvinfo recordinfo; | ||
| 244 | #endif | ||
| 245 | } DTLS1_RECORD_DATA; | 233 | } DTLS1_RECORD_DATA; |
| 246 | 234 | ||
| 247 | #endif | 235 | #endif |
diff --git a/src/lib/libssl/src/ssl/d1_both.c b/src/lib/libssl/src/ssl/d1_both.c index bff683d06c..534db59ee8 100644 --- a/src/lib/libssl/src/ssl/d1_both.c +++ b/src/lib/libssl/src/ssl/d1_both.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_both.c,v 1.31 2014/12/14 16:07:26 jsing Exp $ */ | 1 | /* $OpenBSD: d1_both.c,v 1.32 2015/02/09 10:53:28 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. |
| @@ -1397,21 +1397,6 @@ dtls1_shutdown(SSL *s) | |||
| 1397 | { | 1397 | { |
| 1398 | int ret; | 1398 | int ret; |
| 1399 | 1399 | ||
| 1400 | #ifndef OPENSSL_NO_SCTP | ||
| 1401 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 1402 | !(s->shutdown & SSL_SENT_SHUTDOWN)) { | ||
| 1403 | ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); | ||
| 1404 | if (ret < 0) | ||
| 1405 | return -1; | ||
| 1406 | |||
| 1407 | if (ret == 0) | ||
| 1408 | BIO_ctrl(SSL_get_wbio(s), | ||
| 1409 | BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 1, NULL); | ||
| 1410 | } | ||
| 1411 | #endif | ||
| 1412 | ret = ssl3_shutdown(s); | 1400 | ret = ssl3_shutdown(s); |
| 1413 | #ifndef OPENSSL_NO_SCTP | ||
| 1414 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 0, NULL); | ||
| 1415 | #endif | ||
| 1416 | return ret; | 1401 | return ret; |
| 1417 | } | 1402 | } |
diff --git a/src/lib/libssl/src/ssl/d1_clnt.c b/src/lib/libssl/src/ssl/d1_clnt.c index c344c1bcdc..cf25183de5 100644 --- a/src/lib/libssl/src/ssl/d1_clnt.c +++ b/src/lib/libssl/src/ssl/d1_clnt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_clnt.c,v 1.42 2015/02/06 08:30:23 jsing Exp $ */ | 1 | /* $OpenBSD: d1_clnt.c,v 1.43 2015/02/09 10:53:28 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. |
| @@ -180,10 +180,6 @@ dtls1_connect(SSL *s) | |||
| 180 | void (*cb)(const SSL *ssl, int type, int val) = NULL; | 180 | void (*cb)(const SSL *ssl, int type, int val) = NULL; |
| 181 | int ret = -1; | 181 | int ret = -1; |
| 182 | int new_state, state, skip = 0; | 182 | int new_state, state, skip = 0; |
| 183 | #ifndef OPENSSL_NO_SCTP | ||
| 184 | unsigned char sctpauthkey[64]; | ||
| 185 | char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; | ||
| 186 | #endif | ||
| 187 | 183 | ||
| 188 | ERR_clear_error(); | 184 | ERR_clear_error(); |
| 189 | errno = 0; | 185 | errno = 0; |
| @@ -197,14 +193,6 @@ dtls1_connect(SSL *s) | |||
| 197 | if (!SSL_in_init(s) || SSL_in_before(s)) | 193 | if (!SSL_in_init(s) || SSL_in_before(s)) |
| 198 | SSL_clear(s); | 194 | SSL_clear(s); |
| 199 | 195 | ||
| 200 | #ifndef OPENSSL_NO_SCTP | ||
| 201 | /* Notify SCTP BIO socket to enter handshake | ||
| 202 | * mode and prevent stream identifier other | ||
| 203 | * than 0. Will be ignored if no SCTP is used. | ||
| 204 | */ | ||
| 205 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 206 | s->in_handshake, NULL); | ||
| 207 | #endif | ||
| 208 | 196 | ||
| 209 | for (;;) { | 197 | for (;;) { |
| 210 | state = s->state; | 198 | state = s->state; |
| @@ -271,40 +259,6 @@ dtls1_connect(SSL *s) | |||
| 271 | s->hit = 0; | 259 | s->hit = 0; |
| 272 | break; | 260 | break; |
| 273 | 261 | ||
| 274 | #ifndef OPENSSL_NO_SCTP | ||
| 275 | case DTLS1_SCTP_ST_CR_READ_SOCK: | ||
| 276 | |||
| 277 | if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 278 | s->s3->in_read_app_data = 2; | ||
| 279 | s->rwstate = SSL_READING; | ||
| 280 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 281 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 282 | ret = -1; | ||
| 283 | goto end; | ||
| 284 | } | ||
| 285 | |||
| 286 | s->state = s->s3->tmp.next_state; | ||
| 287 | break; | ||
| 288 | |||
| 289 | case DTLS1_SCTP_ST_CW_WRITE_SOCK: | ||
| 290 | /* read app data until dry event */ | ||
| 291 | |||
| 292 | ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); | ||
| 293 | if (ret < 0) | ||
| 294 | goto end; | ||
| 295 | |||
| 296 | if (ret == 0) { | ||
| 297 | s->s3->in_read_app_data = 2; | ||
| 298 | s->rwstate = SSL_READING; | ||
| 299 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 300 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 301 | ret = -1; | ||
| 302 | goto end; | ||
| 303 | } | ||
| 304 | |||
| 305 | s->state = s->d1->next_state; | ||
| 306 | break; | ||
| 307 | #endif | ||
| 308 | 262 | ||
| 309 | case SSL3_ST_CW_CLNT_HELLO_A: | 263 | case SSL3_ST_CW_CLNT_HELLO_A: |
| 310 | case SSL3_ST_CW_CLNT_HELLO_B: | 264 | case SSL3_ST_CW_CLNT_HELLO_B: |
| @@ -330,16 +284,9 @@ dtls1_connect(SSL *s) | |||
| 330 | 284 | ||
| 331 | s->init_num = 0; | 285 | s->init_num = 0; |
| 332 | 286 | ||
| 333 | #ifndef OPENSSL_NO_SCTP | ||
| 334 | /* Disable buffering for SCTP */ | ||
| 335 | if (!BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 336 | #endif | ||
| 337 | /* turn on buffering for the next lot of output */ | 287 | /* turn on buffering for the next lot of output */ |
| 338 | if (s->bbio != s->wbio) | 288 | if (s->bbio != s->wbio) |
| 339 | s->wbio = BIO_push(s->bbio, s->wbio); | 289 | s->wbio = BIO_push(s->bbio, s->wbio); |
| 340 | #ifndef OPENSSL_NO_SCTP | ||
| 341 | } | ||
| 342 | #endif | ||
| 343 | break; | 290 | break; |
| 344 | 291 | ||
| 345 | case SSL3_ST_CR_SRVR_HELLO_A: | 292 | case SSL3_ST_CR_SRVR_HELLO_A: |
| @@ -349,20 +296,6 @@ dtls1_connect(SSL *s) | |||
| 349 | goto end; | 296 | goto end; |
| 350 | else { | 297 | else { |
| 351 | if (s->hit) { | 298 | if (s->hit) { |
| 352 | #ifndef OPENSSL_NO_SCTP | ||
| 353 | /* Add new shared key for SCTP-Auth, | ||
| 354 | * will be ignored if no SCTP used. | ||
| 355 | */ | ||
| 356 | snprintf((char*) labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 357 | DTLS1_SCTP_AUTH_LABEL); | ||
| 358 | |||
| 359 | SSL_export_keying_material(s, sctpauthkey, | ||
| 360 | sizeof(sctpauthkey), labelbuffer, | ||
| 361 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 362 | |||
| 363 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 364 | sizeof(sctpauthkey), sctpauthkey); | ||
| 365 | #endif | ||
| 366 | 299 | ||
| 367 | s->state = SSL3_ST_CR_FINISHED_A; | 300 | s->state = SSL3_ST_CR_FINISHED_A; |
| 368 | } else | 301 | } else |
| @@ -453,12 +386,6 @@ dtls1_connect(SSL *s) | |||
| 453 | s->s3->tmp.next_state = SSL3_ST_CW_KEY_EXCH_A; | 386 | s->s3->tmp.next_state = SSL3_ST_CW_KEY_EXCH_A; |
| 454 | s->init_num = 0; | 387 | s->init_num = 0; |
| 455 | 388 | ||
| 456 | #ifndef OPENSSL_NO_SCTP | ||
| 457 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 458 | state == SSL_ST_RENEGOTIATE) | ||
| 459 | s->state = DTLS1_SCTP_ST_CR_READ_SOCK; | ||
| 460 | else | ||
| 461 | #endif | ||
| 462 | s->state = s->s3->tmp.next_state; | 389 | s->state = s->s3->tmp.next_state; |
| 463 | break; | 390 | break; |
| 464 | 391 | ||
| @@ -481,22 +408,6 @@ dtls1_connect(SSL *s) | |||
| 481 | if (ret <= 0) | 408 | if (ret <= 0) |
| 482 | goto end; | 409 | goto end; |
| 483 | 410 | ||
| 484 | #ifndef OPENSSL_NO_SCTP | ||
| 485 | /* Add new shared key for SCTP-Auth, | ||
| 486 | * will be ignored if no SCTP used. | ||
| 487 | */ | ||
| 488 | snprintf((char*)labelbuffer, | ||
| 489 | sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 490 | DTLS1_SCTP_AUTH_LABEL); | ||
| 491 | |||
| 492 | SSL_export_keying_material(s, sctpauthkey, | ||
| 493 | sizeof(sctpauthkey), labelbuffer, | ||
| 494 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 495 | |||
| 496 | BIO_ctrl(SSL_get_wbio(s), | ||
| 497 | BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 498 | sizeof(sctpauthkey), sctpauthkey); | ||
| 499 | #endif | ||
| 500 | 411 | ||
| 501 | /* EAY EAY EAY need to check for DH fix cert | 412 | /* EAY EAY EAY need to check for DH fix cert |
| 502 | * sent back */ | 413 | * sent back */ |
| @@ -505,12 +416,6 @@ dtls1_connect(SSL *s) | |||
| 505 | if (s->s3->tmp.cert_req == 1) { | 416 | if (s->s3->tmp.cert_req == 1) { |
| 506 | s->state = SSL3_ST_CW_CERT_VRFY_A; | 417 | s->state = SSL3_ST_CW_CERT_VRFY_A; |
| 507 | } else { | 418 | } else { |
| 508 | #ifndef OPENSSL_NO_SCTP | ||
| 509 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 510 | s->d1->next_state = SSL3_ST_CW_CHANGE_A; | ||
| 511 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 512 | } else | ||
| 513 | #endif | ||
| 514 | s->state = SSL3_ST_CW_CHANGE_A; | 419 | s->state = SSL3_ST_CW_CHANGE_A; |
| 515 | s->s3->change_cipher_spec = 0; | 420 | s->s3->change_cipher_spec = 0; |
| 516 | } | 421 | } |
| @@ -524,12 +429,6 @@ dtls1_connect(SSL *s) | |||
| 524 | ret = dtls1_send_client_verify(s); | 429 | ret = dtls1_send_client_verify(s); |
| 525 | if (ret <= 0) | 430 | if (ret <= 0) |
| 526 | goto end; | 431 | goto end; |
| 527 | #ifndef OPENSSL_NO_SCTP | ||
| 528 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 529 | s->d1->next_state = SSL3_ST_CW_CHANGE_A; | ||
| 530 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 531 | } else | ||
| 532 | #endif | ||
| 533 | s->state = SSL3_ST_CW_CHANGE_A; | 432 | s->state = SSL3_ST_CW_CHANGE_A; |
| 534 | s->init_num = 0; | 433 | s->init_num = 0; |
| 535 | s->s3->change_cipher_spec = 0; | 434 | s->s3->change_cipher_spec = 0; |
| @@ -559,15 +458,6 @@ dtls1_connect(SSL *s) | |||
| 559 | goto end; | 458 | goto end; |
| 560 | } | 459 | } |
| 561 | 460 | ||
| 562 | #ifndef OPENSSL_NO_SCTP | ||
| 563 | if (s->hit) { | ||
| 564 | /* Change to new shared key of SCTP-Auth, | ||
| 565 | * will be ignored if no SCTP used. | ||
| 566 | */ | ||
| 567 | BIO_ctrl(SSL_get_wbio(s), | ||
| 568 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 569 | } | ||
| 570 | #endif | ||
| 571 | 461 | ||
| 572 | dtls1_reset_seq_numbers(s, SSL3_CC_WRITE); | 462 | dtls1_reset_seq_numbers(s, SSL3_CC_WRITE); |
| 573 | break; | 463 | break; |
| @@ -588,31 +478,12 @@ dtls1_connect(SSL *s) | |||
| 588 | s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; | 478 | s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; |
| 589 | if (s->hit) { | 479 | if (s->hit) { |
| 590 | s->s3->tmp.next_state = SSL_ST_OK; | 480 | s->s3->tmp.next_state = SSL_ST_OK; |
| 591 | #ifndef OPENSSL_NO_SCTP | ||
| 592 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 593 | s->d1->next_state = s->s3->tmp.next_state; | ||
| 594 | s->s3->tmp.next_state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 595 | } | ||
| 596 | #endif | ||
| 597 | if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { | 481 | if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { |
| 598 | s->state = SSL_ST_OK; | 482 | s->state = SSL_ST_OK; |
| 599 | #ifndef OPENSSL_NO_SCTP | ||
| 600 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 601 | s->d1->next_state = SSL_ST_OK; | ||
| 602 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 603 | } | ||
| 604 | #endif | ||
| 605 | s->s3->flags |= SSL3_FLAGS_POP_BUFFER; | 483 | s->s3->flags |= SSL3_FLAGS_POP_BUFFER; |
| 606 | s->s3->delay_buf_pop_ret = 0; | 484 | s->s3->delay_buf_pop_ret = 0; |
| 607 | } | 485 | } |
| 608 | } else { | 486 | } else { |
| 609 | #ifndef OPENSSL_NO_SCTP | ||
| 610 | /* Change to new shared key of SCTP-Auth, | ||
| 611 | * will be ignored if no SCTP used. | ||
| 612 | */ | ||
| 613 | BIO_ctrl(SSL_get_wbio(s), | ||
| 614 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 615 | #endif | ||
| 616 | 487 | ||
| 617 | /* Allow NewSessionTicket if ticket expected */ | 488 | /* Allow NewSessionTicket if ticket expected */ |
| 618 | if (s->tlsext_ticket_expected) | 489 | if (s->tlsext_ticket_expected) |
| @@ -657,13 +528,6 @@ dtls1_connect(SSL *s) | |||
| 657 | else | 528 | else |
| 658 | s->state = SSL_ST_OK; | 529 | s->state = SSL_ST_OK; |
| 659 | 530 | ||
| 660 | #ifndef OPENSSL_NO_SCTP | ||
| 661 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 662 | state == SSL_ST_RENEGOTIATE) { | ||
| 663 | s->d1->next_state = s->state; | ||
| 664 | s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK; | ||
| 665 | } | ||
| 666 | #endif | ||
| 667 | 531 | ||
| 668 | s->init_num = 0; | 532 | s->init_num = 0; |
| 669 | break; | 533 | break; |
| @@ -742,14 +606,6 @@ dtls1_connect(SSL *s) | |||
| 742 | end: | 606 | end: |
| 743 | s->in_handshake--; | 607 | s->in_handshake--; |
| 744 | 608 | ||
| 745 | #ifndef OPENSSL_NO_SCTP | ||
| 746 | /* Notify SCTP BIO socket to leave handshake | ||
| 747 | * mode and allow stream identifier other | ||
| 748 | * than 0. Will be ignored if no SCTP is used. | ||
| 749 | */ | ||
| 750 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 751 | s->in_handshake, NULL); | ||
| 752 | #endif | ||
| 753 | 609 | ||
| 754 | if (buf != NULL) | 610 | if (buf != NULL) |
| 755 | BUF_MEM_free(buf); | 611 | BUF_MEM_free(buf); |
diff --git a/src/lib/libssl/src/ssl/d1_lib.c b/src/lib/libssl/src/ssl/d1_lib.c index 26f5901cc4..9d9a90d76a 100644 --- a/src/lib/libssl/src/ssl/d1_lib.c +++ b/src/lib/libssl/src/ssl/d1_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_lib.c,v 1.26 2014/12/14 15:30:50 jsing Exp $ */ | 1 | /* $OpenBSD: d1_lib.c,v 1.27 2015/02/09 10:53:28 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. |
| @@ -297,13 +297,6 @@ dtls1_get_cipher(unsigned int u) | |||
| 297 | void | 297 | void |
| 298 | dtls1_start_timer(SSL *s) | 298 | dtls1_start_timer(SSL *s) |
| 299 | { | 299 | { |
| 300 | #ifndef OPENSSL_NO_SCTP | ||
| 301 | /* Disable timer for SCTP */ | ||
| 302 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 303 | memset(&(s->d1->next_timeout), 0, sizeof(struct timeval)); | ||
| 304 | return; | ||
| 305 | } | ||
| 306 | #endif | ||
| 307 | 300 | ||
| 308 | /* If timer is not set, initialize duration with 1 second */ | 301 | /* If timer is not set, initialize duration with 1 second */ |
| 309 | if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { | 302 | if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { |
diff --git a/src/lib/libssl/src/ssl/d1_pkt.c b/src/lib/libssl/src/ssl/d1_pkt.c index 91e9c146ac..c997b7f212 100644 --- a/src/lib/libssl/src/ssl/d1_pkt.c +++ b/src/lib/libssl/src/ssl/d1_pkt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_pkt.c,v 1.39 2015/01/21 00:15:50 doug Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.40 2015/02/09 10:53:28 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. |
| @@ -231,13 +231,6 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
| 231 | 231 | ||
| 232 | item->data = rdata; | 232 | item->data = rdata; |
| 233 | 233 | ||
| 234 | #ifndef OPENSSL_NO_SCTP | ||
| 235 | /* Store bio_dgram_sctp_rcvinfo struct */ | ||
| 236 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 237 | (s->state == SSL3_ST_SR_FINISHED_A || s->state == SSL3_ST_CR_FINISHED_A)) { | ||
| 238 | BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(rdata->recordinfo), &rdata->recordinfo); | ||
| 239 | } | ||
| 240 | #endif | ||
| 241 | 234 | ||
| 242 | s->packet = NULL; | 235 | s->packet = NULL; |
| 243 | s->packet_length = 0; | 236 | s->packet_length = 0; |
| @@ -582,10 +575,6 @@ again: | |||
| 582 | /* get another record */ | 575 | /* get another record */ |
| 583 | } | 576 | } |
| 584 | 577 | ||
| 585 | #ifndef OPENSSL_NO_SCTP | ||
| 586 | /* Only do replay check if no SCTP bio */ | ||
| 587 | if (!BIO_dgram_is_sctp(SSL_get_rbio(s))) { | ||
| 588 | #endif | ||
| 589 | /* Check whether this is a repeat, or aged record. | 578 | /* Check whether this is a repeat, or aged record. |
| 590 | * Don't check if we're listening and this message is | 579 | * Don't check if we're listening and this message is |
| 591 | * a ClientHello. They can look as if they're replayed, | 580 | * a ClientHello. They can look as if they're replayed, |
| @@ -600,9 +589,6 @@ again: | |||
| 600 | goto again; | 589 | goto again; |
| 601 | /* get another record */ | 590 | /* get another record */ |
| 602 | } | 591 | } |
| 603 | #ifndef OPENSSL_NO_SCTP | ||
| 604 | } | ||
| 605 | #endif | ||
| 606 | 592 | ||
| 607 | /* just read a 0 length packet */ | 593 | /* just read a 0 length packet */ |
| 608 | if (rr->length == 0) | 594 | if (rr->length == 0) |
| @@ -692,18 +678,7 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) | |||
| 692 | 678 | ||
| 693 | /* Now s->d1->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ | 679 | /* Now s->d1->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ |
| 694 | 680 | ||
| 695 | #ifndef OPENSSL_NO_SCTP | ||
| 696 | /* Continue handshake if it had to be interrupted to read | ||
| 697 | * app data with SCTP. | ||
| 698 | */ | ||
| 699 | if ((!s->in_handshake && SSL_in_init(s)) || | ||
| 700 | (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 701 | (s->state == DTLS1_SCTP_ST_SR_READ_SOCK || | ||
| 702 | s->state == DTLS1_SCTP_ST_CR_READ_SOCK) && | ||
| 703 | s->s3->in_read_app_data != 2)) | ||
| 704 | #else | ||
| 705 | if (!s->in_handshake && SSL_in_init(s)) | 681 | if (!s->in_handshake && SSL_in_init(s)) |
| 706 | #endif | ||
| 707 | { | 682 | { |
| 708 | /* type == SSL3_RT_APPLICATION_DATA */ | 683 | /* type == SSL3_RT_APPLICATION_DATA */ |
| 709 | i = s->handshake_func(s); | 684 | i = s->handshake_func(s); |
| @@ -732,13 +707,6 @@ start: | |||
| 732 | pitem *item; | 707 | pitem *item; |
| 733 | item = pqueue_pop(s->d1->buffered_app_data.q); | 708 | item = pqueue_pop(s->d1->buffered_app_data.q); |
| 734 | if (item) { | 709 | if (item) { |
| 735 | #ifndef OPENSSL_NO_SCTP | ||
| 736 | /* Restore bio_dgram_sctp_rcvinfo struct */ | ||
| 737 | if (BIO_dgram_is_sctp(SSL_get_rbio(s))) { | ||
| 738 | DTLS1_RECORD_DATA *rdata = (DTLS1_RECORD_DATA *) item->data; | ||
| 739 | BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO, sizeof(rdata->recordinfo), &rdata->recordinfo); | ||
| 740 | } | ||
| 741 | #endif | ||
| 742 | 710 | ||
| 743 | dtls1_copy_record(s, item); | 711 | dtls1_copy_record(s, item); |
| 744 | 712 | ||
| @@ -826,29 +794,6 @@ start: | |||
| 826 | } | 794 | } |
| 827 | } | 795 | } |
| 828 | 796 | ||
| 829 | #ifndef OPENSSL_NO_SCTP | ||
| 830 | /* We were about to renegotiate but had to read | ||
| 831 | * belated application data first, so retry. | ||
| 832 | */ | ||
| 833 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 834 | rr->type == SSL3_RT_APPLICATION_DATA && | ||
| 835 | (s->state == DTLS1_SCTP_ST_SR_READ_SOCK || | ||
| 836 | s->state == DTLS1_SCTP_ST_CR_READ_SOCK)) { | ||
| 837 | s->rwstate = SSL_READING; | ||
| 838 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 839 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 840 | } | ||
| 841 | |||
| 842 | /* We might had to delay a close_notify alert because | ||
| 843 | * of reordered app data. If there was an alert and there | ||
| 844 | * is no message to read anymore, finally set shutdown. | ||
| 845 | */ | ||
| 846 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 847 | s->d1->shutdown_received && !BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 848 | s->shutdown |= SSL_RECEIVED_SHUTDOWN; | ||
| 849 | return (0); | ||
| 850 | } | ||
| 851 | #endif | ||
| 852 | return (n); | 797 | return (n); |
| 853 | } | 798 | } |
| 854 | 799 | ||
| @@ -1006,20 +951,6 @@ start: | |||
| 1006 | { | 951 | { |
| 1007 | s->s3->warn_alert = alert_descr; | 952 | s->s3->warn_alert = alert_descr; |
| 1008 | if (alert_descr == SSL_AD_CLOSE_NOTIFY) { | 953 | if (alert_descr == SSL_AD_CLOSE_NOTIFY) { |
| 1009 | #ifndef OPENSSL_NO_SCTP | ||
| 1010 | /* With SCTP and streams the socket may deliver app data | ||
| 1011 | * after a close_notify alert. We have to check this | ||
| 1012 | * first so that nothing gets discarded. | ||
| 1013 | */ | ||
| 1014 | if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && | ||
| 1015 | BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 1016 | s->d1->shutdown_received = 1; | ||
| 1017 | s->rwstate = SSL_READING; | ||
| 1018 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 1019 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 1020 | return -1; | ||
| 1021 | } | ||
| 1022 | #endif | ||
| 1023 | s->shutdown |= SSL_RECEIVED_SHUTDOWN; | 954 | s->shutdown |= SSL_RECEIVED_SHUTDOWN; |
| 1024 | return (0); | 955 | return (0); |
| 1025 | } | 956 | } |
| @@ -1093,14 +1024,6 @@ start: | |||
| 1093 | if (s->version == DTLS1_BAD_VER) | 1024 | if (s->version == DTLS1_BAD_VER) |
| 1094 | s->d1->handshake_read_seq++; | 1025 | s->d1->handshake_read_seq++; |
| 1095 | 1026 | ||
| 1096 | #ifndef OPENSSL_NO_SCTP | ||
| 1097 | /* Remember that a CCS has been received, | ||
| 1098 | * so that an old key of SCTP-Auth can be | ||
| 1099 | * deleted when a CCS is sent. Will be ignored | ||
| 1100 | * if no SCTP is used | ||
| 1101 | */ | ||
| 1102 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD, 1, NULL); | ||
| 1103 | #endif | ||
| 1104 | 1027 | ||
| 1105 | goto start; | 1028 | goto start; |
| 1106 | } | 1029 | } |
| @@ -1217,17 +1140,7 @@ dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len) | |||
| 1217 | { | 1140 | { |
| 1218 | int i; | 1141 | int i; |
| 1219 | 1142 | ||
| 1220 | #ifndef OPENSSL_NO_SCTP | ||
| 1221 | /* Check if we have to continue an interrupted handshake | ||
| 1222 | * for reading belated app data with SCTP. | ||
| 1223 | */ | ||
| 1224 | if ((SSL_in_init(s) && !s->in_handshake) || | ||
| 1225 | (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 1226 | (s->state == DTLS1_SCTP_ST_SR_READ_SOCK || | ||
| 1227 | s->state == DTLS1_SCTP_ST_CR_READ_SOCK))) | ||
| 1228 | #else | ||
| 1229 | if (SSL_in_init(s) && !s->in_handshake) | 1143 | if (SSL_in_init(s) && !s->in_handshake) |
| 1230 | #endif | ||
| 1231 | { | 1144 | { |
| 1232 | i = s->handshake_func(s); | 1145 | i = s->handshake_func(s); |
| 1233 | if (i < 0) | 1146 | if (i < 0) |
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c index 1c732c5b08..4e6d0da3b3 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.48 2015/02/07 08:56:39 jsing Exp $ */ | 1 | /* $OpenBSD: d1_srvr.c,v 1.49 2015/02/09 10:53:28 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. |
| @@ -182,10 +182,6 @@ dtls1_accept(SSL *s) | |||
| 182 | int ret = -1; | 182 | int ret = -1; |
| 183 | int new_state, state, skip = 0; | 183 | int new_state, state, skip = 0; |
| 184 | int listen; | 184 | int listen; |
| 185 | #ifndef OPENSSL_NO_SCTP | ||
| 186 | unsigned char sctpauthkey[64]; | ||
| 187 | char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)]; | ||
| 188 | #endif | ||
| 189 | 185 | ||
| 190 | ERR_clear_error(); | 186 | ERR_clear_error(); |
| 191 | errno = 0; | 187 | errno = 0; |
| @@ -203,14 +199,6 @@ dtls1_accept(SSL *s) | |||
| 203 | SSL_clear(s); | 199 | SSL_clear(s); |
| 204 | 200 | ||
| 205 | s->d1->listen = listen; | 201 | s->d1->listen = listen; |
| 206 | #ifndef OPENSSL_NO_SCTP | ||
| 207 | /* Notify SCTP BIO socket to enter handshake | ||
| 208 | * mode and prevent stream identifier other | ||
| 209 | * than 0. Will be ignored if no SCTP is used. | ||
| 210 | */ | ||
| 211 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 212 | s->in_handshake, NULL); | ||
| 213 | #endif | ||
| 214 | 202 | ||
| 215 | if (s->cert == NULL) { | 203 | if (s->cert == NULL) { |
| 216 | SSLerr(SSL_F_DTLS1_ACCEPT, SSL_R_NO_CERTIFICATE_SET); | 204 | SSLerr(SSL_F_DTLS1_ACCEPT, SSL_R_NO_CERTIFICATE_SET); |
| @@ -266,9 +254,6 @@ dtls1_accept(SSL *s) | |||
| 266 | * the output is sent in a way that TCP likes :-) | 254 | * the output is sent in a way that TCP likes :-) |
| 267 | * ...but not with SCTP :-) | 255 | * ...but not with SCTP :-) |
| 268 | */ | 256 | */ |
| 269 | #ifndef OPENSSL_NO_SCTP | ||
| 270 | if (!BIO_dgram_is_sctp(SSL_get_wbio(s))) | ||
| 271 | #endif | ||
| 272 | if (!ssl_init_wbio_buffer(s, 1)) { | 257 | if (!ssl_init_wbio_buffer(s, 1)) { |
| 273 | ret = -1; | 258 | ret = -1; |
| 274 | goto end; | 259 | goto end; |
| @@ -368,40 +353,6 @@ dtls1_accept(SSL *s) | |||
| 368 | } | 353 | } |
| 369 | break; | 354 | break; |
| 370 | 355 | ||
| 371 | #ifndef OPENSSL_NO_SCTP | ||
| 372 | case DTLS1_SCTP_ST_SR_READ_SOCK: | ||
| 373 | |||
| 374 | if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) { | ||
| 375 | s->s3->in_read_app_data = 2; | ||
| 376 | s->rwstate = SSL_READING; | ||
| 377 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 378 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 379 | ret = -1; | ||
| 380 | goto end; | ||
| 381 | } | ||
| 382 | |||
| 383 | s->state = SSL3_ST_SR_FINISHED_A; | ||
| 384 | break; | ||
| 385 | |||
| 386 | case DTLS1_SCTP_ST_SW_WRITE_SOCK: | ||
| 387 | ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); | ||
| 388 | if (ret < 0) | ||
| 389 | goto end; | ||
| 390 | |||
| 391 | if (ret == 0) { | ||
| 392 | if (s->d1->next_state != SSL_ST_OK) { | ||
| 393 | s->s3->in_read_app_data = 2; | ||
| 394 | s->rwstate = SSL_READING; | ||
| 395 | BIO_clear_retry_flags(SSL_get_rbio(s)); | ||
| 396 | BIO_set_retry_read(SSL_get_rbio(s)); | ||
| 397 | ret = -1; | ||
| 398 | goto end; | ||
| 399 | } | ||
| 400 | } | ||
| 401 | |||
| 402 | s->state = s->d1->next_state; | ||
| 403 | break; | ||
| 404 | #endif | ||
| 405 | 356 | ||
| 406 | case SSL3_ST_SW_SRVR_HELLO_A: | 357 | case SSL3_ST_SW_SRVR_HELLO_A: |
| 407 | case SSL3_ST_SW_SRVR_HELLO_B: | 358 | case SSL3_ST_SW_SRVR_HELLO_B: |
| @@ -412,22 +363,6 @@ dtls1_accept(SSL *s) | |||
| 412 | goto end; | 363 | goto end; |
| 413 | 364 | ||
| 414 | if (s->hit) { | 365 | if (s->hit) { |
| 415 | #ifndef OPENSSL_NO_SCTP | ||
| 416 | /* Add new shared key for SCTP-Auth, | ||
| 417 | * will be ignored if no SCTP used. | ||
| 418 | */ | ||
| 419 | snprintf((char*)labelbuffer, | ||
| 420 | sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 421 | DTLS1_SCTP_AUTH_LABEL); | ||
| 422 | |||
| 423 | SSL_export_keying_material(s, sctpauthkey, | ||
| 424 | sizeof(sctpauthkey), labelbuffer, | ||
| 425 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 426 | |||
| 427 | BIO_ctrl(SSL_get_wbio(s), | ||
| 428 | BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 429 | sizeof(sctpauthkey), sctpauthkey); | ||
| 430 | #endif | ||
| 431 | if (s->tlsext_ticket_expected) | 366 | if (s->tlsext_ticket_expected) |
| 432 | s->state = SSL3_ST_SW_SESSION_TICKET_A; | 367 | s->state = SSL3_ST_SW_SESSION_TICKET_A; |
| 433 | else | 368 | else |
| @@ -503,12 +438,6 @@ dtls1_accept(SSL *s) | |||
| 503 | skip = 1; | 438 | skip = 1; |
| 504 | s->s3->tmp.cert_request = 0; | 439 | s->s3->tmp.cert_request = 0; |
| 505 | s->state = SSL3_ST_SW_SRVR_DONE_A; | 440 | s->state = SSL3_ST_SW_SRVR_DONE_A; |
| 506 | #ifndef OPENSSL_NO_SCTP | ||
| 507 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 508 | s->d1->next_state = SSL3_ST_SW_SRVR_DONE_A; | ||
| 509 | s->state = DTLS1_SCTP_ST_SW_WRITE_SOCK; | ||
| 510 | } | ||
| 511 | #endif | ||
| 512 | } else { | 441 | } else { |
| 513 | s->s3->tmp.cert_request = 1; | 442 | s->s3->tmp.cert_request = 1; |
| 514 | dtls1_start_timer(s); | 443 | dtls1_start_timer(s); |
| @@ -516,12 +445,6 @@ dtls1_accept(SSL *s) | |||
| 516 | if (ret <= 0) | 445 | if (ret <= 0) |
| 517 | goto end; | 446 | goto end; |
| 518 | s->state = SSL3_ST_SW_SRVR_DONE_A; | 447 | s->state = SSL3_ST_SW_SRVR_DONE_A; |
| 519 | #ifndef OPENSSL_NO_SCTP | ||
| 520 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 521 | s->d1->next_state = SSL3_ST_SW_SRVR_DONE_A; | ||
| 522 | s->state = DTLS1_SCTP_ST_SW_WRITE_SOCK; | ||
| 523 | } | ||
| 524 | #endif | ||
| 525 | s->init_num = 0; | 448 | s->init_num = 0; |
| 526 | } | 449 | } |
| 527 | break; | 450 | break; |
| @@ -578,22 +501,6 @@ dtls1_accept(SSL *s) | |||
| 578 | ret = ssl3_get_client_key_exchange(s); | 501 | ret = ssl3_get_client_key_exchange(s); |
| 579 | if (ret <= 0) | 502 | if (ret <= 0) |
| 580 | goto end; | 503 | goto end; |
| 581 | #ifndef OPENSSL_NO_SCTP | ||
| 582 | /* Add new shared key for SCTP-Auth, | ||
| 583 | * will be ignored if no SCTP used. | ||
| 584 | */ | ||
| 585 | snprintf((char *)labelbuffer, | ||
| 586 | sizeof(DTLS1_SCTP_AUTH_LABEL), | ||
| 587 | DTLS1_SCTP_AUTH_LABEL); | ||
| 588 | |||
| 589 | SSL_export_keying_material(s, sctpauthkey, | ||
| 590 | sizeof(sctpauthkey), labelbuffer, | ||
| 591 | sizeof(labelbuffer), NULL, 0, 0); | ||
| 592 | |||
| 593 | BIO_ctrl(SSL_get_wbio(s), | ||
| 594 | BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY, | ||
| 595 | sizeof(sctpauthkey), sctpauthkey); | ||
| 596 | #endif | ||
| 597 | 504 | ||
| 598 | s->state = SSL3_ST_SR_CERT_VRFY_A; | 505 | s->state = SSL3_ST_SR_CERT_VRFY_A; |
| 599 | s->init_num = 0; | 506 | s->init_num = 0; |
| @@ -628,12 +535,6 @@ dtls1_accept(SSL *s) | |||
| 628 | ret = ssl3_get_cert_verify(s); | 535 | ret = ssl3_get_cert_verify(s); |
| 629 | if (ret <= 0) | 536 | if (ret <= 0) |
| 630 | goto end; | 537 | goto end; |
| 631 | #ifndef OPENSSL_NO_SCTP | ||
| 632 | if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && | ||
| 633 | state == SSL_ST_RENEGOTIATE) | ||
| 634 | s->state = DTLS1_SCTP_ST_SR_READ_SOCK; | ||
| 635 | else | ||
| 636 | #endif | ||
| 637 | s->state = SSL3_ST_SR_FINISHED_A; | 538 | s->state = SSL3_ST_SR_FINISHED_A; |
| 638 | s->init_num = 0; | 539 | s->init_num = 0; |
| 639 | break; | 540 | break; |
| @@ -689,15 +590,6 @@ dtls1_accept(SSL *s) | |||
| 689 | if (ret <= 0) | 590 | if (ret <= 0) |
| 690 | goto end; | 591 | goto end; |
| 691 | 592 | ||
| 692 | #ifndef OPENSSL_NO_SCTP | ||
| 693 | if (!s->hit) { | ||
| 694 | /* Change to new shared key of SCTP-Auth, | ||
| 695 | * will be ignored if no SCTP used. | ||
| 696 | */ | ||
| 697 | BIO_ctrl(SSL_get_wbio(s), | ||
| 698 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 699 | } | ||
| 700 | #endif | ||
| 701 | 593 | ||
| 702 | s->state = SSL3_ST_SW_FINISHED_A; | 594 | s->state = SSL3_ST_SW_FINISHED_A; |
| 703 | s->init_num = 0; | 595 | s->init_num = 0; |
| @@ -723,21 +615,8 @@ dtls1_accept(SSL *s) | |||
| 723 | if (s->hit) { | 615 | if (s->hit) { |
| 724 | s->s3->tmp.next_state = SSL3_ST_SR_FINISHED_A; | 616 | s->s3->tmp.next_state = SSL3_ST_SR_FINISHED_A; |
| 725 | 617 | ||
| 726 | #ifndef OPENSSL_NO_SCTP | ||
| 727 | /* Change to new shared key of SCTP-Auth, | ||
| 728 | * will be ignored if no SCTP used. | ||
| 729 | */ | ||
| 730 | BIO_ctrl(SSL_get_wbio(s), | ||
| 731 | BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL); | ||
| 732 | #endif | ||
| 733 | } else { | 618 | } else { |
| 734 | s->s3->tmp.next_state = SSL_ST_OK; | 619 | s->s3->tmp.next_state = SSL_ST_OK; |
| 735 | #ifndef OPENSSL_NO_SCTP | ||
| 736 | if (BIO_dgram_is_sctp(SSL_get_wbio(s))) { | ||
| 737 | s->d1->next_state = s->s3->tmp.next_state; | ||
| 738 | s->s3->tmp.next_state = DTLS1_SCTP_ST_SW_WRITE_SOCK; | ||
| 739 | } | ||
| 740 | #endif | ||
| 741 | } | 620 | } |
| 742 | s->init_num = 0; | 621 | s->init_num = 0; |
| 743 | break; | 622 | break; |
| @@ -802,14 +681,6 @@ end: | |||
| 802 | /* BIO_flush(s->wbio); */ | 681 | /* BIO_flush(s->wbio); */ |
| 803 | 682 | ||
| 804 | s->in_handshake--; | 683 | s->in_handshake--; |
| 805 | #ifndef OPENSSL_NO_SCTP | ||
| 806 | /* Notify SCTP BIO socket to leave handshake | ||
| 807 | * mode and prevent stream identifier other | ||
| 808 | * than 0. Will be ignored if no SCTP is used. | ||
| 809 | */ | ||
| 810 | BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE, | ||
| 811 | s->in_handshake, NULL); | ||
| 812 | #endif | ||
| 813 | 684 | ||
| 814 | if (cb != NULL) | 685 | if (cb != NULL) |
| 815 | cb(s, SSL_CB_ACCEPT_EXIT, ret); | 686 | cb(s, SSL_CB_ACCEPT_EXIT, ret); |
diff --git a/src/lib/libssl/src/ssl/dtls1.h b/src/lib/libssl/src/ssl/dtls1.h index 40940a494a..1d65dc5821 100644 --- a/src/lib/libssl/src/ssl/dtls1.h +++ b/src/lib/libssl/src/ssl/dtls1.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dtls1.h,v 1.16 2014/12/14 15:30:50 jsing Exp $ */ | 1 | /* $OpenBSD: dtls1.h,v 1.17 2015/02/09 10:53:28 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. |
| @@ -95,9 +95,6 @@ extern "C" { | |||
| 95 | 95 | ||
| 96 | #ifndef OPENSSL_NO_SSL_INTERN | 96 | #ifndef OPENSSL_NO_SSL_INTERN |
| 97 | 97 | ||
| 98 | #ifndef OPENSSL_NO_SCTP | ||
| 99 | #define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" | ||
| 100 | #endif | ||
| 101 | 98 | ||
| 102 | typedef struct dtls1_bitmap_st { | 99 | typedef struct dtls1_bitmap_st { |
| 103 | unsigned long map; /* track 32 packets on 32-bit systems | 100 | unsigned long map; /* track 32 packets on 32-bit systems |
| @@ -225,12 +222,6 @@ typedef struct dtls1_state_st { | |||
| 225 | unsigned int retransmitting; | 222 | unsigned int retransmitting; |
| 226 | unsigned int change_cipher_spec_ok; | 223 | unsigned int change_cipher_spec_ok; |
| 227 | 224 | ||
| 228 | #ifndef OPENSSL_NO_SCTP | ||
| 229 | /* used when SSL_ST_XX_FLUSH is entered */ | ||
| 230 | int next_state; | ||
| 231 | |||
| 232 | int shutdown_received; | ||
| 233 | #endif | ||
| 234 | 225 | ||
| 235 | } DTLS1_STATE; | 226 | } DTLS1_STATE; |
| 236 | 227 | ||
| @@ -239,9 +230,6 @@ typedef struct dtls1_record_data_st { | |||
| 239 | unsigned int packet_length; | 230 | unsigned int packet_length; |
| 240 | SSL3_BUFFER rbuf; | 231 | SSL3_BUFFER rbuf; |
| 241 | SSL3_RECORD rrec; | 232 | SSL3_RECORD rrec; |
| 242 | #ifndef OPENSSL_NO_SCTP | ||
| 243 | struct bio_dgram_sctp_rcvinfo recordinfo; | ||
| 244 | #endif | ||
| 245 | } DTLS1_RECORD_DATA; | 233 | } DTLS1_RECORD_DATA; |
| 246 | 234 | ||
| 247 | #endif | 235 | #endif |
diff --git a/src/lib/libssl/src/ssl/ssl3.h b/src/lib/libssl/src/ssl/ssl3.h index 5f59e18eb4..2d7d35b7b2 100644 --- a/src/lib/libssl/src/ssl/ssl3.h +++ b/src/lib/libssl/src/ssl/ssl3.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl3.h,v 1.33 2014/12/14 21:49:29 bcook Exp $ */ | 1 | /* $OpenBSD: ssl3.h,v 1.34 2015/02/09 10:53:28 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 | * |
| @@ -512,10 +512,6 @@ typedef struct ssl3_state_st { | |||
| 512 | /*client */ | 512 | /*client */ |
| 513 | /* extra state */ | 513 | /* extra state */ |
| 514 | #define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) | 514 | #define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) |
| 515 | #ifndef OPENSSL_NO_SCTP | ||
| 516 | #define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310|SSL_ST_CONNECT) | ||
| 517 | #define DTLS1_SCTP_ST_CR_READ_SOCK (0x320|SSL_ST_CONNECT) | ||
| 518 | #endif | ||
| 519 | /* write to server */ | 515 | /* write to server */ |
| 520 | #define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) | 516 | #define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) |
| 521 | #define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) | 517 | #define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) |
| @@ -562,10 +558,6 @@ typedef struct ssl3_state_st { | |||
| 562 | /* server */ | 558 | /* server */ |
| 563 | /* extra state */ | 559 | /* extra state */ |
| 564 | #define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) | 560 | #define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) |
| 565 | #ifndef OPENSSL_NO_SCTP | ||
| 566 | #define DTLS1_SCTP_ST_SW_WRITE_SOCK (0x310|SSL_ST_ACCEPT) | ||
| 567 | #define DTLS1_SCTP_ST_SR_READ_SOCK (0x320|SSL_ST_ACCEPT) | ||
| 568 | #endif | ||
| 569 | /* read from client */ | 561 | /* read from client */ |
| 570 | /* Do not change the number values, they do matter */ | 562 | /* Do not change the number values, they do matter */ |
| 571 | #define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) | 563 | #define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) |
diff --git a/src/lib/libssl/ssl3.h b/src/lib/libssl/ssl3.h index 5f59e18eb4..2d7d35b7b2 100644 --- a/src/lib/libssl/ssl3.h +++ b/src/lib/libssl/ssl3.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl3.h,v 1.33 2014/12/14 21:49:29 bcook Exp $ */ | 1 | /* $OpenBSD: ssl3.h,v 1.34 2015/02/09 10:53:28 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 | * |
| @@ -512,10 +512,6 @@ typedef struct ssl3_state_st { | |||
| 512 | /*client */ | 512 | /*client */ |
| 513 | /* extra state */ | 513 | /* extra state */ |
| 514 | #define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) | 514 | #define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) |
| 515 | #ifndef OPENSSL_NO_SCTP | ||
| 516 | #define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310|SSL_ST_CONNECT) | ||
| 517 | #define DTLS1_SCTP_ST_CR_READ_SOCK (0x320|SSL_ST_CONNECT) | ||
| 518 | #endif | ||
| 519 | /* write to server */ | 515 | /* write to server */ |
| 520 | #define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) | 516 | #define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) |
| 521 | #define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) | 517 | #define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) |
| @@ -562,10 +558,6 @@ typedef struct ssl3_state_st { | |||
| 562 | /* server */ | 558 | /* server */ |
| 563 | /* extra state */ | 559 | /* extra state */ |
| 564 | #define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) | 560 | #define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) |
| 565 | #ifndef OPENSSL_NO_SCTP | ||
| 566 | #define DTLS1_SCTP_ST_SW_WRITE_SOCK (0x310|SSL_ST_ACCEPT) | ||
| 567 | #define DTLS1_SCTP_ST_SR_READ_SOCK (0x320|SSL_ST_ACCEPT) | ||
| 568 | #endif | ||
| 569 | /* read from client */ | 561 | /* read from client */ |
| 570 | /* Do not change the number values, they do matter */ | 562 | /* Do not change the number values, they do matter */ |
| 571 | #define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) | 563 | #define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) |
