diff options
author | 2015-06-17 07:36:30 +0000 | |
---|---|---|
committer | 2015-06-17 07:36:30 +0000 | |
commit | b30173a76d86ce759d69b63e89ed3dbdc935f1d7 (patch) | |
tree | 3c8a4fe0600c0caed88ba380d8a0860b227ed845 /lib/libssl/t1_lib.c | |
parent | KNF whitespace. (diff) | |
download | wireguard-openbsd-b30173a76d86ce759d69b63e89ed3dbdc935f1d7.tar.xz wireguard-openbsd-b30173a76d86ce759d69b63e89ed3dbdc935f1d7.zip |
Convert tls1_check_curve to CBS.
ok miod@ jsing@
Diffstat (limited to 'lib/libssl/t1_lib.c')
-rw-r--r-- | lib/libssl/t1_lib.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libssl/t1_lib.c b/lib/libssl/t1_lib.c index 9b7f54682bc..145ebf27919 100644 --- a/lib/libssl/t1_lib.c +++ b/lib/libssl/t1_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_lib.c,v 1.75 2015/03/02 13:43:09 jsing Exp $ */ +/* $OpenBSD: t1_lib.c,v 1.76 2015/06/17 07:36:30 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -117,6 +117,7 @@ #include <openssl/ocsp.h> #include "ssl_locl.h" +#include "bytestring.h" static int tls_decrypt_ticket(SSL *s, const unsigned char *tick, int ticklen, const unsigned char *sess_id, int sesslen, @@ -403,16 +404,21 @@ tls1_get_curvelist(SSL *s, int client_curves, const uint16_t **pcurves, int tls1_check_curve(SSL *s, const unsigned char *p, size_t len) { + CBS cbs; const uint16_t *curves; size_t curveslen, i; + uint8_t type; uint16_t cid; + CBS_init(&cbs, p, len); + /* Only named curves are supported. */ - if (len != 3 || p[0] != NAMED_CURVE_TYPE) + if (CBS_len(&cbs) != 3 || + !CBS_get_u8(&cbs, &type) || + type != NAMED_CURVE_TYPE || + !CBS_get_u16(&cbs, &cid)) return (0); - cid = (p[1] << 8) | p[2]; - tls1_get_curvelist(s, 0, &curves, &curveslen); for (i = 0; i < curveslen; i++) { |