diff options
| author | doug <> | 2015-06-18 22:51:05 +0000 |
|---|---|---|
| committer | doug <> | 2015-06-18 22:51:05 +0000 |
| commit | dcf41c369c66abeda9455a63d221f867cb78f343 (patch) | |
| tree | 5729e1b2f86afcffeade0b5863becbbfffc58a44 /src | |
| parent | 33dcaa629de0a917bb9314aaaa0c3bac24dc9892 (diff) | |
| download | openbsd-dcf41c369c66abeda9455a63d221f867cb78f343.tar.gz openbsd-dcf41c369c66abeda9455a63d221f867cb78f343.tar.bz2 openbsd-dcf41c369c66abeda9455a63d221f867cb78f343.zip | |
Remove Microsoft Server Gated Crypto.
Another relic due to the old US crypto policy.
From OpenSSL commit 63eab8a620944a990ab3985620966ccd9f48d681 and
95275599399e277e71d064790a1f828a99fc661a.
ok jsing@ miod@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/d1_srvr.c | 23 | ||||
| -rw-r--r-- | src/lib/libssl/doc/BIO_f_ssl.3 | 6 | ||||
| -rw-r--r-- | src/lib/libssl/doc/SSL_accept.3 | 16 | ||||
| -rw-r--r-- | src/lib/libssl/doc/SSL_do_handshake.3 | 18 | ||||
| -rw-r--r-- | src/lib/libssl/s3_both.c | 16 | ||||
| -rw-r--r-- | src/lib/libssl/s3_srvr.c | 63 | ||||
| -rw-r--r-- | src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 | 6 | ||||
| -rw-r--r-- | src/lib/libssl/src/doc/ssl/SSL_accept.3 | 16 | ||||
| -rw-r--r-- | src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 | 18 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_srvr.c | 23 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/s3_both.c | 16 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/s3_srvr.c | 63 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/ssl3.h | 13 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/ssl_locl.h | 3 | ||||
| -rw-r--r-- | src/lib/libssl/ssl3.h | 13 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_locl.h | 3 |
16 files changed, 52 insertions, 264 deletions
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c index f3972ae9d0..698292f33f 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.54 2015/06/18 22:30:47 doug Exp $ */ | 1 | /* $OpenBSD: d1_srvr.c,v 1.55 2015/06/18 22:51:05 doug 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. |
| @@ -468,22 +468,13 @@ dtls1_accept(SSL *s) | |||
| 468 | 468 | ||
| 469 | case SSL3_ST_SR_CERT_A: | 469 | case SSL3_ST_SR_CERT_A: |
| 470 | case SSL3_ST_SR_CERT_B: | 470 | case SSL3_ST_SR_CERT_B: |
| 471 | /* Check for second client hello (MS SGC) */ | 471 | if (s->s3->tmp.cert_request) { |
| 472 | ret = ssl3_check_client_hello(s); | 472 | ret = ssl3_get_client_certificate(s); |
| 473 | if (ret <= 0) | 473 | if (ret <= 0) |
| 474 | goto end; | 474 | goto end; |
| 475 | if (ret == 2) { | ||
| 476 | dtls1_stop_timer(s); | ||
| 477 | s->state = SSL3_ST_SR_CLNT_HELLO_C; | ||
| 478 | } else { | ||
| 479 | if (s->s3->tmp.cert_request) { | ||
| 480 | ret = ssl3_get_client_certificate(s); | ||
| 481 | if (ret <= 0) | ||
| 482 | goto end; | ||
| 483 | } | ||
| 484 | s->init_num = 0; | ||
| 485 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 486 | } | 475 | } |
| 476 | s->init_num = 0; | ||
| 477 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 487 | break; | 478 | break; |
| 488 | 479 | ||
| 489 | case SSL3_ST_SR_KEY_EXCH_A: | 480 | case SSL3_ST_SR_KEY_EXCH_A: |
diff --git a/src/lib/libssl/doc/BIO_f_ssl.3 b/src/lib/libssl/doc/BIO_f_ssl.3 index 851e4f08ca..876018a839 100644 --- a/src/lib/libssl/doc/BIO_f_ssl.3 +++ b/src/lib/libssl/doc/BIO_f_ssl.3 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | .\" | 1 | .\" |
| 2 | .\" $OpenBSD: BIO_f_ssl.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | 2 | .\" $OpenBSD: BIO_f_ssl.3,v 1.3 2015/06/18 22:51:05 doug Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .Dd $Mdocdate: December 2 2014 $ | 4 | .Dd $Mdocdate: June 18 2015 $ |
| 5 | .Dt BIO_F_SSL 3 | 5 | .Dt BIO_F_SSL 3 |
| 6 | .Os | 6 | .Os |
| 7 | .Sh NAME | 7 | .Sh NAME |
| @@ -240,7 +240,7 @@ still request a retry in exceptional circumstances. | |||
| 240 | Specifically this will happen if a session renegotiation takes place during a | 240 | Specifically this will happen if a session renegotiation takes place during a |
| 241 | .Xr BIO_read 3 | 241 | .Xr BIO_read 3 |
| 242 | operation. | 242 | operation. |
| 243 | One case where this happens is when SGC or step up occurs. | 243 | One case where this happens is when step up occurs. |
| 244 | .Pp | 244 | .Pp |
| 245 | In OpenSSL 0.9.6 and later the SSL flag | 245 | In OpenSSL 0.9.6 and later the SSL flag |
| 246 | .Dv SSL_AUTO_RETRY | 246 | .Dv SSL_AUTO_RETRY |
diff --git a/src/lib/libssl/doc/SSL_accept.3 b/src/lib/libssl/doc/SSL_accept.3 index 06465d1955..8c7409d04f 100644 --- a/src/lib/libssl/doc/SSL_accept.3 +++ b/src/lib/libssl/doc/SSL_accept.3 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | .\" | 1 | .\" |
| 2 | .\" $OpenBSD: SSL_accept.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | 2 | .\" $OpenBSD: SSL_accept.3,v 1.3 2015/06/18 22:51:05 doug Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .Dd $Mdocdate: December 2 2014 $ | 4 | .Dd $Mdocdate: June 18 2015 $ |
| 5 | .Dt SSL_ACCEPT 3 | 5 | .Dt SSL_ACCEPT 3 |
| 6 | .Os | 6 | .Os |
| 7 | .Sh NAME | 7 | .Sh NAME |
| @@ -29,17 +29,7 @@ If the underlying | |||
| 29 | is | 29 | is |
| 30 | .Em blocking , | 30 | .Em blocking , |
| 31 | .Fn SSL_accept | 31 | .Fn SSL_accept |
| 32 | will only return once the handshake has been finished or an error occurred, | 32 | will only return once the handshake has been finished or an error occurred. |
| 33 | except for SGC (Server Gated Cryptography). | ||
| 34 | For SGC, | ||
| 35 | .Fn SSL_accept | ||
| 36 | may return with \(mi1, but | ||
| 37 | .Fn SSL_get_error | ||
| 38 | will yield | ||
| 39 | .Dv SSL_ERROR_WANT_READ/WRITE | ||
| 40 | and | ||
| 41 | .Fn SSL_accept | ||
| 42 | should be called again. | ||
| 43 | .Pp | 33 | .Pp |
| 44 | If the underlying | 34 | If the underlying |
| 45 | .Vt BIO | 35 | .Vt BIO |
diff --git a/src/lib/libssl/doc/SSL_do_handshake.3 b/src/lib/libssl/doc/SSL_do_handshake.3 index cc29df2583..78a37b08c9 100644 --- a/src/lib/libssl/doc/SSL_do_handshake.3 +++ b/src/lib/libssl/doc/SSL_do_handshake.3 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | .\" | 1 | .\" |
| 2 | .\" $OpenBSD: SSL_do_handshake.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | 2 | .\" $OpenBSD: SSL_do_handshake.3,v 1.3 2015/06/18 22:51:05 doug Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .Dd $Mdocdate: December 2 2014 $ | 4 | .Dd $Mdocdate: June 18 2015 $ |
| 5 | .Dt SSL_DO_HANDSHAKE 3 | 5 | .Dt SSL_DO_HANDSHAKE 3 |
| 6 | .Os | 6 | .Os |
| 7 | .Sh NAME | 7 | .Sh NAME |
| @@ -30,19 +30,7 @@ If the underlying | |||
| 30 | is | 30 | is |
| 31 | .Em blocking , | 31 | .Em blocking , |
| 32 | .Fn SSL_do_handshake | 32 | .Fn SSL_do_handshake |
| 33 | will only return once the handshake has been finished or an error occurred, | 33 | will only return once the handshake has been finished or an error occurred. |
| 34 | except for SGC (Server Gated Cryptography). | ||
| 35 | For SGC, | ||
| 36 | .Fn SSL_do_handshake | ||
| 37 | may return with \(mi1, but | ||
| 38 | .Xr SSL_get_error 3 | ||
| 39 | will yield | ||
| 40 | .Dv SSL_ERROR_WANT_READ | ||
| 41 | or | ||
| 42 | .Dv SSL_ERROR_WANT_WRITE | ||
| 43 | and | ||
| 44 | .Fn SSL_do_handshake | ||
| 45 | should be called again. | ||
| 46 | .Pp | 34 | .Pp |
| 47 | If the underlying | 35 | If the underlying |
| 48 | .Vt BIO | 36 | .Vt BIO |
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c index 633bf5bb7b..d9484d77d8 100644 --- a/src/lib/libssl/s3_both.c +++ b/src/lib/libssl/s3_both.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_both.c,v 1.38 2015/03/27 12:29:54 jsing Exp $ */ | 1 | /* $OpenBSD: s3_both.c,v 1.39 2015/06/18 22:51:05 doug 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 | * |
| @@ -450,20 +450,6 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) | |||
| 450 | SSLerr(SSL_F_SSL3_GET_MESSAGE, SSL_R_UNEXPECTED_MESSAGE); | 450 | SSLerr(SSL_F_SSL3_GET_MESSAGE, SSL_R_UNEXPECTED_MESSAGE); |
| 451 | goto f_err; | 451 | goto f_err; |
| 452 | } | 452 | } |
| 453 | if ((mt < 0) && (*p == SSL3_MT_CLIENT_HELLO) && | ||
| 454 | (st1 == SSL3_ST_SR_CERT_A) && (stn == SSL3_ST_SR_CERT_B)) { | ||
| 455 | /* At this point we have got an MS SGC second client | ||
| 456 | * hello (maybe we should always allow the client to | ||
| 457 | * start a new handshake?). We need to restart the mac. | ||
| 458 | * Don't increment {num,total}_renegotiations because | ||
| 459 | * we have not completed the handshake. */ | ||
| 460 | if (!ssl3_init_finished_mac(s)) { | ||
| 461 | SSLerr(SSL_F_SSL3_GET_MESSAGE, | ||
| 462 | ERR_R_MALLOC_FAILURE); | ||
| 463 | goto err; | ||
| 464 | } | ||
| 465 | } | ||
| 466 | |||
| 467 | s->s3->tmp.message_type= *(p++); | 453 | s->s3->tmp.message_type= *(p++); |
| 468 | 454 | ||
| 469 | n2l3(p, l); | 455 | n2l3(p, l); |
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c index 867e796529..c595fa31cc 100644 --- a/src/lib/libssl/s3_srvr.c +++ b/src/lib/libssl/s3_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_srvr.c,v 1.107 2015/06/17 07:29:33 doug Exp $ */ | 1 | /* $OpenBSD: s3_srvr.c,v 1.108 2015/06/18 22:51:05 doug 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 | * |
| @@ -273,7 +273,6 @@ ssl3_accept(SSL *s) | |||
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | s->init_num = 0; | 275 | s->init_num = 0; |
| 276 | s->s3->flags &= ~SSL3_FLAGS_SGC_RESTART_DONE; | ||
| 277 | 276 | ||
| 278 | if (s->state != SSL_ST_RENEGOTIATE) { | 277 | if (s->state != SSL_ST_RENEGOTIATE) { |
| 279 | /* | 278 | /* |
| @@ -487,21 +486,13 @@ ssl3_accept(SSL *s) | |||
| 487 | 486 | ||
| 488 | case SSL3_ST_SR_CERT_A: | 487 | case SSL3_ST_SR_CERT_A: |
| 489 | case SSL3_ST_SR_CERT_B: | 488 | case SSL3_ST_SR_CERT_B: |
| 490 | /* Check for second client hello (MS SGC) */ | 489 | if (s->s3->tmp.cert_request) { |
| 491 | ret = ssl3_check_client_hello(s); | 490 | ret = ssl3_get_client_certificate(s); |
| 492 | if (ret <= 0) | 491 | if (ret <= 0) |
| 493 | goto end; | 492 | goto end; |
| 494 | if (ret == 2) | ||
| 495 | s->state = SSL3_ST_SR_CLNT_HELLO_C; | ||
| 496 | else { | ||
| 497 | if (s->s3->tmp.cert_request) { | ||
| 498 | ret = ssl3_get_client_certificate(s); | ||
| 499 | if (ret <= 0) | ||
| 500 | goto end; | ||
| 501 | } | ||
| 502 | s->init_num = 0; | ||
| 503 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 504 | } | 493 | } |
| 494 | s->init_num = 0; | ||
| 495 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 505 | break; | 496 | break; |
| 506 | 497 | ||
| 507 | case SSL3_ST_SR_KEY_EXCH_A: | 498 | case SSL3_ST_SR_KEY_EXCH_A: |
| @@ -765,46 +756,6 @@ ssl3_send_hello_request(SSL *s) | |||
| 765 | } | 756 | } |
| 766 | 757 | ||
| 767 | int | 758 | int |
| 768 | ssl3_check_client_hello(SSL *s) | ||
| 769 | { | ||
| 770 | int ok; | ||
| 771 | long n; | ||
| 772 | |||
| 773 | /* | ||
| 774 | * This function is called when we really expect a Certificate message, | ||
| 775 | * so permit appropriate message length | ||
| 776 | */ | ||
| 777 | n = s->method->ssl_get_message(s, SSL3_ST_SR_CERT_A, | ||
| 778 | SSL3_ST_SR_CERT_B, -1, s->max_cert_list, &ok); | ||
| 779 | if (!ok) | ||
| 780 | return ((int)n); | ||
| 781 | s->s3->tmp.reuse_message = 1; | ||
| 782 | if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO) { | ||
| 783 | /* | ||
| 784 | * We only allow the client to restart the handshake once per | ||
| 785 | * negotiation. | ||
| 786 | */ | ||
| 787 | if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE) { | ||
| 788 | SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, | ||
| 789 | SSL_R_MULTIPLE_SGC_RESTARTS); | ||
| 790 | return (-1); | ||
| 791 | } | ||
| 792 | /* | ||
| 793 | * Throw away what we have done so far in the current handshake, | ||
| 794 | * which will now be aborted. (A full SSL_clear would be too | ||
| 795 | * much.) | ||
| 796 | */ | ||
| 797 | DH_free(s->s3->tmp.dh); | ||
| 798 | s->s3->tmp.dh = NULL; | ||
| 799 | EC_KEY_free(s->s3->tmp.ecdh); | ||
| 800 | s->s3->tmp.ecdh = NULL; | ||
| 801 | s->s3->flags |= SSL3_FLAGS_SGC_RESTART_DONE; | ||
| 802 | return (2); | ||
| 803 | } | ||
| 804 | return (1); | ||
| 805 | } | ||
| 806 | |||
| 807 | int | ||
| 808 | ssl3_get_client_hello(SSL *s) | 759 | ssl3_get_client_hello(SSL *s) |
| 809 | { | 760 | { |
| 810 | int i, j, ok, al, ret = -1; | 761 | int i, j, ok, al, ret = -1; |
diff --git a/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 b/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 index 851e4f08ca..876018a839 100644 --- a/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 +++ b/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | .\" | 1 | .\" |
| 2 | .\" $OpenBSD: BIO_f_ssl.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | 2 | .\" $OpenBSD: BIO_f_ssl.3,v 1.3 2015/06/18 22:51:05 doug Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .Dd $Mdocdate: December 2 2014 $ | 4 | .Dd $Mdocdate: June 18 2015 $ |
| 5 | .Dt BIO_F_SSL 3 | 5 | .Dt BIO_F_SSL 3 |
| 6 | .Os | 6 | .Os |
| 7 | .Sh NAME | 7 | .Sh NAME |
| @@ -240,7 +240,7 @@ still request a retry in exceptional circumstances. | |||
| 240 | Specifically this will happen if a session renegotiation takes place during a | 240 | Specifically this will happen if a session renegotiation takes place during a |
| 241 | .Xr BIO_read 3 | 241 | .Xr BIO_read 3 |
| 242 | operation. | 242 | operation. |
| 243 | One case where this happens is when SGC or step up occurs. | 243 | One case where this happens is when step up occurs. |
| 244 | .Pp | 244 | .Pp |
| 245 | In OpenSSL 0.9.6 and later the SSL flag | 245 | In OpenSSL 0.9.6 and later the SSL flag |
| 246 | .Dv SSL_AUTO_RETRY | 246 | .Dv SSL_AUTO_RETRY |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_accept.3 b/src/lib/libssl/src/doc/ssl/SSL_accept.3 index 06465d1955..8c7409d04f 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_accept.3 +++ b/src/lib/libssl/src/doc/ssl/SSL_accept.3 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | .\" | 1 | .\" |
| 2 | .\" $OpenBSD: SSL_accept.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | 2 | .\" $OpenBSD: SSL_accept.3,v 1.3 2015/06/18 22:51:05 doug Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .Dd $Mdocdate: December 2 2014 $ | 4 | .Dd $Mdocdate: June 18 2015 $ |
| 5 | .Dt SSL_ACCEPT 3 | 5 | .Dt SSL_ACCEPT 3 |
| 6 | .Os | 6 | .Os |
| 7 | .Sh NAME | 7 | .Sh NAME |
| @@ -29,17 +29,7 @@ If the underlying | |||
| 29 | is | 29 | is |
| 30 | .Em blocking , | 30 | .Em blocking , |
| 31 | .Fn SSL_accept | 31 | .Fn SSL_accept |
| 32 | will only return once the handshake has been finished or an error occurred, | 32 | will only return once the handshake has been finished or an error occurred. |
| 33 | except for SGC (Server Gated Cryptography). | ||
| 34 | For SGC, | ||
| 35 | .Fn SSL_accept | ||
| 36 | may return with \(mi1, but | ||
| 37 | .Fn SSL_get_error | ||
| 38 | will yield | ||
| 39 | .Dv SSL_ERROR_WANT_READ/WRITE | ||
| 40 | and | ||
| 41 | .Fn SSL_accept | ||
| 42 | should be called again. | ||
| 43 | .Pp | 33 | .Pp |
| 44 | If the underlying | 34 | If the underlying |
| 45 | .Vt BIO | 35 | .Vt BIO |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 index cc29df2583..78a37b08c9 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 +++ b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | .\" | 1 | .\" |
| 2 | .\" $OpenBSD: SSL_do_handshake.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | 2 | .\" $OpenBSD: SSL_do_handshake.3,v 1.3 2015/06/18 22:51:05 doug Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .Dd $Mdocdate: December 2 2014 $ | 4 | .Dd $Mdocdate: June 18 2015 $ |
| 5 | .Dt SSL_DO_HANDSHAKE 3 | 5 | .Dt SSL_DO_HANDSHAKE 3 |
| 6 | .Os | 6 | .Os |
| 7 | .Sh NAME | 7 | .Sh NAME |
| @@ -30,19 +30,7 @@ If the underlying | |||
| 30 | is | 30 | is |
| 31 | .Em blocking , | 31 | .Em blocking , |
| 32 | .Fn SSL_do_handshake | 32 | .Fn SSL_do_handshake |
| 33 | will only return once the handshake has been finished or an error occurred, | 33 | will only return once the handshake has been finished or an error occurred. |
| 34 | except for SGC (Server Gated Cryptography). | ||
| 35 | For SGC, | ||
| 36 | .Fn SSL_do_handshake | ||
| 37 | may return with \(mi1, but | ||
| 38 | .Xr SSL_get_error 3 | ||
| 39 | will yield | ||
| 40 | .Dv SSL_ERROR_WANT_READ | ||
| 41 | or | ||
| 42 | .Dv SSL_ERROR_WANT_WRITE | ||
| 43 | and | ||
| 44 | .Fn SSL_do_handshake | ||
| 45 | should be called again. | ||
| 46 | .Pp | 34 | .Pp |
| 47 | If the underlying | 35 | If the underlying |
| 48 | .Vt BIO | 36 | .Vt BIO |
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c index f3972ae9d0..698292f33f 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.54 2015/06/18 22:30:47 doug Exp $ */ | 1 | /* $OpenBSD: d1_srvr.c,v 1.55 2015/06/18 22:51:05 doug 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. |
| @@ -468,22 +468,13 @@ dtls1_accept(SSL *s) | |||
| 468 | 468 | ||
| 469 | case SSL3_ST_SR_CERT_A: | 469 | case SSL3_ST_SR_CERT_A: |
| 470 | case SSL3_ST_SR_CERT_B: | 470 | case SSL3_ST_SR_CERT_B: |
| 471 | /* Check for second client hello (MS SGC) */ | 471 | if (s->s3->tmp.cert_request) { |
| 472 | ret = ssl3_check_client_hello(s); | 472 | ret = ssl3_get_client_certificate(s); |
| 473 | if (ret <= 0) | 473 | if (ret <= 0) |
| 474 | goto end; | 474 | goto end; |
| 475 | if (ret == 2) { | ||
| 476 | dtls1_stop_timer(s); | ||
| 477 | s->state = SSL3_ST_SR_CLNT_HELLO_C; | ||
| 478 | } else { | ||
| 479 | if (s->s3->tmp.cert_request) { | ||
| 480 | ret = ssl3_get_client_certificate(s); | ||
| 481 | if (ret <= 0) | ||
| 482 | goto end; | ||
| 483 | } | ||
| 484 | s->init_num = 0; | ||
| 485 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 486 | } | 475 | } |
| 476 | s->init_num = 0; | ||
| 477 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 487 | break; | 478 | break; |
| 488 | 479 | ||
| 489 | case SSL3_ST_SR_KEY_EXCH_A: | 480 | case SSL3_ST_SR_KEY_EXCH_A: |
diff --git a/src/lib/libssl/src/ssl/s3_both.c b/src/lib/libssl/src/ssl/s3_both.c index 633bf5bb7b..d9484d77d8 100644 --- a/src/lib/libssl/src/ssl/s3_both.c +++ b/src/lib/libssl/src/ssl/s3_both.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_both.c,v 1.38 2015/03/27 12:29:54 jsing Exp $ */ | 1 | /* $OpenBSD: s3_both.c,v 1.39 2015/06/18 22:51:05 doug 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 | * |
| @@ -450,20 +450,6 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) | |||
| 450 | SSLerr(SSL_F_SSL3_GET_MESSAGE, SSL_R_UNEXPECTED_MESSAGE); | 450 | SSLerr(SSL_F_SSL3_GET_MESSAGE, SSL_R_UNEXPECTED_MESSAGE); |
| 451 | goto f_err; | 451 | goto f_err; |
| 452 | } | 452 | } |
| 453 | if ((mt < 0) && (*p == SSL3_MT_CLIENT_HELLO) && | ||
| 454 | (st1 == SSL3_ST_SR_CERT_A) && (stn == SSL3_ST_SR_CERT_B)) { | ||
| 455 | /* At this point we have got an MS SGC second client | ||
| 456 | * hello (maybe we should always allow the client to | ||
| 457 | * start a new handshake?). We need to restart the mac. | ||
| 458 | * Don't increment {num,total}_renegotiations because | ||
| 459 | * we have not completed the handshake. */ | ||
| 460 | if (!ssl3_init_finished_mac(s)) { | ||
| 461 | SSLerr(SSL_F_SSL3_GET_MESSAGE, | ||
| 462 | ERR_R_MALLOC_FAILURE); | ||
| 463 | goto err; | ||
| 464 | } | ||
| 465 | } | ||
| 466 | |||
| 467 | s->s3->tmp.message_type= *(p++); | 453 | s->s3->tmp.message_type= *(p++); |
| 468 | 454 | ||
| 469 | n2l3(p, l); | 455 | n2l3(p, l); |
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c index 867e796529..c595fa31cc 100644 --- a/src/lib/libssl/src/ssl/s3_srvr.c +++ b/src/lib/libssl/src/ssl/s3_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_srvr.c,v 1.107 2015/06/17 07:29:33 doug Exp $ */ | 1 | /* $OpenBSD: s3_srvr.c,v 1.108 2015/06/18 22:51:05 doug 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 | * |
| @@ -273,7 +273,6 @@ ssl3_accept(SSL *s) | |||
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | s->init_num = 0; | 275 | s->init_num = 0; |
| 276 | s->s3->flags &= ~SSL3_FLAGS_SGC_RESTART_DONE; | ||
| 277 | 276 | ||
| 278 | if (s->state != SSL_ST_RENEGOTIATE) { | 277 | if (s->state != SSL_ST_RENEGOTIATE) { |
| 279 | /* | 278 | /* |
| @@ -487,21 +486,13 @@ ssl3_accept(SSL *s) | |||
| 487 | 486 | ||
| 488 | case SSL3_ST_SR_CERT_A: | 487 | case SSL3_ST_SR_CERT_A: |
| 489 | case SSL3_ST_SR_CERT_B: | 488 | case SSL3_ST_SR_CERT_B: |
| 490 | /* Check for second client hello (MS SGC) */ | 489 | if (s->s3->tmp.cert_request) { |
| 491 | ret = ssl3_check_client_hello(s); | 490 | ret = ssl3_get_client_certificate(s); |
| 492 | if (ret <= 0) | 491 | if (ret <= 0) |
| 493 | goto end; | 492 | goto end; |
| 494 | if (ret == 2) | ||
| 495 | s->state = SSL3_ST_SR_CLNT_HELLO_C; | ||
| 496 | else { | ||
| 497 | if (s->s3->tmp.cert_request) { | ||
| 498 | ret = ssl3_get_client_certificate(s); | ||
| 499 | if (ret <= 0) | ||
| 500 | goto end; | ||
| 501 | } | ||
| 502 | s->init_num = 0; | ||
| 503 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 504 | } | 493 | } |
| 494 | s->init_num = 0; | ||
| 495 | s->state = SSL3_ST_SR_KEY_EXCH_A; | ||
| 505 | break; | 496 | break; |
| 506 | 497 | ||
| 507 | case SSL3_ST_SR_KEY_EXCH_A: | 498 | case SSL3_ST_SR_KEY_EXCH_A: |
| @@ -765,46 +756,6 @@ ssl3_send_hello_request(SSL *s) | |||
| 765 | } | 756 | } |
| 766 | 757 | ||
| 767 | int | 758 | int |
| 768 | ssl3_check_client_hello(SSL *s) | ||
| 769 | { | ||
| 770 | int ok; | ||
| 771 | long n; | ||
| 772 | |||
| 773 | /* | ||
| 774 | * This function is called when we really expect a Certificate message, | ||
| 775 | * so permit appropriate message length | ||
| 776 | */ | ||
| 777 | n = s->method->ssl_get_message(s, SSL3_ST_SR_CERT_A, | ||
| 778 | SSL3_ST_SR_CERT_B, -1, s->max_cert_list, &ok); | ||
| 779 | if (!ok) | ||
| 780 | return ((int)n); | ||
| 781 | s->s3->tmp.reuse_message = 1; | ||
| 782 | if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO) { | ||
| 783 | /* | ||
| 784 | * We only allow the client to restart the handshake once per | ||
| 785 | * negotiation. | ||
| 786 | */ | ||
| 787 | if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE) { | ||
| 788 | SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, | ||
| 789 | SSL_R_MULTIPLE_SGC_RESTARTS); | ||
| 790 | return (-1); | ||
| 791 | } | ||
| 792 | /* | ||
| 793 | * Throw away what we have done so far in the current handshake, | ||
| 794 | * which will now be aborted. (A full SSL_clear would be too | ||
| 795 | * much.) | ||
| 796 | */ | ||
| 797 | DH_free(s->s3->tmp.dh); | ||
| 798 | s->s3->tmp.dh = NULL; | ||
| 799 | EC_KEY_free(s->s3->tmp.ecdh); | ||
| 800 | s->s3->tmp.ecdh = NULL; | ||
| 801 | s->s3->flags |= SSL3_FLAGS_SGC_RESTART_DONE; | ||
| 802 | return (2); | ||
| 803 | } | ||
| 804 | return (1); | ||
| 805 | } | ||
| 806 | |||
| 807 | int | ||
| 808 | ssl3_get_client_hello(SSL *s) | 759 | ssl3_get_client_hello(SSL *s) |
| 809 | { | 760 | { |
| 810 | int i, j, ok, al, ret = -1; | 761 | int i, j, ok, al, ret = -1; |
diff --git a/src/lib/libssl/src/ssl/ssl3.h b/src/lib/libssl/src/ssl/ssl3.h index 61f600c55d..265d18810e 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.36 2015/02/22 15:54:27 jsing Exp $ */ | 1 | /* $OpenBSD: ssl3.h,v 1.37 2015/06/18 22:51:05 doug 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 | * |
| @@ -356,17 +356,6 @@ typedef struct ssl3_buffer_st { | |||
| 356 | #define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 | 356 | #define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 |
| 357 | #define SSL3_FLAGS_CCS_OK 0x0080 | 357 | #define SSL3_FLAGS_CCS_OK 0x0080 |
| 358 | 358 | ||
| 359 | /* SSL3_FLAGS_SGC_RESTART_DONE is set when we | ||
| 360 | * restart a handshake because of MS SGC and so prevents us | ||
| 361 | * from restarting the handshake in a loop. It's reset on a | ||
| 362 | * renegotiation, so effectively limits the client to one restart | ||
| 363 | * per negotiation. This limits the possibility of a DDoS | ||
| 364 | * attack where the client handshakes in a loop using SGC to | ||
| 365 | * restart. Servers which permit renegotiation can still be | ||
| 366 | * effected, but we can't prevent that. | ||
| 367 | */ | ||
| 368 | #define SSL3_FLAGS_SGC_RESTART_DONE 0x0040 | ||
| 369 | |||
| 370 | #ifndef OPENSSL_NO_SSL_INTERN | 359 | #ifndef OPENSSL_NO_SSL_INTERN |
| 371 | 360 | ||
| 372 | typedef struct ssl3_state_st { | 361 | typedef struct ssl3_state_st { |
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h index 7b3ecdf665..794769b79c 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.90 2015/04/15 16:25:43 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.91 2015/06/18 22:51:05 doug 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 | * |
| @@ -741,7 +741,6 @@ int ssl3_send_hello_request(SSL *s); | |||
| 741 | int ssl3_send_server_key_exchange(SSL *s); | 741 | int ssl3_send_server_key_exchange(SSL *s); |
| 742 | int ssl3_send_certificate_request(SSL *s); | 742 | int ssl3_send_certificate_request(SSL *s); |
| 743 | int ssl3_send_server_done(SSL *s); | 743 | int ssl3_send_server_done(SSL *s); |
| 744 | int ssl3_check_client_hello(SSL *s); | ||
| 745 | int ssl3_get_client_certificate(SSL *s); | 744 | int ssl3_get_client_certificate(SSL *s); |
| 746 | int ssl3_get_client_key_exchange(SSL *s); | 745 | int ssl3_get_client_key_exchange(SSL *s); |
| 747 | int ssl3_get_cert_verify(SSL *s); | 746 | int ssl3_get_cert_verify(SSL *s); |
diff --git a/src/lib/libssl/ssl3.h b/src/lib/libssl/ssl3.h index 61f600c55d..265d18810e 100644 --- a/src/lib/libssl/ssl3.h +++ b/src/lib/libssl/ssl3.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl3.h,v 1.36 2015/02/22 15:54:27 jsing Exp $ */ | 1 | /* $OpenBSD: ssl3.h,v 1.37 2015/06/18 22:51:05 doug 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 | * |
| @@ -356,17 +356,6 @@ typedef struct ssl3_buffer_st { | |||
| 356 | #define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 | 356 | #define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 |
| 357 | #define SSL3_FLAGS_CCS_OK 0x0080 | 357 | #define SSL3_FLAGS_CCS_OK 0x0080 |
| 358 | 358 | ||
| 359 | /* SSL3_FLAGS_SGC_RESTART_DONE is set when we | ||
| 360 | * restart a handshake because of MS SGC and so prevents us | ||
| 361 | * from restarting the handshake in a loop. It's reset on a | ||
| 362 | * renegotiation, so effectively limits the client to one restart | ||
| 363 | * per negotiation. This limits the possibility of a DDoS | ||
| 364 | * attack where the client handshakes in a loop using SGC to | ||
| 365 | * restart. Servers which permit renegotiation can still be | ||
| 366 | * effected, but we can't prevent that. | ||
| 367 | */ | ||
| 368 | #define SSL3_FLAGS_SGC_RESTART_DONE 0x0040 | ||
| 369 | |||
| 370 | #ifndef OPENSSL_NO_SSL_INTERN | 359 | #ifndef OPENSSL_NO_SSL_INTERN |
| 371 | 360 | ||
| 372 | typedef struct ssl3_state_st { | 361 | typedef struct ssl3_state_st { |
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index 7b3ecdf665..794769b79c 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.90 2015/04/15 16:25:43 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.91 2015/06/18 22:51:05 doug 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 | * |
| @@ -741,7 +741,6 @@ int ssl3_send_hello_request(SSL *s); | |||
| 741 | int ssl3_send_server_key_exchange(SSL *s); | 741 | int ssl3_send_server_key_exchange(SSL *s); |
| 742 | int ssl3_send_certificate_request(SSL *s); | 742 | int ssl3_send_certificate_request(SSL *s); |
| 743 | int ssl3_send_server_done(SSL *s); | 743 | int ssl3_send_server_done(SSL *s); |
| 744 | int ssl3_check_client_hello(SSL *s); | ||
| 745 | int ssl3_get_client_certificate(SSL *s); | 744 | int ssl3_get_client_certificate(SSL *s); |
| 746 | int ssl3_get_client_key_exchange(SSL *s); | 745 | int ssl3_get_client_key_exchange(SSL *s); |
| 747 | int ssl3_get_cert_verify(SSL *s); | 746 | int ssl3_get_cert_verify(SSL *s); |
