diff options
author | Matt Caswell <matt@openssl.org> | 2016-12-07 17:21:48 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-12-08 17:21:03 +0000 |
commit | d270de322c7bfb9c1e7509fbc24e3bf6fde713e6 (patch) | |
tree | 131c5bbc5e423f880e5a837686819d9c3a491731 /ssl/statem | |
parent | 1266eefdb66db6c01e859ae672ccc19261e75bbf (diff) |
Change TLSEXT_IDX_* values into an enum
Perl changes reviewed by Richard Levitte. Non-perl changes reviewed by Rich
Salz
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'ssl/statem')
-rw-r--r-- | ssl/statem/extensions.c | 17 | ||||
-rw-r--r-- | ssl/statem/extensions_srvr.c | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c index 51f8965606..5c0dda411d 100644 --- a/ssl/statem/extensions.c +++ b/ssl/statem/extensions.c @@ -260,7 +260,7 @@ static int verify_extension(SSL *s, unsigned int context, unsigned int type, { size_t i; size_t builtin_num = OSSL_NELEM(ext_defs); - EXTENSION_DEFINITION *thisext; + const EXTENSION_DEFINITION *thisext; for (i = 0, thisext = ext_defs; i < builtin_num; i++, thisext++) { if (type == thisext->type) { @@ -344,11 +344,10 @@ int tls_collect_extensions(SSL *s, PACKET *packet, unsigned int context, RAW_EXTENSION **res, int *al) { PACKET extensions = *packet; - size_t i = 0, idx; - int found = 0; + size_t i = 0; custom_ext_methods *exts = NULL; RAW_EXTENSION *raw_extensions = NULL; - EXTENSION_DEFINITION *thisexd; + const EXTENSION_DEFINITION *thisexd; /* * Initialise server side custom extensions. Client side is done during @@ -427,7 +426,7 @@ int tls_collect_extensions(SSL *s, PACKET *packet, unsigned int context, * or 0 on failure. In the event of a failure |*al| is populated with a suitable * alert code. If an extension is not present this counted as success. */ -int tls_parse_extension(SSL *s, unsigned int idx, int context, +int tls_parse_extension(SSL *s, TLSEXT_INDEX idx, int context, RAW_EXTENSION *exts, int *al) { RAW_EXTENSION *currext = &exts[idx]; @@ -497,7 +496,7 @@ int tls_parse_extension(SSL *s, unsigned int idx, int context, int tls_parse_all_extensions(SSL *s, int context, RAW_EXTENSION *exts, int *al) { size_t i, numexts = OSSL_NELEM(ext_defs); - EXTENSION_DEFINITION *thisexd; + const EXTENSION_DEFINITION *thisexd; /* Calculate the number of extensions in the extensions list */ if ((context & EXT_CLIENT_HELLO) != 0) { @@ -508,7 +507,7 @@ int tls_parse_all_extensions(SSL *s, int context, RAW_EXTENSION *exts, int *al) /* Parse each extension in turn */ for (i = 0; i < numexts; i++) { - if (!tls_parse_extension(s, loop, context, exts, al)) + if (!tls_parse_extension(s, i, context, exts, al)) return 0; } @@ -537,7 +536,7 @@ int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context, { size_t i; int addcustom = 0, min_version, max_version = 0, reason, tmpal; - EXTENSION_DEFINITION *thisexd; + const EXTENSION_DEFINITION *thisexd; /* * Normally if something goes wrong during construction it's an internal @@ -591,7 +590,7 @@ int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context, int (*construct)(SSL *s, WPACKET *pkt, int *al); /* Skip if not relevant for our context */ - if ((ext_defs[loop].context & context) == 0) + if ((thisexd->context & context) == 0) continue; construct = s->server ? thisexd->construct_stoc diff --git a/ssl/statem/extensions_srvr.c b/ssl/statem/extensions_srvr.c index 9763c47ed3..1eeae096d6 100644 --- a/ssl/statem/extensions_srvr.c +++ b/ssl/statem/extensions_srvr.c @@ -413,7 +413,7 @@ int tls_parse_ctos_use_srtp(SSL *s, PACKET *pkt, int *al) * does nothing. */ for (i = 0; i < srtp_pref; i++) { - const SRTP_PROTECTION_PROFILE *sprof = + SRTP_PROTECTION_PROFILE *sprof = sk_SRTP_PROTECTION_PROFILE_value(srvr, i); if (sprof->id == id) { |