MySQL 8.3.0
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, 2023, 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 also distributed 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 included with MySQL.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26#include "my_compiler.h"
27#include "violite.h"
28
30
31int MY_ATTRIBUTE((visibility("default")))
33
34} // namespace ssl_wrapper_service
35
36/**
37 Return version of SSL used in current connection.
38
39 @param vio VIO connection descriptor
40 @param buffer Character buffer in which the version is going to be
41 placed
42 @param buffer_size Size of the character buffer
43*/
44void ssl_wrapper_version(Vio *vio, char *buffer, const size_t buffer_size);
45
46/**
47 Return cipher used in current connection
48
49 @param vio VIO connection descriptor
50 @param buffer Character buffer in which the cipher name is going to
51 be placed
52 @param buffer_size Size of the character buffer
53*/
54void ssl_wrapper_cipher(Vio *vio, char *buffer, const size_t buffer_size);
55
56/**
57 Return cipher list that can be used for SSL
58
59 @param vio VIO connection descriptor
60 @param clipher_list Pointer to an array of c-strings
61 @param maximun_num_of_elements Size of the pointer array
62*/
63long ssl_wrapper_cipher_list(Vio *vio, const char **clipher_list,
64 const long maximun_num_of_elements);
65
66/**
67 Return the verification depth limit set in SSL
68
69 @param vio VIO connection descriptor
70
71 @return
72 -1 default values should be used
73 >0 verification depth
74*/
76
77/**
78 Return the verification mode set in SSL
79
80 @param vio VIO connection descriptor
81
82 @return
83 -1 default values should be used
84 >0 verification mode
85*/
87
88/**
89 Return issuer name form peers ssl certificate
90
91 @param vio VIO connection descriptor
92 @param issuer Character buffer in which the issuer name is going to
93 be placed
94 @param issuer_size Size of character buffer for the issuer name
95*/
96void ssl_wrapper_get_peer_certificate_issuer(Vio *vio, char *issuer,
97 const size_t issuer_size);
98
99/**
100 Return subject field form peers ssl certificate
101
102 @param vio VIO connection descriptor
103 @param subject Character buffer in which the subject is going to be
104 placed
105 @param subject_size Size of character buffer for the subject
106*/
107void ssl_wrapper_get_peer_certificate_subject(Vio *vio, char *subject,
108 const size_t subject_size);
109
110/**
111 Check is peer certificate is present and try to verify it
112
113 @param vio VIO connection descriptor
114
115 @return
116 X509_V_OK verification of peer certificate succeeded
117 -1 verification failed
118*/
120
121/**
122 Return the verification depth limit set in SSL context
123
124 @param vio_ssl VIO SSL context descriptor
125
126 @return
127 -1 default values should be used
128 >0 verification depth
129*/
130long ssl_wrapper_ctx_verify_depth(struct st_VioSSLFd *vio_ssl);
131
132/**
133 Return the verification mode set in SSL context
134
135 @param vio_ssl VIO SSL context descriptor
136
137 @return
138 -1 default values should be used
139 >0 verification mode
140*/
141long ssl_wrapper_ctx_verify_mode(struct st_VioSSLFd *vio_ssl);
142
143/**
144 Return the last day the server certificate is valid
145
146 @param vio_ssl VIO SSL context descriptor
147 @param no_after Character buffer for to be filed with the date in
148 human readable format
149 @param no_after_size Size of the character buffer
150*/
152 char *no_after,
153 const size_t no_after_size);
154
155/**
156 Return the first day the server certificate is valid
157
158 @param vio_ssl VIO SSL context descriptor
159 @param no_before Character buffer for to be filed with the date in
160 human readable format
161 @param no_before_size Size of the character buffer
162*/
164 char *no_before,
165 const size_t no_before_size);
166
168
169long ssl_wrapper_sess_accept(struct st_VioSSLFd *vio_ssl);
170
171/**
172 Cleanup data allocated by SSL on thread stack
173
174*/
175long ssl_wrapper_sess_accept_good(struct st_VioSSLFd *vio_ssl);
176
177#endif /* SSL_WRAPPER_INCLUDED */
Header for compiler-dependent features.
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:417
size_t buffer_size(const ConstBufferSequence &buffers) noexcept
Definition: buffer.h:312
Definition: service_ssl_wrapper.h:29
int dummy_function_to_ensure_we_are_linked_into_the_server()
Definition: ssl_wrapper_service.cc:43
void ssl_wrapper_cipher(Vio *vio, char *buffer, const size_t buffer_size)
Return cipher used in current connection.
Definition: ssl_wrapper_service.cc:84
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:258
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:70
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:98
long ssl_wrapper_sess_accept(struct st_VioSSLFd *vio_ssl)
Definition: ssl_wrapper_service.cc:279
long ssl_wrapper_verify_depth(Vio *vio)
Return the verification depth limit set in SSL.
Definition: ssl_wrapper_service.cc:124
long ssl_wrapper_verify_mode(Vio *vio)
Return the verification mode set in SSL.
Definition: ssl_wrapper_service.cc:128
void ssl_wrapper_thread_cleanup()
Cleanup data allocated by SSL on thread stack.
Definition: ssl_wrapper_service.cc:291
long ssl_wrapper_sess_accept_good(struct st_VioSSLFd *vio_ssl)
Cleanup data allocated by SSL on thread stack.
Definition: ssl_wrapper_service.cc:283
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:181
long ssl_wrapper_ctx_verify_mode(struct st_VioSSLFd *vio_ssl)
Return the verification mode set in SSL context.
Definition: ssl_wrapper_service.cc:217
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:204
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:229
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:140
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:160
Definition: violite.h:319
Definition: violite.h:255
Vio Lite.