* Extension index values NOTE: Any updates to these defines should be mirrored
* with equivalent updates to ext_defs in extensions.c
*/
-#define TLSEXT_IDX_renegotiate 0
-#define TLSEXT_IDX_server_name 1
-#define TLSEXT_IDX_srp 2
-#define TLSEXT_IDX_ec_point_formats 3
-#define TLSEXT_IDX_supported_groups 4
-#define TLSEXT_IDX_session_ticket 5
-#define TLSEXT_IDX_signature_algorithms 6
-#define TLSEXT_IDX_status_request 7
-#define TLSEXT_IDX_next_proto_neg 8
-#define TLSEXT_IDX_application_layer_protocol_negotiation 9
-#define TLSEXT_IDX_use_srtp 10
-#define TLSEXT_IDX_encrypt_then_mac 11
-#define TLSEXT_IDX_signed_certificate_timestamp 12
-#define TLSEXT_IDX_extended_master_secret 13
-#define TLSEXT_IDX_supported_versions 14
-#define TLSEXT_IDX_key_share 15
-#define TLSEXT_IDX_cryptopro_bug 16
-#define TLSEXT_IDX_padding 17
+typedef enum tlsext_index_en {
+ TLSEXT_IDX_renegotiate,
+ TLSEXT_IDX_server_name,
+ TLSEXT_IDX_srp,
+ TLSEXT_IDX_ec_point_formats,
+ TLSEXT_IDX_supported_groups,
+ TLSEXT_IDX_session_ticket,
+ TLSEXT_IDX_signature_algorithms,
+ TLSEXT_IDX_status_request,
+ TLSEXT_IDX_next_proto_neg,
+ TLSEXT_IDX_application_layer_protocol_negotiation,
+ TLSEXT_IDX_use_srtp,
+ TLSEXT_IDX_encrypt_then_mac,
+ TLSEXT_IDX_signed_certificate_timestamp,
+ TLSEXT_IDX_extended_master_secret,
+ TLSEXT_IDX_supported_versions,
+ TLSEXT_IDX_key_share,
+ TLSEXT_IDX_cryptopro_bug,
+ TLSEXT_IDX_padding
+} TLSEXT_INDEX;
#define MAX_COMPRESSIONS_SIZE 255
{
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) {
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
* 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];
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) {
/* 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;
}
{
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
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