#include "aes/aes.h"
#include "md5/md5.h"
#include "src/sqlite3.c"
#define SQLITECRYPTERROR_PROVIDER "Cryptographic provider not available"
typedef unsigned char byte_t;
struct CryptBlock
{
void* pBuffer;
int bufSize;
AES_KEY key;
int need_key;
};
const byte_t g_ivec[] = {
0x05,0x66,0xfa,0xa4,
0x32,0x4f,0x1f,0xa2,
0x34,0x67,0x33,0x9b,
0xb6,0x7e,0x3d,0xc2
};
const byte_t g_ecount[] = {
0xa1,0xc6,0x4a,0x74,
0x3d,0xc7,0x8e,0x54,
0x91,0xce,0xe3,0xbc,
0xc2,0xa2,0xd3,0xb9
};
static void * sqlite3pager_get_codecarg(Pager *pPager)
{
return (pPager->xCodec) ? pPager->pCodec : NULL;
}
static int create_aes_key(char* pKey,int nKey,AES_KEY* paKey)
{
byte_t aes_key[MD5_DIGEST_LENGTH];
MD5_CTX ctx;
memset(aes_key,0,MD5_DIGEST_LENGTH);
MD5_Init(&ctx);
MD5_Update(&ctx,pKey,nKey);
MD5_Final(aes_key,&ctx);
return AES_set_encrypt_key(aes_key,KEY_128,paKey);
}
static void encrypt(void* data,struct CryptBlock* pBlock)
{
size_t nPageSize = 0;
byte_t iv[AES_BLOCK_SIZE];
byte_t ecount_buf[AES_BLOCK_SIZE];
int num = 0;
if (!pBlock->need_key) return;
memcpy(iv,
#include "md5/md5.h"
#include "src/sqlite3.c"
#define SQLITECRYPTERROR_PROVIDER "Cryptographic provider not available"
typedef unsigned char byte_t;
struct CryptBlock
{
void* pBuffer;
int bufSize;
AES_KEY key;
int need_key;
};
const byte_t g_ivec[] = {
0x05,0x66,0xfa,0xa4,
0x32,0x4f,0x1f,0xa2,
0x34,0x67,0x33,0x9b,
0xb6,0x7e,0x3d,0xc2
};
const byte_t g_ecount[] = {
0xa1,0xc6,0x4a,0x74,
0x3d,0xc7,0x8e,0x54,
0x91,0xce,0xe3,0xbc,
0xc2,0xa2,0xd3,0xb9
};
static void * sqlite3pager_get_codecarg(Pager *pPager)
{
return (pPager->xCodec) ? pPager->pCodec : NULL;
}
static int create_aes_key(char* pKey,int nKey,AES_KEY* paKey)
{
byte_t aes_key[MD5_DIGEST_LENGTH];
MD5_CTX ctx;
memset(aes_key,0,MD5_DIGEST_LENGTH);
MD5_Init(&ctx);
MD5_Update(&ctx,pKey,nKey);
MD5_Final(aes_key,&ctx);
return AES_set_encrypt_key(aes_key,KEY_128,paKey);
}
static void encrypt(void* data,struct CryptBlock* pBlock)
{
size_t nPageSize = 0;
byte_t iv[AES_BLOCK_SIZE];
byte_t ecount_buf[AES_BLOCK_SIZE];
int num = 0;
if (!pBlock->need_key) return;
memcpy(iv,