Debian Codegraph @

contrib/hiredis/hiredis_ssl.h

raw symbols SCIP
1
2 /*
3 * Copyright (c) 2019, Redis Labs
4 *
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Redis nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef __HIREDIS_SSL_H
33 #define __HIREDIS_SSL_Hcxx . . $ `contrib/hiredis/hiredis_ssl.h:33:9`!
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /* This is the underlying struct for SSL in ssl.h, which is not included to
40 * keep build dependencies short here.
41 */
42 struct ssl_stcxx . . $ ssl_st#;
43
44 /* A wrapper around OpenSSL SSL_CTX to allow easy SSL use without directly
45 * calling OpenSSL.
46 */
47 typedef struct redisSSLContextcxx . . $ redisSSLContext# redisSSLContextcxx . . $ redisSSLContext#;
48
49 /**
50 * Initialization errors that redisCreateSSLContext() may return.
51 */
52
53 typedef enumcxx . . $ $anonymous_type_54d45ff0bd0b586d_0# {
54 REDIS_SSL_CTX_NONEcxx . . $ REDIS_SSL_CTX_NONE. = 0, /* No Error */
55 REDIS_SSL_CTX_CREATE_FAILEDcxx . . $ REDIS_SSL_CTX_CREATE_FAILED., /* Failed to create OpenSSL SSL_CTX */
56 REDIS_SSL_CTX_CERT_KEY_REQUIREDcxx . . $ REDIS_SSL_CTX_CERT_KEY_REQUIRED., /* Client cert and key must both be specified or skipped */
57 REDIS_SSL_CTX_CA_CERT_LOAD_FAILEDcxx . . $ REDIS_SSL_CTX_CA_CERT_LOAD_FAILED., /* Failed to load CA Certificate or CA Path */
58 REDIS_SSL_CTX_CLIENT_CERT_LOAD_FAILEDcxx . . $ REDIS_SSL_CTX_CLIENT_CERT_LOAD_FAILED., /* Failed to load client certificate */
59 REDIS_SSL_CTX_CLIENT_DEFAULT_CERT_FAILEDcxx . . $ REDIS_SSL_CTX_CLIENT_DEFAULT_CERT_FAILED., /* Failed to set client default certificate directory */
60 REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILEDcxx . . $ REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILED., /* Failed to load private key */
61 REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILEDcxx . . $ REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILED., /* Failed to open system certificate store */
62 REDIS_SSL_CTX_OS_CERT_ADD_FAILEDcxx . . $ REDIS_SSL_CTX_OS_CERT_ADD_FAILED. /* Failed to add CA certificates obtained from system to the SSL context */
63 } redisSSLContextErrorcxx . . $ redisSSLContextError#;
64
65 /* Constants that mirror OpenSSL's verify modes. By default,
66 * REDIS_SSL_VERIFY_PEER is used with redisCreateSSLContext().
67 * Some Redis clients disable peer verification if there are no
68 * certificates specified.
69 */
70 #define REDIS_SSL_VERIFY_NONEcxx . . $ `contrib/hiredis/hiredis_ssl.h:70:9`! 0x00
71 #define REDIS_SSL_VERIFY_PEERcxx . . $ `contrib/hiredis/hiredis_ssl.h:71:9`! 0x01
72 #define REDIS_SSL_VERIFY_FAIL_IF_NO_PEER_CERTcxx . . $ `contrib/hiredis/hiredis_ssl.h:72:9`! 0x02
73 #define REDIS_SSL_VERIFY_CLIENT_ONCEcxx . . $ `contrib/hiredis/hiredis_ssl.h:73:9`! 0x04
74 #define REDIS_SSL_VERIFY_POST_HANDSHAKEcxx . . $ `contrib/hiredis/hiredis_ssl.h:74:9`! 0x08
75
76 /* Options to create an OpenSSL context. */
77 typedef structcxx . . $ $anonymous_type_54d45ff0bd0b586d_1# {
78 const char *cacert_filenamecxx . . $ $anonymous_type_54d45ff0bd0b586d_1#cacert_filename.;
79 const char *capathcxx . . $ $anonymous_type_54d45ff0bd0b586d_1#capath.;
80 const char *cert_filenamecxx . . $ $anonymous_type_54d45ff0bd0b586d_1#cert_filename.;
81 const char *private_key_filenamecxx . . $ $anonymous_type_54d45ff0bd0b586d_1#private_key_filename.;
82 const char *server_namecxx . . $ $anonymous_type_54d45ff0bd0b586d_1#server_name.;
83 int verify_modecxx . . $ $anonymous_type_54d45ff0bd0b586d_1#verify_mode.;
84 } redisSSLOptionscxx . . $ redisSSLOptions#;
85
86 /**
87 * Return the error message corresponding with the specified error code.
88 */
89
90 const char *redisSSLContextGetErrorcxx . . $ redisSSLContextGetError(73720b164f284230).(redisSSLContextErrorcxx . . $ redisSSLContextError# error);
91
92 /**
93 * Helper function to initialize the OpenSSL library.
94 *
95 * OpenSSL requires one-time initialization before it can be used. Callers should
96 * call this function only once, and only if OpenSSL is not directly initialized
97 * elsewhere.
98 */
99 int redisInitOpenSSLcxx . . $ redisInitOpenSSL(b126dc7c1de90089).(void);
100
101 /**
102 * Helper function to initialize an OpenSSL context that can be used
103 * to initiate SSL connections.
104 *
105 * cacert_filename is an optional name of a CA certificate/bundle file to load
106 * and use for validation.
107 *
108 * capath is an optional directory path where trusted CA certificate files are
109 * stored in an OpenSSL-compatible structure.
110 *
111 * cert_filename and private_key_filename are optional names of a client side
112 * certificate and private key files to use for authentication. They need to
113 * be both specified or omitted.
114 *
115 * server_name is an optional and will be used as a server name indication
116 * (SNI) TLS extension.
117 *
118 * If error is non-null, it will be populated in case the context creation fails
119 * (returning a NULL).
120 */
121
122 redisSSLContextcxx . . $ redisSSLContext# *redisCreateSSLContextcxx . . $ redisCreateSSLContext(2921e07fb811ba64).(const char *cacert_filename, const char *capath,
123 const char *cert_filename, const char *private_key_filename,
124 const char *server_name, redisSSLContextErrorcxx . . $ redisSSLContextError# *error);
125
126 /**
127 * Helper function to initialize an OpenSSL context that can be used
128 * to initiate SSL connections. This is a more extensible version of redisCreateSSLContext().
129 *
130 * options contains a structure of SSL options to use.
131 *
132 * If error is non-null, it will be populated in case the context creation fails
133 * (returning a NULL).
134 */
135 redisSSLContextcxx . . $ redisSSLContext# *redisCreateSSLContextWithOptionscxx . . $ redisCreateSSLContextWithOptions(5ae1adf7cd76eaab).(redisSSLOptionscxx . . $ redisSSLOptions# *options,
136 redisSSLContextErrorcxx . . $ redisSSLContextError# *error);
137
138 /**
139 * Free a previously created OpenSSL context.
140 */
141 void redisFreeSSLContextcxx . . $ redisFreeSSLContext(993c2e29c5b2467b).(redisSSLContextcxx . . $ redisSSLContext# *redis_ssl_ctx);
142
143 /**
144 * Initiate SSL on an existing redisContext.
145 *
146 * This is similar to redisInitiateSSL() but does not require the caller
147 * to directly interact with OpenSSL, and instead uses a redisSSLContext
148 * previously created using redisCreateSSLContext().
149 */
150
151 int redisInitiateSSLWithContextcxx . . $ redisInitiateSSLWithContext(17a1ec13d26c12b9).(redisContextcxx . . $ redisContext# *c, redisSSLContextcxx . . $ redisSSLContext# *redis_ssl_ctx);
152
153 /**
154 * Initiate SSL/TLS negotiation on a provided OpenSSL SSL object.
155 */
156
157 int redisInitiateSSLcxx . . $ redisInitiateSSL(6029730ac75b0476).(redisContextcxx . . $ redisContext# *c, struct ssl_stcxx . . $ ssl_st# *ssl);
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif /* __HIREDIS_SSL_H */