diff options
author | doug <> | 2015-06-17 07:36:30 +0000 |
---|---|---|
committer | doug <> | 2015-06-17 07:36:30 +0000 |
commit | d4871df416e2cd7b2756dfcfa82b55261b722b0b (patch) | |
tree | 4214665d37a4ae8bdc30544ee0fa9966e2a04211 /src/lib | |
parent | d1fa227f91aca9fc0c95f15986b026ff18a63e92 (diff) | |
download | openbsd-d4871df416e2cd7b2756dfcfa82b55261b722b0b.tar.gz openbsd-d4871df416e2cd7b2756dfcfa82b55261b722b0b.tar.bz2 openbsd-d4871df416e2cd7b2756dfcfa82b55261b722b0b.zip |
Convert tls1_check_curve to CBS.
ok miod@ jsing@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/src/ssl/t1_lib.c | 14 | ||||
-rw-r--r-- | src/lib/libssl/t1_lib.c | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/lib/libssl/src/ssl/t1_lib.c b/src/lib/libssl/src/ssl/t1_lib.c index 9b7f54682b..145ebf2791 100644 --- a/src/lib/libssl/src/ssl/t1_lib.c +++ b/src/lib/libssl/src/ssl/t1_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t1_lib.c,v 1.75 2015/03/02 13:43:09 jsing Exp $ */ | 1 | /* $OpenBSD: t1_lib.c,v 1.76 2015/06/17 07:36:30 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 | * |
@@ -117,6 +117,7 @@ | |||
117 | #include <openssl/ocsp.h> | 117 | #include <openssl/ocsp.h> |
118 | 118 | ||
119 | #include "ssl_locl.h" | 119 | #include "ssl_locl.h" |
120 | #include "bytestring.h" | ||
120 | 121 | ||
121 | static int tls_decrypt_ticket(SSL *s, const unsigned char *tick, int ticklen, | 122 | static int tls_decrypt_ticket(SSL *s, const unsigned char *tick, int ticklen, |
122 | const unsigned char *sess_id, int sesslen, | 123 | const unsigned char *sess_id, int sesslen, |
@@ -403,16 +404,21 @@ tls1_get_curvelist(SSL *s, int client_curves, const uint16_t **pcurves, | |||
403 | int | 404 | int |
404 | tls1_check_curve(SSL *s, const unsigned char *p, size_t len) | 405 | tls1_check_curve(SSL *s, const unsigned char *p, size_t len) |
405 | { | 406 | { |
407 | CBS cbs; | ||
406 | const uint16_t *curves; | 408 | const uint16_t *curves; |
407 | size_t curveslen, i; | 409 | size_t curveslen, i; |
410 | uint8_t type; | ||
408 | uint16_t cid; | 411 | uint16_t cid; |
409 | 412 | ||
413 | CBS_init(&cbs, p, len); | ||
414 | |||
410 | /* Only named curves are supported. */ | 415 | /* Only named curves are supported. */ |
411 | if (len != 3 || p[0] != NAMED_CURVE_TYPE) | 416 | if (CBS_len(&cbs) != 3 || |
417 | !CBS_get_u8(&cbs, &type) || | ||
418 | type != NAMED_CURVE_TYPE || | ||
419 | !CBS_get_u16(&cbs, &cid)) | ||
412 | return (0); | 420 | return (0); |
413 | 421 | ||
414 | cid = (p[1] << 8) | p[2]; | ||
415 | |||
416 | tls1_get_curvelist(s, 0, &curves, &curveslen); | 422 | tls1_get_curvelist(s, 0, &curves, &curveslen); |
417 | 423 | ||
418 | for (i = 0; i < curveslen; i++) { | 424 | for (i = 0; i < curveslen; i++) { |
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c index 9b7f54682b..145ebf2791 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.75 2015/03/02 13:43:09 jsing Exp $ */ | 1 | /* $OpenBSD: t1_lib.c,v 1.76 2015/06/17 07:36:30 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 | * |
@@ -117,6 +117,7 @@ | |||
117 | #include <openssl/ocsp.h> | 117 | #include <openssl/ocsp.h> |
118 | 118 | ||
119 | #include "ssl_locl.h" | 119 | #include "ssl_locl.h" |
120 | #include "bytestring.h" | ||
120 | 121 | ||
121 | static int tls_decrypt_ticket(SSL *s, const unsigned char *tick, int ticklen, | 122 | static int tls_decrypt_ticket(SSL *s, const unsigned char *tick, int ticklen, |
122 | const unsigned char *sess_id, int sesslen, | 123 | const unsigned char *sess_id, int sesslen, |
@@ -403,16 +404,21 @@ tls1_get_curvelist(SSL *s, int client_curves, const uint16_t **pcurves, | |||
403 | int | 404 | int |
404 | tls1_check_curve(SSL *s, const unsigned char *p, size_t len) | 405 | tls1_check_curve(SSL *s, const unsigned char *p, size_t len) |
405 | { | 406 | { |
407 | CBS cbs; | ||
406 | const uint16_t *curves; | 408 | const uint16_t *curves; |
407 | size_t curveslen, i; | 409 | size_t curveslen, i; |
410 | uint8_t type; | ||
408 | uint16_t cid; | 411 | uint16_t cid; |
409 | 412 | ||
413 | CBS_init(&cbs, p, len); | ||
414 | |||
410 | /* Only named curves are supported. */ | 415 | /* Only named curves are supported. */ |
411 | if (len != 3 || p[0] != NAMED_CURVE_TYPE) | 416 | if (CBS_len(&cbs) != 3 || |
417 | !CBS_get_u8(&cbs, &type) || | ||
418 | type != NAMED_CURVE_TYPE || | ||
419 | !CBS_get_u16(&cbs, &cid)) | ||
412 | return (0); | 420 | return (0); |
413 | 421 | ||
414 | cid = (p[1] << 8) | p[2]; | ||
415 | |||
416 | tls1_get_curvelist(s, 0, &curves, &curveslen); | 422 | tls1_get_curvelist(s, 0, &curves, &curveslen); |
417 | 423 | ||
418 | for (i = 0; i < curveslen; i++) { | 424 | for (i = 0; i < curveslen; i++) { |