#ifndef SQLITE3MC_H_
#define SQLITE3MC_H_
#include "sqlite3mc_version.h"
#include "sqlite3.h"
#ifdef SQLITE_USER_AUTHENTICATION
#include "sqlite3userauth.h"
#endif
#define CODEC_TYPE_UNKNOWN 0
#define CODEC_TYPE_AES128 1
#define CODEC_TYPE_AES256 2
#define CODEC_TYPE_CHACHA20 3
#define CODEC_TYPE_SQLCIPHER 4
#define CODEC_TYPE_RC4 5
#define CODEC_TYPE_ASCON128 6
#define CODEC_TYPE_MAX_BUILTIN 6
#if SQLITE_OS_WIN == 1
#ifdef __cplusplus
extern "C" {
#endif
SQLITE_API int sqlite3_win32_set_directory(unsigned long type, void* zValue);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
SQLITE_API int sqlite3_key(sqlite3* db, const void* pKey, int nKey);
SQLITE_API int sqlite3_key_v2(sqlite3* db, const char* zDbName, const void* pKey, int nKey);
SQLITE_API int sqlite3_rekey(sqlite3* db, const void* pKey, int nKey);
SQLITE_API int sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* pKey, int nKey);
SQLITE_API void sqlite3_activate_see(const char* zPassPhrase);
SQLITE_API int sqlite3mc_cipher_count();
SQLITE_API int sqlite3mc_cipher_index(const char* cipherName);
SQLITE_API const char* sqlite3mc_cipher_name(int cipherIndex);
SQLITE_API int sqlite3mc_config(sqlite3* db, const char* paramName, int newValue);
SQLITE_API int sqlite3mc_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
SQLITE_API unsigned char* sqlite3mc_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
SQLITE_API const char* sqlite3mc_version();
#ifdef SQLITE3MC_WXSQLITE3_COMPATIBLE
SQLITE_API int wxsqlite3_config(sqlite3* db, const char* paramName, int newValue);
SQLITE_API int wxsqlite3_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
SQLITE_API unsigned char* wxsqlite3_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
#endif
typedef struct _CipherParams
{
char* m_name;
int m_value;
int m_default;
int m_minValue;
int m_maxValue;
} CipherParams;
typedef struct BtShared BtSharedMC;
typedef void* (*AllocateCipher_t)(sqlite3* db);
typedef void (*FreeCipher_t)(void* cipher);
typedef void (*CloneCipher_t)(void* cipherTo, void* cipherFrom);
typedef int (*GetLegacy_t)(void* cipher);
typedef int (*GetPageSize_t)(void* cipher);
typedef int (*GetReserved_t)(void* cipher);
typedef unsigned char* (*GetSalt_t)(void* cipher);
typedef void (*GenerateKey_t)(void* cipher, BtSharedMC* pBt, char* userPassword, int passwordLength, int rekey, unsigned char* cipherSalt);
typedef int (*EncryptPage_t)(void* cipher, int page, unsigned char* data, int len, int reserved);
typedef int (*DecryptPage_t)(void* cipher, int page, unsigned char* data, int len, int reserved, int hmacCheck);
typedef struct _CipherDescriptor
{
char* m_name;
AllocateCipher_t m_allocateCipher;
FreeCipher_t m_freeCipher;
CloneCipher_t m_cloneCipher;
GetLegacy_t m_getLegacy;
GetPageSize_t m_getPageSize;
GetReserved_t m_getReserved;
GetSalt_t m_getSalt;
GenerateKey_t m_generateKey;
EncryptPage_t m_encryptPage;
DecryptPage_t m_decryptPage;
} CipherDescriptor;
SQLITE_API int sqlite3mc_register_cipher(const CipherDescriptor* desc, const CipherParams* params, int makeDefault);
#ifdef __cplusplus
}
#endif
#include "sqlite3mc_vfs.h"
#endif