summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_locl.h
diff options
context:
space:
mode:
authorjsing <>2021-08-30 19:25:43 +0000
committerjsing <>2021-08-30 19:25:43 +0000
commita376b9cd8ffd396f270e597131a83af4f639bd93 (patch)
tree8e3bea79ab1dea102b95252a7e2c36c06522e41d /src/lib/libssl/ssl_locl.h
parentcedbde20c0ecfb870c00ce4fe4401f89a9397b6d (diff)
downloadopenbsd-a376b9cd8ffd396f270e597131a83af4f639bd93.tar.gz
openbsd-a376b9cd8ffd396f270e597131a83af4f639bd93.tar.bz2
openbsd-a376b9cd8ffd396f270e597131a83af4f639bd93.zip
Clean up and simplify info and msg callbacks.
The info and msg callbacks result in duplication - both for code that refers to the function pointers and for the call sites. Avoid this by providing typedefs for the function pointers and pulling the calling sequences into their own functions. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r--src/lib/libssl/ssl_locl.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index d25ac1a1a6..7ff3e0713d 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.357 2021/08/30 19:12:25 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.358 2021/08/30 19:25:43 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -662,6 +662,10 @@ int tls12_record_layer_seal_record(struct tls12_record_layer *rl,
662 uint8_t content_type, const uint8_t *content, size_t content_len, 662 uint8_t content_type, const uint8_t *content, size_t content_len,
663 CBB *out); 663 CBB *out);
664 664
665typedef void (ssl_info_callback_fn)(const SSL *s, int type, int val);
666typedef void (ssl_msg_callback_fn)(int is_write, int version, int content_type,
667 const void *buf, size_t len, SSL *ssl, void *arg);
668
665typedef struct ssl_ctx_internal_st { 669typedef struct ssl_ctx_internal_st {
666 uint16_t min_tls_version; 670 uint16_t min_tls_version;
667 uint16_t max_tls_version; 671 uint16_t max_tls_version;
@@ -704,11 +708,10 @@ typedef struct ssl_ctx_internal_st {
704 int (*app_verify_cookie_cb)(SSL *ssl, const unsigned char *cookie, 708 int (*app_verify_cookie_cb)(SSL *ssl, const unsigned char *cookie,
705 unsigned int cookie_len); 709 unsigned int cookie_len);
706 710
707 void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */ 711 ssl_info_callback_fn *info_callback;
708 712
709 /* callback that allows applications to peek at protocol messages */ 713 /* callback that allows applications to peek at protocol messages */
710 void (*msg_callback)(int write_p, int version, int content_type, 714 ssl_msg_callback_fn *msg_callback;
711 const void *buf, size_t len, SSL *ssl, void *arg);
712 void *msg_callback_arg; 715 void *msg_callback_arg;
713 716
714 int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */ 717 int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
@@ -854,17 +857,17 @@ typedef struct ssl_internal_st {
854 /* true when we are actually in SSL_accept() or SSL_connect() */ 857 /* true when we are actually in SSL_accept() or SSL_connect() */
855 int in_handshake; 858 int in_handshake;
856 int (*handshake_func)(SSL *); 859 int (*handshake_func)(SSL *);
860
861 ssl_info_callback_fn *info_callback;
862
857 /* callback that allows applications to peek at protocol messages */ 863 /* callback that allows applications to peek at protocol messages */
858 void (*msg_callback)(int write_p, int version, int content_type, 864 ssl_msg_callback_fn *msg_callback;
859 const void *buf, size_t len, SSL *ssl, void *arg);
860 void *msg_callback_arg; 865 void *msg_callback_arg;
861 866
862 /* Default generate session ID callback. */
863 GEN_SESSION_CB generate_session_id;
864
865 int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */ 867 int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */
866 868
867 void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */ 869 /* Default generate session ID callback. */
870 GEN_SESSION_CB generate_session_id;
868 871
869 /* TLS extension debug callback */ 872 /* TLS extension debug callback */
870 void (*tlsext_debug_cb)(SSL *s, int client_server, int type, 873 void (*tlsext_debug_cb)(SSL *s, int client_server, int type,
@@ -1177,6 +1180,10 @@ void ssl_clear_cipher_read_state(SSL *s);
1177void ssl_clear_cipher_write_state(SSL *s); 1180void ssl_clear_cipher_write_state(SSL *s);
1178int ssl_clear_bad_session(SSL *s); 1181int ssl_clear_bad_session(SSL *s);
1179 1182
1183void ssl_info_callback(const SSL *s, int type, int value);
1184void ssl_msg_callback(SSL *s, int is_write, int content_type,
1185 const void *msg_buf, size_t msg_len);
1186
1180CERT *ssl_cert_new(void); 1187CERT *ssl_cert_new(void);
1181CERT *ssl_cert_dup(CERT *cert); 1188CERT *ssl_cert_dup(CERT *cert);
1182void ssl_cert_free(CERT *c); 1189void ssl_cert_free(CERT *c);