1SSL_CTX_set_msg_callback(3) OpenSSL SSL_CTX_set_msg_callback(3)
2
3
4
6 SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg,
7 SSL_set_msg_callback, SSL_get_msg_callback_arg - install callback for
8 observing protocol messages
9
11 #include <openssl/ssl.h>
12
13 void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
14 void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);
15
16 void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
17 void SSL_set_msg_callback_arg(SSL *ssl, void *arg);
18
20 SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to
21 define a message callback function cb for observing all SSL/TLS
22 protocol messages (such as handshake messages) that are received or
23 sent. SSL_CTX_set_msg_callback_arg() and SSL_set_msg_callback_arg()
24 can be used to set argument arg to the callback function, which is
25 available for arbitrary application use.
26
27 SSL_CTX_set_msg_callback() and SSL_CTX_set_msg_callback_arg() specify
28 default settings that will be copied to new SSL objects by SSL_new(3).
29 SSL_set_msg_callback() and SSL_set_msg_callback_arg() modify the actual
30 settings of an SSL object. Using a 0 pointer for cb disables the
31 message callback.
32
33 When cb is called by the SSL/TLS library for a protocol message, the
34 function arguments have the following meaning:
35
36 write_p
37 This flag is 0 when a protocol message has been received and 1 when
38 a protocol message has been sent.
39
40 version
41 The protocol version according to which the protocol message is
42 interpreted by the library. Currently, this is one of SSL2_VERSION,
43 SSL3_VERSION and TLS1_VERSION (for SSL 2.0, SSL 3.0 and TLS 1.0,
44 respectively).
45
46 content_type
47 In the case of SSL 2.0, this is always 0. In the case of SSL 3.0
48 or TLS 1.0, this is one of the ContentType values defined in the
49 protocol specification (change_cipher_spec(20), alert(21),
50 handshake(22); but never application_data(23) because the callback
51 will only be called for protocol messages).
52
53 buf, len
54 buf points to a buffer containing the protocol message, which
55 consists of len bytes. The buffer is no longer valid after the
56 callback function has returned.
57
58 ssl The SSL object that received or sent the message.
59
60 arg The user-defined argument optionally defined by
61 SSL_CTX_set_msg_callback_arg() or SSL_set_msg_callback_arg().
62
64 Protocol messages are passed to the callback function after decryption
65 and fragment collection where applicable. (Thus record boundaries are
66 not visible.)
67
68 If processing a received protocol message results in an error, the
69 callback function may not be called. For example, the callback
70 function will never see messages that are considered too large to be
71 processed.
72
73 Due to automatic protocol version negotiation, version is not
74 necessarily the protocol version used by the sender of the message: If
75 a TLS 1.0 ClientHello message is received by an SSL 3.0-only server,
76 version will be SSL3_VERSION.
77
79 ssl(3), SSL_new(3)
80
82 SSL_CTX_set_msg_callback(), SSL_CTX_set_msg_callback_arg(),
83 SSL_set_msg_callback() and SSL_get_msg_callback_arg() were added in
84 OpenSSL 0.9.7.
85
86
87
881.0.2o 2020-01-28 SSL_CTX_set_msg_callback(3)