Pull crypto_openssl into Makefile.in for building

This commit is contained in:
Nick Parker 2013-05-29 15:10:48 -05:00
parent 1bc791708a
commit f413acf207
4 changed files with 63 additions and 3 deletions

View File

@ -140,7 +140,9 @@ CRYPTOLIBOBJ = \
CRYPTOSRC = \
$(TOP)/src/crypto.h \
$(TOP)/src/crypto.c \
$(TOP)/src/crypto_impl.c
$(TOP)/src/crypto_impl.h \
$(TOP)/src/crypto_impl.c \
$(TOP)/src/crypto_openssl.c
# END CRYPTO

View File

@ -36,6 +36,7 @@
#include "sqliteInt.h"
#include "btreeInt.h"
#include "crypto.h"
#include "crypto_impl.h"
#ifndef OMIT_MEMLOCK
#if defined(__unix__) || defined(__APPLE__)
#include <sys/mman.h>
@ -44,8 +45,6 @@
#endif
#endif
#include "crypto_openssl.c"
/* the default implementation of SQLCipher uses a cipher_ctx
to keep track of read / write state separately. The following
struct and associated functions are defined here */

57
src/crypto_impl.h Normal file
View File

@ -0,0 +1,57 @@
/*
** SQLCipher
** crypto.h developed by Stephen Lombardo (Zetetic LLC)
** sjlombardo at zetetic dot net
** http://zetetic.net
**
** Copyright (c) 2008, 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 CRYPTO_IMPL */
#ifdef SQLITE_HAS_CODEC
#ifndef CRYPTO_IMPL_H
#define CRYPTO_IMPL_H
void sqlcipher_activate(void *ctx);
void sqlcipher_deactivate();
int sqlcipher_random (void *buffer, int length);
int sqlcipher_hmac(unsigned char *hmac_key, int key_sz, unsigned char *in, int in_sz, unsigned char *in2, int in2_sz, unsigned char *out);
int sqlcipher_kdf(const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key);
int sqlcipher_cipher(void *ctx, int mode, unsigned char *key, int key_sz, unsigned char *iv, unsigned char *in, int in_sz, unsigned char *out);
int sqlcipher_set_cipher(void *ctx, const char *cipher_name);
const char* sqlcipher_get_cipher(void *ctx);
int sqlcipher_get_key_sz(void *ctx);
int sqlcipher_get_iv_sz(void *ctx);
int sqlcipher_get_block_sz(void *ctx);
int sqlcipher_get_hmac_sz(void *ctx);
int sqlcipher_ctx_copy(void *target_ctx, void *source_ctx);
int sqlcipher_ctx_cmp(void *c1, void *c2);
int sqlcipher_ctx_init(void **ctx);
int sqlcipher_ctx_free(void **ctx);
#endif
#endif
/* END CRYPTO_IMPL */

View File

@ -92,6 +92,7 @@ if {$addstatic} {
#
foreach hdr {
crypto.h
crypto_impl.h
btree.h
btreeInt.h
fts3.h
@ -226,6 +227,7 @@ foreach file {
crypto.c
crypto_impl.c
crypto_openssl.c
global.c
ctime.c