Skip to content

Commit

Permalink
Prepare release of wxSQLite3 4.9.8
Browse files Browse the repository at this point in the history
- Update to SQLite3 Multiple Ciphers 1.8.0 (based on SQLite 3.44.1)
- Added new cipher scheme Ascon-128 (Lightweight Authenticated Encryption)
  • Loading branch information
utelle committed Nov 23, 2023
1 parent 2358974 commit 79a50de
Show file tree
Hide file tree
Showing 9 changed files with 2,137 additions and 125 deletions.
19 changes: 16 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dnl Copyright (C) 2017-2023 Ulrich Telle <ulrich@telle-online.de>, Vadim Zeitlin
dnl
dnl This file is covered by the same licence as the entire wxSQLite3 package.

AC_INIT([wxsqlite3], [4.9.7], [ulrich@telle-online.de])
AC_INIT([wxsqlite3], [4.9.8], [ulrich@telle-online.de])

dnl This is the version tested with, might work with earlier ones.
AC_PREREQ([2.69])
Expand Down Expand Up @@ -82,13 +82,23 @@ AC_ARG_WITH([rc4],
AS_IF([test "x$with_rc4" = xno],
[AC_DEFINE([WXSQLITE3_HAVE_CIPHER_RC4], [0], [Define if you have RC4 disabled])])

AC_ARG_WITH([ascon128],
[AS_HELP_STRING([--without-ascon128],
[Disable support for Ascon 128 Encryption])],
[],
[with_ascon128=yes])

AS_IF([test "x$with_ascon128" = xno],
[AC_DEFINE([WXSQLITE3_HAVE_CIPHER_ASCON128], [0], [Define if you have Ascon 128 disabled])])

AC_ARG_ENABLE(codec,
[ --enable-codec[=<codec type>] Specify the codec type:
aes128: AES 128 Bit CBC Encryption
aes256: AES 256 Bit CBC Encryption
chacha20 [default]: ChaCha20-Poly1305 Encryption
sqlcipher: SQLCipher Encryption
rc4: RC4 Encryption],
rc4: RC4 Encryption
ascon128: Ascon 128 Encryption],
[if test "x$enableval" = "xaes128" && test "x$with_aes128cbc" = xyes ; then
codec_type=CODEC_TYPE_AES128
elif test "x$enableval" = "xaes256" && test "x$with_aes256cbc" = xyes ; then
Expand All @@ -99,6 +109,8 @@ AC_ARG_ENABLE(codec,
codec_type=CODEC_TYPE_SQLCIPHER
elif test "x$enableval" = "xrc4" && test "x$with_rc4" = xyes ; then
codec_type=CODEC_TYPE_RC4
elif test "x$enableval" = "xascon128" && test "x$with_ascon128" = xyes ; then
codec_type=CODEC_TYPE_ASCON128
else
echo
echo "Error!"
Expand All @@ -112,7 +124,8 @@ AS_IF([test "x$with_aes128cbc" = xno &&
test "x$with_aes256cbc" = xno &&
test "x$with_chacha20" = xno &&
test "x$with_sqlcipher" = xno &&
test "x$with_rc4" = xno],
test "x$with_rc4" = xno &&
test "x$with_ascon128" = xno],
[AC_DEFINE([WXSQLITE3_HAVE_CODEC], [0], [All ciphers disabled so encryption is disabled])])

dnl We only need the libraries above for the main library itself, but the
Expand Down
71 changes: 70 additions & 1 deletion include/wx/wxsqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ enum wxSQLite3CipherType
WXSQLITE_CIPHER_AES256,
WXSQLITE_CIPHER_CHACHA20,
WXSQLITE_CIPHER_SQLCIPHER,
WXSQLITE_CIPHER_RC4
WXSQLITE_CIPHER_RC4,
WXSQLITE_CIPHER_ASCON128
};

#define WXSQLITE_ERROR 1000
Expand Down Expand Up @@ -133,6 +134,7 @@ enum wxSQLite3StatementStatus
#define WXSQLITE_DIRECTONLY 0x000080000
#define WXSQLITE_SUBTYPE 0x000100000
#define WXSQLITE_INNOCUOUS 0x000200000
#define WXSQLITE_RESULT_SUBTYPE 0x001000000

inline void operator++(wxSQLite3LimitType& value)
{
Expand Down Expand Up @@ -1221,6 +1223,73 @@ class WXDLLIMPEXP_SQLITE3 wxSQLite3CipherRC4 : public wxSQLite3Cipher
bool m_legacy; ///< Flag for legacy mode
};

/// Cipher class representing Ascon-128 encryption with Ascon tag
class WXDLLIMPEXP_SQLITE3 wxSQLite3CipherAscon128 : public wxSQLite3Cipher
{
public:
/// Constructor
wxSQLite3CipherAscon128();

/// Copy constructor
wxSQLite3CipherAscon128(const wxSQLite3CipherAscon128& cipher);

/// Destructor
virtual ~wxSQLite3CipherAscon128();

/// Initialize the cipher instance based on global default settings
/**
* The parameters of the cipher instance are initialize with the global default settings of the associated cipher type.
* \return true if the cipher instance could be initialized successfully, false otherwise
*/
virtual bool InitializeFromGlobalDefault();

/// Initialize the cipher instance based on current settings
/**
* The parameters of the cipher instance are initialize with the current settings of the associated cipher type
* as defined in the given database connection.
* \param db database instance representing a database connection
* \return true if the cipher instance could be initialized successfully, false otherwise
*/
virtual bool InitializeFromCurrent(wxSQLite3Database& db);

/// Initialize the cipher instance based on current default settings
/**
* The parameters of the cipher instance are initialize with the current default settings of the associated cipher type
* as defined in the given database connection.
* \param db database instance representing a database connection
* \return true if the cipher instance could be initialized successfully, false otherwise
*/
virtual bool InitializeFromCurrentDefault(wxSQLite3Database& db);

/// Apply the cipher parameters to a database connection
/**
* The parameters of the cipher instance are applied to the given database connection.
* \param db database instance representing a database connection
* \return true if the cipher parameters could be applied successfully, false otherwise
*/
virtual bool Apply(wxSQLite3Database& db) const;
virtual bool Apply(void* dbHandle) const;

#if 0
// Currently no legacy mode available
/// Set legacy mode
void SetLegacy(bool legacy) { m_legacy = legacy; }

/// Get legacy mode
bool GetLegacy() const { return m_legacy; }
#endif

/// Set iteration count of KDF function for ordinary key
void SetKdfIter(int kdfIter) { m_kdfIter = kdfIter; }

/// Get iteration count of KDF function for ordinary key
int GetKdfIter() const { return m_kdfIter; }

private:
bool m_legacy; ///< Flag for legacy mode
int m_kdfIter; ///< Iteration count for KDF function
};


/// Interface for a user defined hook function
/**
Expand Down
4 changes: 2 additions & 2 deletions include/wx/wxsqlite3_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#define WXSQLITE3_MAJOR_VERSION 4
#define WXSQLITE3_MINOR_VERSION 9
#define WXSQLITE3_RELEASE_NUMBER 7
#define WXSQLITE3_RELEASE_NUMBER 8
#define WXSQLITE3_SUBRELEASE_NUMBER 0
#define WXSQLITE3_VERSION_STRING "wxSQLite3 4.9.7"
#define WXSQLITE3_VERSION_STRING "wxSQLite3 4.9.8"

#endif // WXSQLITE3_VERSION_H_
7 changes: 7 additions & 0 deletions include/wx/wxsqlite3def.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
<dl>
<dt><b>4.9.8</b> - <i>November 2023</i></dt>
<dd>
Upgrade to <i>SQLite3 Multiple Ciphers version 1.8.0 (SQLite version 3.44.1)</i><br>
Added new cipher scheme Ascon-128 (Lightweight Authenticated Encryption)
</dd>
<dt><b>4.9.7</b> - <i>November 2023</i></dt>
<dd>
Upgrade to <i>SQLite3 Multiple Ciphers version 1.7.4 (SQLite version 3.44.0)</i><br>
Expand Down
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Currently the following encryption schemes are supported:
- AES 256 Bit CBC - No HMAC ([wxSQLite3](https://github.com/utelle/wxsqlite3))
- ChaCha20 - Poly1305 HMAC ([sqleet](https://github.com/resilar/sqleet)) (**default**)
- AES 256 Bit CBC - SHA1/SHA256/SHA512 HMAC ([SQLCipher](https://www.zetetic.net/sqlcipher/) versions 1 - 4)
- RC4 - No HMAC ([System.Data.SQLite](http://system.data.sqlite.org/))
- RC4 - No HMAC ([System.Data.SQLite](https://system.data.sqlite.org/))
- Ascon 128 - Ascon Tag ([Ascon](https://ascon.iaik.tugraz.at/)) (since version 4.9.8)

## Important Notes

Expand All @@ -48,6 +49,9 @@ Since August 2020 a new implementation of an encryption extension, capable of su

## <a name="history"></a>Version history

* 4.9.8 - *November 2023*
- Upgrade to SQLite3 Multiple Ciphers version 1.8.0 (SQLite version 3.44.1)
- Added new cipher scheme Ascon-128 (Lightweight Authenticated Encryption)
* 4.9.7 - *November 2023*
- Upgrade to SQLite3 Multiple Ciphers version 1.7.4 (SQLite version 3.44.0)
- Prevent crashes due to uninitialized cipher tables (issue #113)
Expand Down
8 changes: 8 additions & 0 deletions samples/treeview/treeviewapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ TreeviewSampleApp::OnInit()
int
TreeviewSampleApp::OnExit()
{
try
{
m_db.Close();
}
catch (wxSQLite3Exception& e)
{
}

wxSQLite3Database::ShutdownSQLite();
return wxApp::OnExit();
}
Expand Down
Loading

0 comments on commit 79a50de

Please sign in to comment.