diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/t1_lib.c | 76 |
1 files changed, 3 insertions, 73 deletions
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c index 2e90d3e9df..4983ad27fa 100644 --- a/src/lib/libssl/t1_lib.c +++ b/src/lib/libssl/t1_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t1_lib.c,v 1.125 2017/08/11 05:06:34 doug Exp $ */ | 1 | /* $OpenBSD: t1_lib.c,v 1.126 2017/08/11 20:14:13 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 | * |
| @@ -365,7 +365,7 @@ tls1_get_formatlist(SSL *s, int client_formats, const uint8_t **pformats, | |||
| 365 | * the client/session curves. Otherwise return the custom curve list if one | 365 | * the client/session curves. Otherwise return the custom curve list if one |
| 366 | * exists, or the default curves if a custom list has not been specified. | 366 | * exists, or the default curves if a custom list has not been specified. |
| 367 | */ | 367 | */ |
| 368 | static void | 368 | void |
| 369 | tls1_get_curvelist(SSL *s, int client_curves, const uint16_t **pcurves, | 369 | tls1_get_curvelist(SSL *s, int client_curves, const uint16_t **pcurves, |
| 370 | size_t *pcurveslen) | 370 | size_t *pcurveslen) |
| 371 | { | 371 | { |
| @@ -674,12 +674,9 @@ ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit) | |||
| 674 | { | 674 | { |
| 675 | int extdatalen = 0; | 675 | int extdatalen = 0; |
| 676 | unsigned char *ret = p; | 676 | unsigned char *ret = p; |
| 677 | int using_ecc; | ||
| 678 | size_t len; | 677 | size_t len; |
| 679 | CBB cbb; | 678 | CBB cbb; |
| 680 | 679 | ||
| 681 | using_ecc = ssl_has_ecc_ciphers(s); | ||
| 682 | |||
| 683 | ret += 2; | 680 | ret += 2; |
| 684 | if (ret >= limit) | 681 | if (ret >= limit) |
| 685 | return NULL; /* this really never occurs, but ... */ | 682 | return NULL; /* this really never occurs, but ... */ |
| @@ -698,40 +695,6 @@ ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit) | |||
| 698 | return NULL; | 695 | return NULL; |
| 699 | ret += len; | 696 | ret += len; |
| 700 | 697 | ||
| 701 | if (using_ecc) { | ||
| 702 | size_t curveslen, lenmax; | ||
| 703 | const uint16_t *curves; | ||
| 704 | int i; | ||
| 705 | |||
| 706 | /* | ||
| 707 | * Add TLS extension EllipticCurves to the ClientHello message. | ||
| 708 | */ | ||
| 709 | tls1_get_curvelist(s, 0, &curves, &curveslen); | ||
| 710 | |||
| 711 | if ((size_t)(limit - ret) < 6) | ||
| 712 | return NULL; | ||
| 713 | |||
| 714 | lenmax = limit - ret - 6; | ||
| 715 | if (curveslen * 2 > lenmax) | ||
| 716 | return NULL; | ||
| 717 | if (curveslen * 2 > 65532) { | ||
| 718 | SSLerror(s, ERR_R_INTERNAL_ERROR); | ||
| 719 | return NULL; | ||
| 720 | } | ||
| 721 | |||
| 722 | s2n(TLSEXT_TYPE_elliptic_curves, ret); | ||
| 723 | s2n((curveslen * 2) + 2, ret); | ||
| 724 | |||
| 725 | /* NB: draft-ietf-tls-ecc-12.txt uses a one-byte prefix for | ||
| 726 | * elliptic_curve_list, but the examples use two bytes. | ||
| 727 | * https://www1.ietf.org/mail-archive/web/tls/current/msg00538.html | ||
| 728 | * resolves this to two bytes. | ||
| 729 | */ | ||
| 730 | s2n(curveslen * 2, ret); | ||
| 731 | for (i = 0; i < curveslen; i++) | ||
| 732 | s2n(curves[i], ret); | ||
| 733 | } | ||
| 734 | |||
| 735 | if (!(SSL_get_options(s) & SSL_OP_NO_TICKET)) { | 698 | if (!(SSL_get_options(s) & SSL_OP_NO_TICKET)) { |
| 736 | int ticklen; | 699 | int ticklen; |
| 737 | if (!s->internal->new_session && s->session && s->session->tlsext_tick) | 700 | if (!s->internal->new_session && s->session && s->session->tlsext_tick) |
| @@ -1142,40 +1105,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
| 1142 | if (!tlsext_clienthello_parse_one(s, &cbs, type, al)) | 1105 | if (!tlsext_clienthello_parse_one(s, &cbs, type, al)) |
| 1143 | return 0; | 1106 | return 0; |
| 1144 | 1107 | ||
| 1145 | if (type == TLSEXT_TYPE_elliptic_curves && | 1108 | if (type == TLSEXT_TYPE_session_ticket) { |
| 1146 | s->version != DTLS1_VERSION) { | ||
| 1147 | unsigned char *sdata = data; | ||
| 1148 | size_t curveslen, i; | ||
| 1149 | uint16_t *curves; | ||
| 1150 | |||
| 1151 | if (size < 2) { | ||
| 1152 | *al = TLS1_AD_DECODE_ERROR; | ||
| 1153 | return 0; | ||
| 1154 | } | ||
| 1155 | n2s(sdata, curveslen); | ||
| 1156 | if (curveslen != size - 2 || curveslen % 2 != 0) { | ||
| 1157 | *al = TLS1_AD_DECODE_ERROR; | ||
| 1158 | return 0; | ||
| 1159 | } | ||
| 1160 | curveslen /= 2; | ||
| 1161 | |||
| 1162 | if (!s->internal->hit) { | ||
| 1163 | if (SSI(s)->tlsext_supportedgroups) { | ||
| 1164 | *al = TLS1_AD_DECODE_ERROR; | ||
| 1165 | return 0; | ||
| 1166 | } | ||
| 1167 | SSI(s)->tlsext_supportedgroups_length = 0; | ||
| 1168 | if ((curves = reallocarray(NULL, curveslen, | ||
| 1169 | sizeof(uint16_t))) == NULL) { | ||
| 1170 | *al = TLS1_AD_INTERNAL_ERROR; | ||
| 1171 | return 0; | ||
| 1172 | } | ||
| 1173 | for (i = 0; i < curveslen; i++) | ||
| 1174 | n2s(sdata, curves[i]); | ||
| 1175 | SSI(s)->tlsext_supportedgroups = curves; | ||
| 1176 | SSI(s)->tlsext_supportedgroups_length = curveslen; | ||
| 1177 | } | ||
| 1178 | } else if (type == TLSEXT_TYPE_session_ticket) { | ||
| 1179 | if (s->internal->tls_session_ticket_ext_cb && | 1109 | if (s->internal->tls_session_ticket_ext_cb && |
| 1180 | !s->internal->tls_session_ticket_ext_cb(s, data, size, s->internal->tls_session_ticket_ext_cb_arg)) { | 1110 | !s->internal->tls_session_ticket_ext_cb(s, data, size, s->internal->tls_session_ticket_ext_cb_arg)) { |
| 1181 | *al = TLS1_AD_INTERNAL_ERROR; | 1111 | *al = TLS1_AD_INTERNAL_ERROR; |
