MySQL 8.0.40
Source Code Documentation
service_ssl_wrapper.h
Go to the documentation of this file.
1#ifndef SSL_WRAPPER_INCLUDED
2#define SSL_WRAPPER_INCLUDED
3
4/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27#include "my_compiler.h"
28#include "violite.h"
29
31
32int MY_ATTRIBUTE((visibility("default")))
34
35} // namespace ssl_wrapper_service
36
37/**
38 Return version of SSL used in current connection.
39
40 @param vio VIO connection descriptor
41 @param buffer Character buffer in which the version is going to be
42 placed
43 @param buffer_size Size of the character buffer
44*/
45void ssl_wrapper_version(Vio *vio, char *buffer, const size_t buffer_size);
46
47/**
48 Return cipher used in current connection
49
50 @param vio VIO connection descriptor
51 @param buffer Character buffer in which the cipher name is going to
52 be placed
53 @param buffer_size Size of the character buffer
54*/
55void ssl_wrapper_cipher(Vio *vio, char *buffer, const size_t buffer_size);
56
57/**
58 Return cipher list that can be used for SSL
59
60 @param vio VIO connection descriptor
61 @param clipher_list Pointer to an array of c-strings
62 @param maximun_num_of_elements Size of the pointer array
63*/
64long ssl_wrapper_cipher_list(Vio *vio, const char **clipher_list,
65 const long maximun_num_of_elements);
66
67/**
68 Return the verification depth limit set in SSL
69
70 @param vio VIO connection descriptor
71
72 @return
73 -1 default values should be used
74 >0 verification depth
75*/
77
78/**
79 Return the verification mode set in SSL
80
81 @param vio VIO connection descriptor
82
83 @return
84 -1 default values should be used
85 >0 verification mode
86*/
88
89/**
90 Return issuer name form peers ssl certificate
91
92 @param vio VIO connection descriptor
93 @param issuer Character buffer in which the issuer name is going to
94 be placed
95 @param issuer_size Size of character buffer for the issuer name
96*/
97void ssl_wrapper_get_peer_certificate_issuer(Vio *vio, char *issuer,
98 const size_t issuer_size);
99
100/**
101 Return subject field form peers ssl certificate
102
103 @param vio VIO connection descriptor
104 @param subject Character buffer in which the subject is going to be
105 placed
106 @param subject_size Size of character buffer for the subject
107*/
108void ssl_wrapper_get_peer_certificate_subject(Vio *vio, char *subject,
109 const size_t subject_size);
110
111/**
112 Check is peer certificate is present and try to verify it
113
114 @param vio VIO connection descriptor
115
116 @return
117 X509_V_OK verification of peer certificate succeeded
118 -1 verification failed
119*/
121
122/**
123 Return the verification depth limit set in SSL context
124
125 @param vio_ssl VIO SSL context descriptor
126
127 @return
128 -1 default values should be used
129 >0 verification depth
130*/
131long ssl_wrapper_ctx_verify_depth(struct st_VioSSLFd *vio_ssl);
132
133/**
134 Return the verification mode set in SSL context
135
136 @param vio_ssl VIO SSL context descriptor
137
138 @return
139 -1 default values should be used
140 >0 verification mode
141*/
142long ssl_wrapper_ctx_verify_mode(struct st_VioSSLFd *vio_ssl);
143
144/**
145 Return the last day the server certificate is valid
146
147 @param vio_ssl VIO SSL context descriptor
148 @param no_after Character buffer for to be filed with the date in
149 human readable format
150 @param no_after_size Size of the character buffer
151*/
153 char *no_after,
154 const size_t no_after_size);
155
156/**
157 Return the first day the server certificate is valid
158
159 @param vio_ssl VIO SSL context descriptor
160 @param no_before Character buffer for to be filed with the date in
161 human readable format
162 @param no_before_size Size of the character buffer
163*/
165 char *no_before,
166 const size_t no_before_size);
167
169
170long ssl_wrapper_sess_accept(struct st_VioSSLFd *vio_ssl);
171
172/**
173 Cleanup data allocated by SSL on thread stack
174
175*/
176long ssl_wrapper_sess_accept_good(struct st_VioSSLFd *vio_ssl);
177
178#endif /* SSL_WRAPPER_INCLUDED */
Header for compiler-dependent features.
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
size_t buffer_size(const ConstBufferSequence &buffers) noexcept
Definition: buffer.h:315
Definition: service_ssl_wrapper.h:30
int dummy_function_to_ensure_we_are_linked_into_the_server()
Definition: ssl_wrapper_service.cc:44
void ssl_wrapper_cipher(Vio *vio, char *buffer, const size_t buffer_size)
Return cipher used in current connection.
Definition: ssl_wrapper_service.cc:85
void ssl_wrapper_ctx_server_not_before(struct st_VioSSLFd *vio_ssl, char *no_before, const size_t no_before_size)
Return the first day the server certificate is valid.
Definition: ssl_wrapper_service.cc:259
void ssl_wrapper_version(Vio *vio, char *buffer, const size_t buffer_size)
Return version of SSL used in current connection.
Definition: ssl_wrapper_service.cc:71
long ssl_wrapper_cipher_list(Vio *vio, const char **clipher_list, const long maximun_num_of_elements)
Return cipher list that can be used for SSL.
Definition: ssl_wrapper_service.cc:99
long ssl_wrapper_sess_accept(struct st_VioSSLFd *vio_ssl)
Definition: ssl_wrapper_service.cc:280
long ssl_wrapper_verify_depth(Vio *vio)
Return the verification depth limit set in SSL.
Definition: ssl_wrapper_service.cc:125
long ssl_wrapper_verify_mode(Vio *vio)
Return the verification mode set in SSL.
Definition: ssl_wrapper_service.cc:129
void ssl_wrapper_thread_cleanup()
Cleanup data allocated by SSL on thread stack.
Definition: ssl_wrapper_service.cc:292
long ssl_wrapper_sess_accept_good(struct st_VioSSLFd *vio_ssl)
Cleanup data allocated by SSL on thread stack.
Definition: ssl_wrapper_service.cc:284
long ssl_wrapper_get_verify_result_and_cert(Vio *vio)
Check is peer certificate is present and try to verify it.
Definition: ssl_wrapper_service.cc:182
long ssl_wrapper_ctx_verify_mode(struct st_VioSSLFd *vio_ssl)
Return the verification mode set in SSL context.
Definition: ssl_wrapper_service.cc:218
long ssl_wrapper_ctx_verify_depth(struct st_VioSSLFd *vio_ssl)
Return the verification depth limit set in SSL context.
Definition: ssl_wrapper_service.cc:205
void ssl_wrapper_ctx_server_not_after(struct st_VioSSLFd *vio_ssl, char *no_after, const size_t no_after_size)
Return the last day the server certificate is valid.
Definition: ssl_wrapper_service.cc:230
void ssl_wrapper_get_peer_certificate_issuer(Vio *vio, char *issuer, const size_t issuer_size)
Return issuer name form peers ssl certificate.
Definition: ssl_wrapper_service.cc:141
void ssl_wrapper_get_peer_certificate_subject(Vio *vio, char *subject, const size_t subject_size)
Return subject field form peers ssl certificate.
Definition: ssl_wrapper_service.cc:161
Definition: violite.h:318
Definition: violite.h:255
Vio Lite.