Convert stack.h to use inline functions.
Instead of a script which generates macros, emit static inlines in
individual header (or C files). This solves a few issues with the
original setup:
- The documentation was off. We match the documentation now.
- The stack macros did not check constness; see some of the fixes in
crypto/x509.
- Type errors did not look like usual type errors.
- Any type which participated in STACK_OF had to be made partially
public. This allows stack types to be defined an internal header or
even an individual file.
- One could not pass sk_FOO_free into something which expects a function
pointer.
Thanks to upstream's 411abf2dd37974a5baa54859c1abcd287b3c1181 for the
idea.
Change-Id: Ie5431390ccad761c17596b0e93941b0d7a68f904
Reviewed-on: https://boringssl-review.googlesource.com/16087
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 93809dd..581da2a 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -1170,7 +1170,7 @@
*
* |SSL_CIPHER| objects represent cipher suites. */
-DECLARE_STACK_OF(SSL_CIPHER)
+DEFINE_CONST_STACK_OF(SSL_CIPHER)
/* SSL_get_cipher_by_value returns the structure representing a TLS cipher
* suite based on its assigned number, or NULL if unknown. See
@@ -2713,7 +2713,7 @@
unsigned long id;
} /* SRTP_PROTECTION_PROFILE */;
-DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE)
+DEFINE_CONST_STACK_OF(SRTP_PROTECTION_PROFILE)
/* SRTP_* define constants for SRTP profiles. */
#define SRTP_AES128_CM_SHA1_80 0x0001
@@ -3601,7 +3601,7 @@
char *method;
};
-DECLARE_STACK_OF(SSL_COMP)
+DEFINE_STACK_OF(SSL_COMP)
/* The following flags do nothing and are included only to make it easier to
* compile code with BoringSSL. */
@@ -4025,6 +4025,8 @@
uint8_t *in_group_flags;
};
+DECLARE_STACK_OF(SSL_CUSTOM_EXTENSION)
+
/* ssl_ctx_st (aka |SSL_CTX|) contains configuration common to several SSL
* connections. */
struct ssl_ctx_st {