summaryrefslogtreecommitdiffstats
path: root/ssl/ssl.h
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-08-14 13:25:50 +0100
committerDr. Stephen Henson <steve@openssl.org>2014-08-28 18:10:21 +0100
commit423ceb831903339b589ea7b94c877ed190a7cb64 (patch)
tree4226211a169afa5456294e2996c80c8d0567ac70 /ssl/ssl.h
parentcd2e17020e6ce6ba1d29d643bfaf1758302c8ca7 (diff)
Callback revision.
Use "parse" and "add" for function and callback names instead of "first" and "second". Change arguments to callback so the extension type is unsigned int and the buffer length is size_t. Note: this *will* break existing code. Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit de2a9e38f39eacc2e052d694f5b5fa5b7e734abc)
Diffstat (limited to 'ssl/ssl.h')
-rw-r--r--ssl/ssl.h41
1 files changed, 18 insertions, 23 deletions
diff --git a/ssl/ssl.h b/ssl/ssl.h
index 65dfe97933..4ce46cb95c 100644
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -386,10 +386,10 @@ typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, S
#ifndef OPENSSL_NO_TLSEXT
/* Callbacks and structures for handling custom TLS Extensions:
- * cli_ext_first_cb - sends data for ClientHello TLS Extension
- * cli_ext_second_cb - receives data from ServerHello TLS Extension
- * srv_ext_first_cb - receives data from ClientHello TLS Extension
- * srv_ext_second_cb - sends data for ServerHello TLS Extension
+ * cli_ext_add_cb - sends data for ClientHello TLS Extension
+ * cli_ext_parse_cb - receives data from ServerHello TLS Extension
+ * srv_ext_parse_cb - receives data from ClientHello TLS Extension
+ * srv_ext_add_cb - sends data for ServerHello TLS Extension
*
* All these functions return nonzero on success. Zero will terminate
* the handshake (and return a specific TLS Fatal alert, if the function
@@ -406,21 +406,16 @@ typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, S
* fatal TLS alert, if the callback returns zero.
*/
-typedef int (*custom_ext_add_cb)(SSL *s, unsigned short ext_type,
+typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type,
const unsigned char **out,
- unsigned short *outlen, int *al,
+ size_t *outlen, int *al,
void *arg);
-typedef int (*custom_ext_parse_cb)(SSL *s, unsigned short ext_type,
+typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type,
const unsigned char *in,
- unsigned short inlen, int *al,
+ size_t inlen, int *al,
void *arg);
-typedef custom_ext_add_cb custom_cli_ext_first_cb_fn;
-typedef custom_ext_parse_cb custom_cli_ext_second_cb_fn;
-typedef custom_ext_add_cb custom_srv_ext_second_cb_fn;
-typedef custom_ext_parse_cb custom_srv_ext_first_cb_fn;
-
#endif
#ifndef OPENSSL_NO_SSL_INTERN
@@ -1269,22 +1264,22 @@ const char *SSL_get_psk_identity(const SSL *s);
* handled by OpenSSL will fail.
*
* NULL can be registered for any callback function. For the client
- * functions, a NULL custom_cli_ext_first_cb_fn sends an empty ClientHello
- * Extension, and a NULL custom_cli_ext_second_cb_fn ignores the ServerHello
+ * functions, a NULL custom_ext_add_cb sends an empty ClientHello
+ * Extension, and a NULL custom_ext_parse_cb ignores the ServerHello
* response (if any).
*
- * For the server functions, a NULL custom_srv_ext_first_cb_fn means the
+ * For the server functions, a NULL custom_ext_parse means the
* ClientHello extension's data will be ignored, but the extension will still
- * be noted and custom_srv_ext_second_cb_fn will still be invoked. A NULL
+ * be noted and custom_ext_add_cb will still be invoked. A NULL
* custom_srv_ext_second_cb doesn't send a ServerHello extension.
*/
-int SSL_CTX_set_custom_cli_ext(SSL_CTX *ctx, unsigned short ext_type,
- custom_cli_ext_first_cb_fn fn1,
- custom_cli_ext_second_cb_fn fn2, void *arg);
+int SSL_CTX_set_custom_cli_ext(SSL_CTX *ctx, unsigned int ext_type,
+ custom_ext_add_cb add_cb,
+ custom_ext_parse_cb parse_cb, void *arg);
-int SSL_CTX_set_custom_srv_ext(SSL_CTX *ctx, unsigned short ext_type,
- custom_srv_ext_first_cb_fn fn1,
- custom_srv_ext_second_cb_fn fn2, void *arg);
+int SSL_CTX_set_custom_srv_ext(SSL_CTX *ctx, unsigned int ext_type,
+ custom_ext_parse_cb parse_cb,
+ custom_ext_add_cb add_cb, void *arg);
#endif