@@ -266377,7 +266377,7 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
266377266377** Purpose: Header file for SQLite3 Multiple Ciphers support
266378266378** Author: Ulrich Telle
266379266379** Created: 2020-03-01
266380- ** Copyright: (c) 2019-2024 Ulrich Telle
266380+ ** Copyright: (c) 2019-2026 Ulrich Telle
266381266381** License: MIT
266382266382*/
266383266383
@@ -266405,9 +266405,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
266405266405
266406266406#define SQLITE3MC_VERSION_MAJOR 2
266407266407#define SQLITE3MC_VERSION_MINOR 3
266408- #define SQLITE3MC_VERSION_RELEASE 1
266408+ #define SQLITE3MC_VERSION_RELEASE 2
266409266409#define SQLITE3MC_VERSION_SUBRELEASE 0
266410- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.1 "
266410+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.2 "
266411266411
266412266412#endif /* SQLITE3MC_VERSION_H_ */
266413266413/*** End of #include "sqlite3mc_version.h" ***/
@@ -280476,6 +280476,7 @@ SQLITE_API void sqlite3_activate_see(const char* zPassPhrase);
280476280476SQLITE_API int sqlite3mc_cipher_count();
280477280477SQLITE_API int sqlite3mc_cipher_index(const char* cipherName);
280478280478SQLITE_API const char* sqlite3mc_cipher_name(int cipherIndex);
280479+ SQLITE_API int sqlite3mc_cipher_name_copy(int cipherIndex, char* cipherName, int maxCipherNameSize);
280479280480SQLITE_API int sqlite3mc_config(sqlite3* db, const char* paramName, int newValue);
280480280481SQLITE_API int sqlite3mc_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
280481280482SQLITE_API unsigned char* sqlite3mc_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
@@ -286409,7 +286410,7 @@ void RijndaelInvalidate(Rijndael* rijndael)
286409286410/*
286410286411** Name: libaegis.c
286411286412** Purpose: Amalgamation of the AEGIS library
286412- ** Copyright: (c) 2024-2025 Ulrich Telle
286413+ ** Copyright: (c) 2024-2026 Ulrich Telle
286413286414** SPDX-License-Identifier: MIT
286414286415*/
286415286416
@@ -286424,6 +286425,63 @@ void RijndaelInvalidate(Rijndael* rijndael)
286424286425#define AEGIS_PRIVATE static
286425286426#endif
286426286427
286428+ /* Namespacing to avoid conflicts with libsodium 1.0.21+ */
286429+
286430+ /* Base Implementation Structs */
286431+ #define aegis128l_implementation sqlite3mc_aegis128l_implementation
286432+ #define aegis128lx2_implementation sqlite3mc_aegis128lx2_implementation
286433+ #define aegis128lx4_implementation sqlite3mc_aegis128lx4_implementation
286434+ #define aegis256_implementation sqlite3mc_aegis256_implementation
286435+ #define aegis256x2_implementation sqlite3mc_aegis256x2_implementation
286436+ #define aegis256x4_implementation sqlite3mc_aegis256x4_implementation
286437+
286438+ /* Variants without hardware acceleration */
286439+ #define aegis128l_soft_implementation sqlite3mc_aegis128l_soft_implementation
286440+ #define aegis128x2_soft_implementation sqlite3mc_aegis128x2_soft_implementation
286441+ #define aegis128x4_soft_implementation sqlite3mc_aegis128x4_soft_implementation
286442+ #define aegis256_soft_implementation sqlite3mc_aegis256_soft_implementation
286443+ #define aegis256x2_soft_implementation sqlite3mc_aegis256x2_soft_implementation
286444+ #define aegis256x4_soft_implementation sqlite3mc_aegis256x4_soft_implementation
286445+
286446+ #define softaes_block_encrypt sqlite3mc_softaes_block_encrypt
286447+
286448+ /* Variants with support for AES and AVX instruction sets */
286449+ #define aegis128l_aesni_implementation sqlite3mc_aegis128l_aesni_implementation
286450+ #define aegis128x2_aesni_implementation sqlite3mc_aegis128x2_aesni_implementation
286451+ #define aegis128x4_aesni_implementation sqlite3mc_aegis128x4_aesni_implementation
286452+ #define aegis256_aesni_implementation sqlite3mc_aegis256_aesni_implementation
286453+ #define aegis256x2_aesni_implementation sqlite3mc_aegis256x2_aesni_implementation
286454+ #define aegis256x4_aesni_implementation sqlite3mc_aegis256x4_aesni_implementation
286455+
286456+ /* Variants with support for VAES and AVX2 instruction sets */
286457+ #define aegis128x2_avx2_implementation sqlite3mc_aegis128x2_avx2_implementation
286458+ #define aegis128x4_avx2_implementation sqlite3mc_aegis128x4_avx2_implementation
286459+ #define aegis256x2_avx2_implementation sqlite3mc_aegis256x2_avx2_implementation
286460+ #define aegis256x4_avx2_implementation sqlite3mc_aegis256x4_avx2_implementation
286461+
286462+ /* Variants with support for AVX512F instruction sets */
286463+ #define aegis128x4_avx512_implementation sqlite3mc_aegis128x4_avx512_implementation
286464+ #define aegis256x4_avx512_implementation sqlite3mc_aegis256x4_avx512_implementation
286465+
286466+ /* Variants with support for AltiVec instruction sets */
286467+ #define aegis128l_altivec_implementation sqlite3mc_aegis128l_altivec_implementation
286468+ #define aegis128x2_altivec_implementation sqlite3mc_aegis128x2_altivec_implementation
286469+ #define aegis128x4_altivec_implementation sqlite3mc_aegis128x4_altivec_implementation
286470+ #define aegis256_altivec_implementation sqlite3mc_aegis256_altivec_implementation
286471+ #define aegis256x2_altivec_implementation sqlite3mc_aegis256x2_altivec_implementation
286472+ #define aegis256x4_altivec_implementation sqlite3mc_aegis256x4_altivec_implementation
286473+
286474+ /* Variants with support for ARM Neon instruction sets */
286475+ #define aegis128l_armcrypto_implementation sqlite3mc_aegis128l_armcrypto_implementation
286476+ #define aegis128x2_armcrypto_implementation sqlite3mc_aegis128x2_armcrypto_implementation
286477+ #define aegis128x4_armcrypto_implementation sqlite3mc_aegis128x4_armcrypto_implementation
286478+ #define aegis256_armcrypto_implementation sqlite3mc_aegis256_armcrypto_implementation
286479+ #define aegis256x2_armcrypto_implementation sqlite3mc_aegis256x2_armcrypto_implementation
286480+ #define aegis256x4_armcrypto_implementation sqlite3mc_aegis256x4_armcrypto_implementation
286481+
286482+ /* Internal Tables (can conflict under -flto) */
286483+ #define _aes_lut sqlite3mc_aegis_aes_lut
286484+
286427286485/* #include "common/cpu.h" */
286428286486/*** Begin of #include "common/cpu.h" ***/
286429286487/*
@@ -307708,12 +307766,10 @@ extern struct aegis128x4_implementation aegis128x4_avx512_implementation;
307708307766#ifdef HAVE_VAESINTRIN_H
307709307767
307710307768#ifdef __clang__
307711- # if __clang_major__ >= 18
307712- # pragma clang attribute push(__attribute__((target("vaes,avx512f,evex512"))), \
307713- apply_to = function)
307769+ # if __clang_major__ >= 18 && __clang_major__ < 22
307770+ # pragma clang attribute push(__attribute__((target("aes,vaes,avx512f,evex512"))), apply_to=function)
307714307771# else
307715- # pragma clang attribute push(__attribute__((target("vaes,avx512f"))), \
307716- apply_to = function)
307772+ # pragma clang attribute push(__attribute__((target("aes,vaes,avx512f"))), apply_to=function)
307717307773# endif
307718307774#elif defined(__GNUC__)
307719307775# pragma GCC target("vaes,avx512f")
@@ -308855,12 +308911,10 @@ extern struct aegis256x4_implementation aegis256x4_avx512_implementation;
308855308911#ifdef HAVE_VAESINTRIN_H
308856308912
308857308913#ifdef __clang__
308858- # if __clang_major__ >= 18
308859- # pragma clang attribute push(__attribute__((target("vaes,avx512f,evex512"))), \
308860- apply_to = function)
308914+ # if __clang_major__ >= 18 && __clang_major__ < 22
308915+ # pragma clang attribute push(__attribute__((target("vaes,avx512f,evex512"))), apply_to=function)
308861308916# else
308862- # pragma clang attribute push(__attribute__((target("vaes,avx512f"))), \
308863- apply_to = function)
308917+ # pragma clang attribute push(__attribute__((target("vaes,avx512f"))), apply_to=function)
308864308918# endif
308865308919#elif defined(__GNUC__)
308866308920# pragma GCC target("vaes,avx512f")
@@ -333299,7 +333353,7 @@ sqlite3mcConfigureSQLCipherVersion(sqlite3* db, int configDefault, int legacyVer
333299333353** Purpose: Configuration of SQLite codecs
333300333354** Author: Ulrich Telle
333301333355** Created: 2020-03-02
333302- ** Copyright: (c) 2006-2024 Ulrich Telle
333356+ ** Copyright: (c) 2006-2026 Ulrich Telle
333303333357** License: MIT
333304333358*/
333305333359
@@ -333481,18 +333535,17 @@ sqlite3mc_cipher_index(const char* cipherName)
333481333535 return (j < count && globalCodecDescriptorTable[j].m_name[0] != 0) ? j + 1 : -1;
333482333536}
333483333537
333484- SQLITE_API const char*
333485- sqlite3mc_cipher_name (int cipherIndex)
333538+ static const char*
333539+ sqlite3mcFindCipherName (int cipherIndex)
333486333540{
333487- static char cipherName[CIPHER_NAME_MAXLEN] = "" ;
333541+ const char* cipherName = NULL ;
333488333542 int count;
333489333543 int j;
333490333544#ifndef SQLITE_OMIT_AUTOINIT
333491- if( sqlite3_initialize() ) return cipherName ;
333545+ if ( sqlite3_initialize()) return NULL ;
333492333546#endif
333493333547 count = sqlite3mcGetGlobalCipherCount();
333494333548 j = 0;
333495- cipherName[0] = '\0';
333496333549 if (cipherIndex > 0 && cipherIndex <= count)
333497333550 {
333498333551 for (j = 0; j < count && globalCodecDescriptorTable[j].m_name[0] != 0; ++j)
@@ -333501,13 +333554,57 @@ sqlite3mc_cipher_name(int cipherIndex)
333501333554 }
333502333555 if (j < count && globalCodecDescriptorTable[j].m_name[0] != 0)
333503333556 {
333504- strncpy(cipherName, globalCodecDescriptorTable[j].m_name, CIPHER_NAME_MAXLEN - 1);
333505- cipherName[CIPHER_NAME_MAXLEN - 1] = '\0';
333557+ cipherName = globalCodecDescriptorTable[j].m_name;
333506333558 }
333507333559 }
333508333560 return cipherName;
333509333561}
333510333562
333563+ SQLITE_API const char*
333564+ sqlite3mc_cipher_name(int cipherIndex)
333565+ {
333566+ static char cipherName[CIPHER_NAME_MAXLEN] = "";
333567+ const char* globalCipherName = sqlite3mcFindCipherName(cipherIndex);
333568+ if (globalCipherName)
333569+ {
333570+ strncpy(cipherName, globalCipherName, CIPHER_NAME_MAXLEN - 1);
333571+ cipherName[CIPHER_NAME_MAXLEN - 1] = '\0';
333572+ }
333573+ else
333574+ {
333575+ cipherName[0] = '\0';
333576+ }
333577+ return cipherName;
333578+ }
333579+
333580+ SQLITE_API int
333581+ sqlite3mc_cipher_name_copy(int cipherIndex, char* cipherName, int maxCipherNameSize)
333582+ {
333583+ int ok = 1;
333584+ const char* globalCipherName = sqlite3mcFindCipherName(cipherIndex);
333585+ if (globalCipherName)
333586+ {
333587+ int cipherNameLen = (int)strlen(globalCipherName) + 1;
333588+ if (maxCipherNameSize >= cipherNameLen)
333589+ {
333590+ strncpy(cipherName, globalCipherName, maxCipherNameSize - 1);
333591+ cipherName[maxCipherNameSize - 1] = '\0';
333592+ }
333593+ else
333594+ {
333595+ /* Buffer too small, return negative value of minimum required buffer length */
333596+ ok = -cipherNameLen;
333597+ }
333598+ }
333599+ else
333600+ {
333601+ /* Invalid index */
333602+ cipherName[0] = '\0';
333603+ ok = 0;
333604+ }
333605+ return ok;
333606+ }
333607+
333511333608static
333512333609int checkParameterValue(const char* paramName, int value, const char* cipherName)
333513333610{
@@ -334051,16 +334148,16 @@ sqlite3mcConfigureFromUri(sqlite3* db, const char* zDbName, int configDefault)
334051334148 {
334052334149 /* Check whether cipher is specified */
334053334150 const char* cipherName = sqlite3_uri_parameter(dbFileName, "cipher");
334054- if (cipherName == NULL)
334151+ if (cipherName == NULL || cipherName[0] == 0 )
334055334152 {
334056334153 int defaultCipherIndex = sqlite3mc_config(db, "cipher", -1);
334057334154 if (defaultCipherIndex > 0)
334058334155 {
334059- cipherName = sqlite3mc_cipher_name (defaultCipherIndex);
334156+ cipherName = sqlite3mcFindCipherName (defaultCipherIndex);
334060334157 sqlite3mc_config(db, "cipher", defaultCipherIndex);
334061334158 }
334062334159 }
334063- if (cipherName != NULL)
334160+ if (cipherName != NULL && cipherName[0] != 0 )
334064334161 {
334065334162 int j = 0;
334066334163 CipherParams* cipherParams = NULL;
0 commit comments