-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathcrypto_openssl.c
More file actions
417 lines (369 loc) · 16.4 KB
/
crypto_openssl.c
File metadata and controls
417 lines (369 loc) · 16.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
/*
** SQLCipher
** http://sqlcipher.net
**
** Copyright (c) 2008 - 2013, ZETETIC LLC
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the ZETETIC LLC nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY
** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*/
/* BEGIN SQLCIPHER */
#ifdef SQLITE_HAS_CODEC
#ifdef SQLCIPHER_CRYPTO_OPENSSL
#include "sqliteInt.h"
#include "sqlcipher.h"
#include <openssl/crypto.h> /* amalgamator: dontcache */
#include <openssl/rand.h> /* amalgamator: dontcache */
#include <openssl/evp.h> /* amalgamator: dontcache */
#include <openssl/objects.h> /* amalgamator: dontcache */
#include <openssl/hmac.h> /* amalgamator: dontcache */
#include <openssl/err.h> /* amalgamator: dontcache */
static unsigned int openssl_init_count = 0;
static void sqlcipher_openssl_log_errors() {
unsigned long err = 0;
while((err = ERR_get_error()) != 0) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_log_errors: ERR_get_error() returned %lx: %s", err, ERR_error_string(err, NULL));
}
}
static int sqlcipher_openssl_add_random(void *ctx, const void *buffer, int length) {
#ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_add_random: entering SQLCIPHER_MUTEX_PROVIDER_RAND");
sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_add_random: entered SQLCIPHER_MUTEX_PROVIDER_RAND");
#endif
RAND_add(buffer, length, 0);
#ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_add_random: leaving SQLCIPHER_MUTEX_PROVIDER_RAND");
sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_add_random: left SQLCIPHER_MUTEX_PROVIDER_RAND");
#endif
return SQLITE_OK;
}
#define OPENSSL_CIPHER EVP_aes_256_cbc()
/* activate and initialize sqlcipher. Most importantly, this will automatically
intialize OpenSSL's EVP system if it hasn't already be externally. Note that
this function may be called multiple times as new codecs are intiialized.
Thus it performs some basic counting to ensure that only the last and final
sqlcipher_openssl_deactivate() will free the EVP structures.
*/
static int sqlcipher_openssl_activate(void *ctx) {
/* initialize openssl and increment the internal init counter
but only if it hasn't been initalized outside of SQLCipher by this program
e.g. on startup */
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_activate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_activate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
#if (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L)
ERR_load_crypto_strings();
#endif
openssl_init_count++;
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_activate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_activate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
return SQLITE_OK;
}
/* deactivate SQLCipher, most imporantly decremeting the activation count and
freeing the EVP structures on the final deactivation to ensure that
OpenSSL memory is cleaned up */
static int sqlcipher_openssl_deactivate(void *ctx) {
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_deactivate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_deactivate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
openssl_init_count--;
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_deactivate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_deactivate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE");
return SQLITE_OK;
}
static const char* sqlcipher_openssl_get_provider_name(void *ctx) {
return "openssl";
}
static const char* sqlcipher_openssl_get_provider_version(void *ctx) {
#if (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L)
return OPENSSL_VERSION_TEXT;
#else
return OpenSSL_version(OPENSSL_VERSION);
#endif
}
/* generate a defined number of random bytes */
static int sqlcipher_openssl_random (void *ctx, void *buffer, int length) {
int rc = 0;
/* concurrent calls to RAND_bytes can cause a crash under some openssl versions when a
naive application doesn't use CRYPTO_set_locking_callback and
CRYPTO_THREADID_set_callback to ensure openssl thread safety.
This is simple workaround to prevent this common crash
but a more proper solution is that applications setup platform-appropriate
thread saftey in openssl externally */
#ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_random: entering SQLCIPHER_MUTEX_PROVIDER_RAND");
sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_random: entered SQLCIPHER_MUTEX_PROVIDER_RAND");
#endif
rc = RAND_bytes((unsigned char *)buffer, length);
#ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_random: leaving SQLCIPHER_MUTEX_PROVIDER_RAND");
sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND));
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_MUTEX, "sqlcipher_openssl_random: left SQLCIPHER_MUTEX_PROVIDER_RAND");
#endif
if(!rc) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_random: RAND_bytes() returned %d", rc);
sqlcipher_openssl_log_errors();
return SQLITE_ERROR;
}
return SQLITE_OK;
}
static int sqlcipher_openssl_hmac(
void *ctx, int algorithm,
const unsigned char *hmac_key, int key_sz,
const unsigned char *in, int in_sz,
const unsigned char *in2, int in2_sz,
unsigned char *out
) {
int rc = 0;
size_t outlen;
EVP_MAC *mac = NULL;
EVP_MAC_CTX *hctx = NULL;
OSSL_PARAM sha1[] = { { "digest", OSSL_PARAM_UTF8_STRING, "sha1", 4, 0 }, OSSL_PARAM_END };
OSSL_PARAM sha256[] = { { "digest", OSSL_PARAM_UTF8_STRING, "sha256", 6, 0 }, OSSL_PARAM_END };
OSSL_PARAM sha512[] = { { "digest", OSSL_PARAM_UTF8_STRING, "sha512", 6, 0 }, OSSL_PARAM_END };
if(in == NULL) goto error;
mac = EVP_MAC_fetch(NULL, "HMAC", NULL);
if(mac == NULL) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_fetch for HMAC failed");
sqlcipher_openssl_log_errors();
goto error;
}
hctx = EVP_MAC_CTX_new(mac);
if(hctx == NULL) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_CTX_new() failed");
sqlcipher_openssl_log_errors();
goto error;
}
switch(algorithm) {
case SQLCIPHER_HMAC_SHA1:
if(!(rc = EVP_MAC_init(hctx, hmac_key, key_sz, sha1))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_init() with key size %d and sha1 returned %d", key_sz, rc);
sqlcipher_openssl_log_errors();
goto error;
}
break;
case SQLCIPHER_HMAC_SHA256:
if(!(rc = EVP_MAC_init(hctx, hmac_key, key_sz, sha256))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_init() with key size %d and sha256 returned %d", key_sz, rc);
sqlcipher_openssl_log_errors();
goto error;
}
break;
case SQLCIPHER_HMAC_SHA512:
if(!(rc = EVP_MAC_init(hctx, hmac_key, key_sz, sha512))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_init() with key size %d and sha512 returned %d", key_sz, rc);
sqlcipher_openssl_log_errors();
goto error;
}
break;
default:
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: invalid algorithm %d", algorithm);
goto error;
}
if(!(rc = EVP_MAC_update(hctx, in, in_sz))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_update() on 1st input buffer of %d bytes using algorithm %d returned %d", in_sz, algorithm, rc);
sqlcipher_openssl_log_errors();
goto error;
}
if(in2 != NULL) {
if(!(rc = EVP_MAC_update(hctx, in2, in2_sz))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: EVP_MAC_update() on 2nd input buffer of %d bytes using algorithm %d returned %d", in_sz, algorithm, rc);
sqlcipher_openssl_log_errors();
goto error;
}
}
if(!(rc = EVP_MAC_final(hctx, NULL, &outlen, 0))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: 1st EVP_MAC_final() for output length calculation using algorithm %d returned %d", algorithm, rc);
sqlcipher_openssl_log_errors();
goto error;
}
if(!(rc = EVP_MAC_final(hctx, out, &outlen, outlen))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_hmac: 2nd EVP_MAC_final() using algorithm %d returned %d", algorithm, rc);
sqlcipher_openssl_log_errors();
goto error;
}
rc = SQLITE_OK;
goto cleanup;
error:
rc = SQLITE_ERROR;
cleanup:
if(hctx) EVP_MAC_CTX_free(hctx);
if(mac) EVP_MAC_free(mac);
return rc;
}
static int sqlcipher_openssl_kdf(
void *ctx, int algorithm,
const unsigned char *pass, int pass_sz,
const unsigned char* salt, int salt_sz,
int workfactor,
int key_sz, unsigned char *key
) {
int rc = 0;
switch(algorithm) {
case SQLCIPHER_HMAC_SHA1:
if(!(rc = PKCS5_PBKDF2_HMAC((const char *)pass, pass_sz, salt, salt_sz, workfactor, EVP_sha1(), key_sz, key))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_kdf: PKCS5_PBKDF2_HMAC() for EVP_sha1() workfactor %d and key size %d returned %d", workfactor, key_sz, rc);
sqlcipher_openssl_log_errors();
goto error;
}
break;
case SQLCIPHER_HMAC_SHA256:
if(!(rc = PKCS5_PBKDF2_HMAC((const char *)pass, pass_sz, salt, salt_sz, workfactor, EVP_sha256(), key_sz, key))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_kdf: PKCS5_PBKDF2_HMAC() for EVP_sha256() workfactor %d and key size %d returned %d", workfactor, key_sz, rc);
sqlcipher_openssl_log_errors();
goto error;
}
break;
case SQLCIPHER_HMAC_SHA512:
if(!(rc = PKCS5_PBKDF2_HMAC((const char *)pass, pass_sz, salt, salt_sz, workfactor, EVP_sha512(), key_sz, key))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_kdf: PKCS5_PBKDF2_HMAC() for EVP_sha512() workfactor %d and key size %d returned %d", workfactor, key_sz, rc);
sqlcipher_openssl_log_errors();
goto error;
}
break;
default:
return SQLITE_ERROR;
}
rc = SQLITE_OK;
goto cleanup;
error:
rc = SQLITE_ERROR;
cleanup:
return rc;
}
static int sqlcipher_openssl_cipher(
void *ctx, int mode,
const unsigned char *key, int key_sz,
const unsigned char *iv,
const unsigned char *in, int in_sz,
unsigned char *out
) {
int tmp_csz, csz, rc = 0;
EVP_CIPHER_CTX* ectx = EVP_CIPHER_CTX_new();
if(ectx == NULL) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_cipher: EVP_CIPHER_CTX_new failed");
sqlcipher_openssl_log_errors();
goto error;
}
if(!(rc = EVP_CipherInit_ex(ectx, OPENSSL_CIPHER, NULL, NULL, NULL, mode))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_cipher: EVP_CipherInit_ex for mode %d returned %d", mode, rc);
sqlcipher_openssl_log_errors();
goto error;
}
if(!(rc = EVP_CIPHER_CTX_set_padding(ectx, 0))) { /* no padding */
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_cipher: EVP_CIPHER_CTX_set_padding 0 returned %d", rc);
sqlcipher_openssl_log_errors();
goto error;
}
if(!(rc = EVP_CipherInit_ex(ectx, NULL, NULL, key, iv, mode))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_cipher: EVP_CipherInit_ex for mode %d returned %d", mode, rc);
sqlcipher_openssl_log_errors();
goto error;
}
if(!(rc = EVP_CipherUpdate(ectx, out, &tmp_csz, in, in_sz))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_cipher: EVP_CipherUpdate returned %d", rc);
sqlcipher_openssl_log_errors();
goto error;
}
csz = tmp_csz;
out += tmp_csz;
if(!(rc = EVP_CipherFinal_ex(ectx, out, &tmp_csz))) {
sqlcipher_log(SQLCIPHER_LOG_ERROR, SQLCIPHER_LOG_PROVIDER, "sqlcipher_openssl_cipher: EVP_CipherFinal_ex returned %d", rc);
sqlcipher_openssl_log_errors();
goto error;
}
csz += tmp_csz;
assert(in_sz == csz);
rc = SQLITE_OK;
goto cleanup;
error:
rc = SQLITE_ERROR;
cleanup:
if(ectx) EVP_CIPHER_CTX_free(ectx);
return rc;
}
static const char* sqlcipher_openssl_get_cipher(void *ctx) {
return OBJ_nid2sn(EVP_CIPHER_nid(OPENSSL_CIPHER));
}
static int sqlcipher_openssl_get_key_sz(void *ctx) {
return EVP_CIPHER_key_length(OPENSSL_CIPHER);
}
static int sqlcipher_openssl_get_iv_sz(void *ctx) {
return EVP_CIPHER_iv_length(OPENSSL_CIPHER);
}
static int sqlcipher_openssl_get_block_sz(void *ctx) {
return EVP_CIPHER_block_size(OPENSSL_CIPHER);
}
static int sqlcipher_openssl_get_hmac_sz(void *ctx, int algorithm) {
switch(algorithm) {
case SQLCIPHER_HMAC_SHA1:
return EVP_MD_size(EVP_sha1());
break;
case SQLCIPHER_HMAC_SHA256:
return EVP_MD_size(EVP_sha256());
break;
case SQLCIPHER_HMAC_SHA512:
return EVP_MD_size(EVP_sha512());
break;
default:
return 0;
}
}
static int sqlcipher_openssl_ctx_init(void **ctx) {
return sqlcipher_openssl_activate(*ctx);
}
static int sqlcipher_openssl_ctx_free(void **ctx) {
return sqlcipher_openssl_deactivate(NULL);
}
static int sqlcipher_openssl_fips_status(void *ctx) {
return 0;
}
int sqlcipher_openssl_setup(sqlcipher_provider *p) {
p->init = NULL;
p->shutdown = NULL;
p->get_provider_name = sqlcipher_openssl_get_provider_name;
p->random = sqlcipher_openssl_random;
p->hmac = sqlcipher_openssl_hmac;
p->kdf = sqlcipher_openssl_kdf;
p->cipher = sqlcipher_openssl_cipher;
p->get_cipher = sqlcipher_openssl_get_cipher;
p->get_key_sz = sqlcipher_openssl_get_key_sz;
p->get_iv_sz = sqlcipher_openssl_get_iv_sz;
p->get_block_sz = sqlcipher_openssl_get_block_sz;
p->get_hmac_sz = sqlcipher_openssl_get_hmac_sz;
p->ctx_init = sqlcipher_openssl_ctx_init;
p->ctx_free = sqlcipher_openssl_ctx_free;
p->add_random = sqlcipher_openssl_add_random;
p->fips_status = sqlcipher_openssl_fips_status;
p->get_provider_version = sqlcipher_openssl_get_provider_version;
return SQLITE_OK;
}
#endif
#endif
/* END SQLCIPHER */