├── .editorconfig
├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ ├── ci4sqlite3mc.yml
│ └── codeql-analysis.yml
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CMakeLists.txt
├── LICENSE
├── LICENSE.spdx
├── Makefile.am
├── admin
├── build-aux
│ ├── compile
│ ├── config.guess
│ ├── config.sub
│ ├── depcomp
│ ├── install-sh
│ ├── ltmain.sh
│ └── missing
├── m4
│ ├── libtool.m4
│ ├── ltoptions.m4
│ ├── ltsugar.m4
│ ├── ltversion.m4
│ ├── lt~obsolete.m4
│ └── wxwin.m4
└── travis
│ └── before_install.sh
├── build
├── Makefile
├── config.gcc
├── sqlite3mc_dll.make
├── sqlite3mc_dllicu.make
├── sqlite3mc_lib.make
├── sqlite3mc_libicu.make
├── sqlite3mc_shell.make
├── sqlite3mc_shellicu.make
├── sqlite3mc_vc10.sln
├── sqlite3mc_vc10_dll.vcxproj
├── sqlite3mc_vc10_dll.vcxproj.filters
├── sqlite3mc_vc10_dllicu.vcxproj
├── sqlite3mc_vc10_dllicu.vcxproj.filters
├── sqlite3mc_vc10_lib.vcxproj
├── sqlite3mc_vc10_lib.vcxproj.filters
├── sqlite3mc_vc10_libicu.vcxproj
├── sqlite3mc_vc10_libicu.vcxproj.filters
├── sqlite3mc_vc10_shell.vcxproj
├── sqlite3mc_vc10_shell.vcxproj.filters
├── sqlite3mc_vc10_shellicu.vcxproj
├── sqlite3mc_vc10_shellicu.vcxproj.filters
├── sqlite3mc_vc11.sln
├── sqlite3mc_vc11_dll.vcxproj
├── sqlite3mc_vc11_dll.vcxproj.filters
├── sqlite3mc_vc11_dllicu.vcxproj
├── sqlite3mc_vc11_dllicu.vcxproj.filters
├── sqlite3mc_vc11_lib.vcxproj
├── sqlite3mc_vc11_lib.vcxproj.filters
├── sqlite3mc_vc11_libicu.vcxproj
├── sqlite3mc_vc11_libicu.vcxproj.filters
├── sqlite3mc_vc11_shell.vcxproj
├── sqlite3mc_vc11_shell.vcxproj.filters
├── sqlite3mc_vc11_shellicu.vcxproj
├── sqlite3mc_vc11_shellicu.vcxproj.filters
├── sqlite3mc_vc12.sln
├── sqlite3mc_vc12_dll.vcxproj
├── sqlite3mc_vc12_dll.vcxproj.filters
├── sqlite3mc_vc12_dllicu.vcxproj
├── sqlite3mc_vc12_dllicu.vcxproj.filters
├── sqlite3mc_vc12_lib.vcxproj
├── sqlite3mc_vc12_lib.vcxproj.filters
├── sqlite3mc_vc12_libicu.vcxproj
├── sqlite3mc_vc12_libicu.vcxproj.filters
├── sqlite3mc_vc12_shell.vcxproj
├── sqlite3mc_vc12_shell.vcxproj.filters
├── sqlite3mc_vc12_shellicu.vcxproj
├── sqlite3mc_vc12_shellicu.vcxproj.filters
├── sqlite3mc_vc14.sln
├── sqlite3mc_vc14_dll.vcxproj
├── sqlite3mc_vc14_dll.vcxproj.filters
├── sqlite3mc_vc14_dllicu.vcxproj
├── sqlite3mc_vc14_dllicu.vcxproj.filters
├── sqlite3mc_vc14_lib.vcxproj
├── sqlite3mc_vc14_lib.vcxproj.filters
├── sqlite3mc_vc14_libicu.vcxproj
├── sqlite3mc_vc14_libicu.vcxproj.filters
├── sqlite3mc_vc14_shell.vcxproj
├── sqlite3mc_vc14_shell.vcxproj.filters
├── sqlite3mc_vc14_shellicu.vcxproj
├── sqlite3mc_vc14_shellicu.vcxproj.filters
├── sqlite3mc_vc15.sln
├── sqlite3mc_vc15_dll.vcxproj
├── sqlite3mc_vc15_dll.vcxproj.filters
├── sqlite3mc_vc15_dllicu.vcxproj
├── sqlite3mc_vc15_dllicu.vcxproj.filters
├── sqlite3mc_vc15_lib.vcxproj
├── sqlite3mc_vc15_lib.vcxproj.filters
├── sqlite3mc_vc15_libicu.vcxproj
├── sqlite3mc_vc15_libicu.vcxproj.filters
├── sqlite3mc_vc15_shell.vcxproj
├── sqlite3mc_vc15_shell.vcxproj.filters
├── sqlite3mc_vc15_shellicu.vcxproj
├── sqlite3mc_vc15_shellicu.vcxproj.filters
├── sqlite3mc_vc16.sln
├── sqlite3mc_vc16_dll.vcxproj
├── sqlite3mc_vc16_dll.vcxproj.filters
├── sqlite3mc_vc16_dllicu.vcxproj
├── sqlite3mc_vc16_dllicu.vcxproj.filters
├── sqlite3mc_vc16_lib.vcxproj
├── sqlite3mc_vc16_lib.vcxproj.filters
├── sqlite3mc_vc16_libicu.vcxproj
├── sqlite3mc_vc16_libicu.vcxproj.filters
├── sqlite3mc_vc16_shell.vcxproj
├── sqlite3mc_vc16_shell.vcxproj.filters
├── sqlite3mc_vc16_shellicu.vcxproj
├── sqlite3mc_vc16_shellicu.vcxproj.filters
├── sqlite3mc_vc17.sln
├── sqlite3mc_vc17_dll.vcxproj
├── sqlite3mc_vc17_dll.vcxproj.filters
├── sqlite3mc_vc17_dllicu.vcxproj
├── sqlite3mc_vc17_dllicu.vcxproj.filters
├── sqlite3mc_vc17_lib.vcxproj
├── sqlite3mc_vc17_lib.vcxproj.filters
├── sqlite3mc_vc17_libicu.vcxproj
├── sqlite3mc_vc17_libicu.vcxproj.filters
├── sqlite3mc_vc17_shell.vcxproj
├── sqlite3mc_vc17_shell.vcxproj.filters
├── sqlite3mc_vc17_shellicu.vcxproj
├── sqlite3mc_vc17_shellicu.vcxproj.filters
└── wx_setup.props
├── conan
├── all
│ ├── conandata.yml
│ ├── conanfile.py
│ └── test_package
│ │ ├── CMakeLists.txt
│ │ ├── conanfile.py
│ │ └── main.c
└── config.yml
├── configure.ac
├── premake5.lua
├── readme.md
├── scripts
├── amalgamate.py
├── patchshell.sh
├── patchsqlite3.sh
├── rekeyvacuum.sh
├── sqlite3mc.c.json
└── sqlite3mc.h.json
├── sqlite3mc.pc.in
├── src
├── aegis
│ ├── aegis128l
│ │ ├── aegis128l.c
│ │ ├── aegis128l_aesni.c
│ │ ├── aegis128l_aesni.h
│ │ ├── aegis128l_altivec.c
│ │ ├── aegis128l_altivec.h
│ │ ├── aegis128l_armcrypto.c
│ │ ├── aegis128l_armcrypto.h
│ │ ├── aegis128l_common.h
│ │ ├── aegis128l_soft.c
│ │ ├── aegis128l_soft.h
│ │ └── implementations.h
│ ├── aegis128x2
│ │ ├── aegis128x2.c
│ │ ├── aegis128x2_aesni.c
│ │ ├── aegis128x2_aesni.h
│ │ ├── aegis128x2_altivec.c
│ │ ├── aegis128x2_altivec.h
│ │ ├── aegis128x2_armcrypto.c
│ │ ├── aegis128x2_armcrypto.h
│ │ ├── aegis128x2_avx2.c
│ │ ├── aegis128x2_avx2.h
│ │ ├── aegis128x2_common.h
│ │ ├── aegis128x2_soft.c
│ │ ├── aegis128x2_soft.h
│ │ └── implementations.h
│ ├── aegis128x4
│ │ ├── aegis128x4.c
│ │ ├── aegis128x4_aesni.c
│ │ ├── aegis128x4_aesni.h
│ │ ├── aegis128x4_altivec.c
│ │ ├── aegis128x4_altivec.h
│ │ ├── aegis128x4_armcrypto.c
│ │ ├── aegis128x4_armcrypto.h
│ │ ├── aegis128x4_avx2.c
│ │ ├── aegis128x4_avx2.h
│ │ ├── aegis128x4_avx512.c
│ │ ├── aegis128x4_avx512.h
│ │ ├── aegis128x4_common.h
│ │ ├── aegis128x4_soft.c
│ │ ├── aegis128x4_soft.h
│ │ └── implementations.h
│ ├── aegis256
│ │ ├── aegis256.c
│ │ ├── aegis256_aesni.c
│ │ ├── aegis256_aesni.h
│ │ ├── aegis256_altivec.c
│ │ ├── aegis256_altivec.h
│ │ ├── aegis256_armcrypto.c
│ │ ├── aegis256_armcrypto.h
│ │ ├── aegis256_common.h
│ │ ├── aegis256_soft.c
│ │ ├── aegis256_soft.h
│ │ └── implementations.h
│ ├── aegis256x2
│ │ ├── aegis256x2.c
│ │ ├── aegis256x2_aesni.c
│ │ ├── aegis256x2_aesni.h
│ │ ├── aegis256x2_altivec.c
│ │ ├── aegis256x2_altivec.h
│ │ ├── aegis256x2_armcrypto.c
│ │ ├── aegis256x2_armcrypto.h
│ │ ├── aegis256x2_avx2.c
│ │ ├── aegis256x2_avx2.h
│ │ ├── aegis256x2_common.h
│ │ ├── aegis256x2_soft.c
│ │ ├── aegis256x2_soft.h
│ │ └── implementations.h
│ ├── aegis256x4
│ │ ├── aegis256x4.c
│ │ ├── aegis256x4_aesni.c
│ │ ├── aegis256x4_aesni.h
│ │ ├── aegis256x4_altivec.c
│ │ ├── aegis256x4_altivec.h
│ │ ├── aegis256x4_armcrypto.c
│ │ ├── aegis256x4_armcrypto.h
│ │ ├── aegis256x4_avx2.c
│ │ ├── aegis256x4_avx2.h
│ │ ├── aegis256x4_avx512.c
│ │ ├── aegis256x4_avx512.h
│ │ ├── aegis256x4_common.h
│ │ ├── aegis256x4_soft.c
│ │ ├── aegis256x4_soft.h
│ │ └── implementations.h
│ ├── common
│ │ ├── aeshardware.h
│ │ ├── common.c
│ │ ├── common.h
│ │ ├── cpu.c
│ │ ├── cpu.h
│ │ ├── func_names_define.h
│ │ ├── func_names_undefine.h
│ │ ├── func_table.h
│ │ ├── softaes.c
│ │ ├── softaes.h
│ │ └── type_names_undefine.h
│ ├── include
│ │ ├── aegis.h
│ │ ├── aegis128l.h
│ │ ├── aegis128x2.h
│ │ ├── aegis128x4.h
│ │ ├── aegis256.h
│ │ ├── aegis256x2.h
│ │ └── aegis256x4.h
│ └── libaegis.c
├── aes_hardware.c
├── argon2
│ ├── include
│ │ └── argon2.h
│ ├── libargon2.c
│ └── src
│ │ ├── argon2.c
│ │ ├── bench.c
│ │ ├── blake2
│ │ ├── blake2-impl.h
│ │ ├── blake2.h
│ │ ├── blake2b.c
│ │ ├── blamka-round-opt.h
│ │ └── blamka-round-ref.h
│ │ ├── core.c
│ │ ├── core.h
│ │ ├── encoding.c
│ │ ├── encoding.h
│ │ ├── genkat.c
│ │ ├── genkat.h
│ │ ├── opt.c
│ │ ├── ref.c
│ │ ├── run.c
│ │ ├── test.c
│ │ ├── thread.c
│ │ └── thread.h
├── ascon
│ ├── aead.c
│ ├── api.h
│ ├── ascon.h
│ ├── bendian.h
│ ├── config.h
│ ├── constants.h
│ ├── crypto_aead.h
│ ├── crypto_hash.h
│ ├── crypto_pbkdf2.h
│ ├── forceinline.h
│ ├── hash.c
│ ├── pbkdf2.c
│ ├── permutations.c
│ ├── permutations.h
│ ├── printstate.c
│ ├── printstate.h
│ ├── prolog.h
│ ├── round.h
│ ├── round32.h
│ ├── round64.h
│ └── word.h
├── carray.c
├── carray.h
├── chacha20poly1305.c
├── cipher_aegis.c
├── cipher_ascon.c
├── cipher_chacha20.c
├── cipher_common.c
├── cipher_common.h
├── cipher_config.c
├── cipher_config.h
├── cipher_sds_rc4.c
├── cipher_sqlcipher.c
├── cipher_wxaes128.c
├── cipher_wxaes256.c
├── codec_algos.c
├── codecext.c
├── compress.c
├── csv.c
├── extensionfunctions.c
├── fastpbkdf2.c
├── fastpbkdf2.h
├── fileio.c
├── filelist.md
├── md5.c
├── memory_secure.c
├── miniz.c
├── miniz.h
├── mystdint.h
├── regexp.c
├── rekeyvacuum.c
├── rijndael.c
├── rijndael.h
├── series.c
├── sha1.c
├── sha1.h
├── sha2.c
├── sha2.h
├── shathree.c
├── shell.c
├── sqlar.c
├── sqlite3.c
├── sqlite3.h
├── sqlite370.ico
├── sqlite3ext.h
├── sqlite3mc.c
├── sqlite3mc.def
├── sqlite3mc.h
├── sqlite3mc.rc
├── sqlite3mc_config.h
├── sqlite3mc_shell.rc
├── sqlite3mc_version.h
├── sqlite3mc_vfs.c
├── sqlite3mc_vfs.h
├── sqlite3patched.c
├── tclsqlite.c
├── test_windirent.c
├── test_windirent.h
├── uuid.c
├── vsv.c
├── zipfile.c
└── zlibwrap.h
├── test
├── sqlcipher-1.1.8-testkey.db
├── sqlcipher-2.0-be-testkey.db
├── sqlcipher-2.0-beta-testkey.db
├── sqlcipher-2.0-le-testkey.db
├── sqlcipher-3.0-testkey.db
├── sqlcipher-4.0-testkey.db
├── sqlciphertest.sql
├── test1.sql
└── test2.sql
└── wx_config.lua
/.editorconfig:
--------------------------------------------------------------------------------
1 | # This is the EditorConfig (http://editorconfig.org/) coding style file for
2 | # SQLite3 Multiple Ciphers.
3 |
4 | root = true
5 |
6 | [*]
7 | charset = utf-8
8 | end_of_line = lf
9 | insert_final_newline = true
10 | indent_style = space
11 | indent_size = 2
12 | trim_trailing_whitespace = true
13 |
14 | [makefile.*]
15 | indent_style = tab
16 | indent_size = 8
17 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set default behaviour to automatically normalize line endings.
2 | * text=auto
3 |
4 | # Source files
5 | *.cpp text
6 | *.h text
7 | *.inc text
8 | *.rc text
9 | *.lua text
10 |
11 | # Resource files
12 | *.db binary
13 | *.ico binary
14 | *.png binary
15 | *.xpm text
16 |
17 | # MSVC project files
18 | *.sln text eol=crlf
19 | *.vcxproj text eol=crlf
20 | *.props text eol=crlf
21 | *.filters text eol=crlf
22 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: ['https://www.paypal.com/donate/?hosted_button_id=3JC9PMMH8X7UN']
2 |
--------------------------------------------------------------------------------
/.github/workflows/ci4sqlite3mc.yml:
--------------------------------------------------------------------------------
1 | name: CI for SQLite3 Multiple Ciphers
2 | on:
3 | push:
4 | branches:
5 | - main
6 | - aegis
7 | - register-dynamic-cipher
8 | pull_request:
9 | branches:
10 | - main
11 |
12 | jobs:
13 | host_unix:
14 | strategy:
15 | matrix:
16 | os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
17 | cc_compiler: [gcc, clang]
18 |
19 | runs-on: ${{ matrix.os }}
20 | env:
21 | CC: ${{ matrix.cc_compiler }}
22 | steps:
23 | - name: Install dependencies (macOS)
24 | run: brew install automake
25 | if: matrix.os == 'macos-latest'
26 | - name: Checkout
27 | uses: actions/checkout@v4
28 | - name: Configure
29 | run: |
30 | autoreconf
31 | ./configure
32 | - name: Build
33 | run: |
34 | make
35 | - name: Testing
36 | run: |
37 | ./sqlite3shell test1.db3 ".read test/test1.sql"
38 | ./sqlite3shell test2.db3 ".read test/test2.sql"
39 | ./sqlite3shell dummy.db3 ".read test/sqlciphertest.sql"
40 |
41 | host_qemu:
42 | runs-on: ubuntu-24.04
43 | strategy:
44 | matrix:
45 | arch: [armv7, aarch64]
46 | cc_compiler: [gcc]
47 | steps:
48 | - name: Checkout
49 | uses: actions/checkout@v4
50 | - name: Build artifact
51 | # The Github Action for non-x86 CPU
52 | # https://github.com/uraimo/run-on-arch-action
53 | uses: uraimo/run-on-arch-action@v3
54 | with:
55 | arch: ${{ matrix.arch }}
56 | distro: ubuntu24.04
57 | env: |
58 | CC: ${{ matrix.cc_compiler }}
59 | install: |
60 | apt-get update -q -y
61 | apt-get install -q -y "${{ matrix.cc_compiler }}" make automake
62 | run: |
63 | autoreconf
64 | ./configure
65 | make
66 | ./sqlite3shell test1.db3 ".read test/test1.sql"
67 | ./sqlite3shell test2.db3 ".read test/test2.sql"
68 | ./sqlite3shell dummy.db3 ".read test/sqlciphertest.sql"
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Object files
5 | *.o
6 | *.ko
7 | *.obj
8 | *.elf
9 |
10 | # Linker output
11 | *.ilk
12 | *.map
13 | *.exp
14 |
15 | # Precompiled Headers
16 | *.gch
17 | *.pch
18 |
19 | # Libraries
20 | *.lib
21 | *.a
22 | *.la
23 | *.lo
24 |
25 | # Shared objects (inc. Windows DLLs)
26 | *.dll
27 | *.so
28 | *.so.*
29 | *.dylib
30 |
31 | # Executables
32 | *.exe
33 | *.out
34 | *.app
35 | *.i*86
36 | *.x86_64
37 | *.hex
38 |
39 | # Debug files
40 | *.dSYM/
41 | *.su
42 | *.idb
43 | *.pdb
44 |
45 | # Kernel Module Compile Results
46 | *.mod*
47 | *.cmd
48 | .tmp_versions/
49 | modules.order
50 | Module.symvers
51 | Mkfile.old
52 | dkms.conf
53 | /x64/
54 | /x86/
55 | /build/.vs/
56 | /build/sqlite3mc_vc17_lib.vcxproj.user
57 | /.vs/
58 | /build/sqlite3mc_vc17_dll.vcxproj.user
59 | /.vscode/
60 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # This is the control file for Travis continuous integration system.
2 | #
3 | # It is used automatically for the repositories on Github if it's found in the
4 | # root directory of the project.
5 | language: c
6 |
7 | # Specify the default platform.
8 | os: linux
9 | dist: xenial
10 |
11 | jobs:
12 | include:
13 | # - dist: xenial
14 | # compiler: gcc
15 | # env: WXGTK_PACKAGE=libwxgtk3.0-dev
16 | - dist: xenial
17 | compiler: gcc
18 | env: WXGTK_PACKAGE=libwxgtk3.0-dev
19 | arch: arm64
20 | # Disable OS X builds for now
21 | # - os: osx
22 | # osx_image: xcode11.4
23 | # compiler: clang
24 |
25 | branches:
26 | only:
27 | - main
28 |
29 | before_install:
30 | - autoreconf
31 |
32 | script:
33 | - set -e && echo 'Configuring...' && echo -en 'travis_fold:start:script.configure\\r'
34 | - ./configure
35 | - echo -en 'travis_fold:end:script.configure\\r'
36 | - echo 'Building...' && echo -en 'travis_fold:start:script.build\\r'
37 | - make
38 | - echo -en 'travis_fold:end:script.build\\r'
39 | - echo 'Testing...' && echo -en 'travis_fold:start:script.test\\r'
40 | - ./sqlite3shell test1.db3 ".read test/test1.sql"
41 | - ./sqlite3shell test2.db3 ".read test/test2.sql"
42 | - ./sqlite3shell dummy.db3 ".read test/sqlciphertest.sql"
43 | - echo -en 'travis_fold:end:script.test\\r'
44 |
45 | # The "set +e" is a workaround for https://github.com/travis-ci/travis-ci/issues/6522
46 |
47 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2024 Ulrich Telle
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LICENSE.spdx:
--------------------------------------------------------------------------------
1 | SPDXVersion: SPDX-2.1
2 | DataLicense: CC0-1.0
3 | PackageName: SQLite3MultipleCiphers
4 | PackageOriginator: Ulrich Telle
5 | PackageHomePage: https://github.com/utelle/SQLite3MultipleCiphers
6 | PackageLicenseDeclared: MIT
7 |
--------------------------------------------------------------------------------
/admin/m4/ltversion.m4:
--------------------------------------------------------------------------------
1 | # ltversion.m4 -- version numbers -*- Autoconf -*-
2 | #
3 | # Copyright (C) 2004 Free Software Foundation, Inc.
4 | # Written by Scott James Remnant, 2004
5 | #
6 | # This file is free software; the Free Software Foundation gives
7 | # unlimited permission to copy and/or distribute it, with or without
8 | # modifications, as long as this notice is preserved.
9 |
10 | # @configure_input@
11 |
12 | # serial 3337 ltversion.m4
13 | # This file is part of GNU Libtool
14 |
15 | m4_define([LT_PACKAGE_VERSION], [2.4.2])
16 | m4_define([LT_PACKAGE_REVISION], [1.3337])
17 |
18 | AC_DEFUN([LTVERSION_VERSION],
19 | [macro_version='2.4.2'
20 | macro_revision='1.3337'
21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
22 | _LT_DECL(, macro_revision, 0)
23 | ])
24 |
--------------------------------------------------------------------------------
/admin/travis/before_install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # This script is used in .travis.yml to install the dependencies before building.
4 | # Notice that WXGTK_PACKAGE is supposed to be defined before running it.
5 |
6 | set -e
7 |
8 | case "$TRAVIS_OS_NAME" in
9 | linux)
10 | sudo apt-get -qq update
11 | sudo apt-get install -y $WXGTK_PACKAGE
12 | ;;
13 |
14 | osx)
15 | brew update
16 | brew install wxmac
17 | ;;
18 |
19 | *)
20 | echo "Add commands to install wxWidgets on this platform!"
21 | exit 1
22 | ;;
23 | esac
24 |
--------------------------------------------------------------------------------
/build/config.gcc:
--------------------------------------------------------------------------------
1 | # =====================================================================
2 | # Configuration file for gcc builds
3 | # =====================================================================
4 |
5 | # Set default compilers
6 | CC = gcc
7 | CXX = g++
8 |
9 | # Codec type of encryption extension
10 | # Allowed values: CODEC_TYPE_AES128,
11 | # CODEC_TYPE_AES256,
12 | # CODEC_TYPE_CHACHA20,
13 | # CODEC_TYPE_SQLCIPHER,
14 | # CODEC_TYPE_RC4
15 | # Default codec type is CODEC_TYPE_CHACHA20
16 | CODEC_TYPE ?= CODEC_TYPE_CHACHA20
17 |
18 | # Enable SQLite debug assertions (Default: 0)
19 | # Set to 1 to enable
20 | SQLITE_ENABLE_DEBUG ?= 0
21 |
22 | # Use ZLIB drop-in replacement MINIZ (Default: 0)
23 | # Set to 1 to use MINIZ
24 | SQLITE3MC_USE_MINIZ ?= 0
25 |
26 | # Add PRAGMA memory_security (Default: 0)
27 | # Set to 1 to enable the PRAGMA
28 | SQLITE3MC_SECURE_MEMORY ?= 0
29 |
30 | ### Configuration dependent settings
31 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc10_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc10_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc10_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc10_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc10_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc10_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc11_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc11_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc11_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc11_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc11_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc11_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc12_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc12_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc12_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc12_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc12_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc12_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc14_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc14_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc14_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc14_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc14_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc14_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc15_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc15_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc15_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc15_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc15_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc15_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc16_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc16_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc16_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc16_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc16_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc16_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc17_dll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc17_dllicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
70 |
71 | Source Files
72 |
73 |
74 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc17_lib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc17_libicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 | Header Files
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 |
65 |
66 | Source Files
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc17_shell.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/sqlite3mc_vc17_shellicu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}
6 |
7 |
8 | {21EB8090-0D4E-1035-B6D3-48EBA215DCB7}
9 |
10 |
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/build/wx_setup.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CODEC_TYPE_CHACHA20
5 | 0
6 | 1
7 | 0
8 |
9 |
10 |
11 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/conan/all/conandata.yml:
--------------------------------------------------------------------------------
1 | ---
2 | sources:
3 | "1.8.0":
4 | url: "https://github.com/utelle/SQLite3MultipleCiphers/archive/refs/tags/v1.8.0.tar.gz"
5 | sha256: "13D9B939BEF7C7371D58A3874F83B18CF330EB2171205B3680ACDDB2215BE0E5"
6 | strip_root: true
7 |
--------------------------------------------------------------------------------
/conan/all/test_package/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.24.0)
2 | project(test_sqlite3mc C)
3 |
4 | find_package(sqlite3mc REQUIRED)
5 |
6 | add_executable(${PROJECT_NAME}
7 | main.c
8 | )
9 |
10 | target_link_libraries(${PROJECT_NAME}
11 | sqlite3mc::sqlite3mc
12 | )
--------------------------------------------------------------------------------
/conan/all/test_package/conanfile.py:
--------------------------------------------------------------------------------
1 | import os
2 | from conan import ConanFile
3 | from conan.tools.cmake import CMake, cmake_layout
4 | from conan.tools.build import can_run
5 |
6 |
7 | class sqlite3mcTest(ConanFile):
8 | settings = "os", "compiler", "build_type", "arch"
9 | generators = "CMakeDeps", "CMakeToolchain"
10 |
11 | def requirements(self):
12 | self.requires(self.tested_reference_str)
13 |
14 | def build(self):
15 | cmake = CMake(self)
16 | cmake.configure()
17 | cmake.build()
18 |
19 | def layout(self):
20 | cmake_layout(self)
21 |
22 | def test(self):
23 | if can_run(self):
24 | cmd = os.path.join(self.cpp.build.bindir, "test_sqlite3mc")
25 | self.run(cmd, env="conanrun")
26 |
--------------------------------------------------------------------------------
/conan/all/test_package/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | sqlite3 *db;
7 | const char *key = "password";
8 | const char *wrongKey = "wrongPassword";
9 |
10 | // Create database
11 | int rc = sqlite3_open("test.db", &db);
12 | if (rc != SQLITE_OK)
13 | {
14 | fprintf(stderr, "Failed to open database: %s\n", sqlite3_errmsg(db));
15 | sqlite3_close(db);
16 | return 1;
17 | }
18 |
19 | // Encrypt
20 | sqlite3_key(db, key, strlen(key));
21 |
22 | // Fill db with some data and close it
23 | rc = sqlite3_exec(db, "CREATE TABLE users (name TEXT NOT NULL, ID INTEGER PRIMARY KEY UNIQUE)", NULL, NULL, NULL);
24 | if (rc != SQLITE_OK)
25 | {
26 | fprintf(stderr, "SQL error: %s\n", sqlite3_errmsg(db));
27 | sqlite3_close(db);
28 | return 1;
29 | }
30 | rc = sqlite3_exec(db, "INSERT INTO users (name, ID) VALUES ('testUser', '12345')", NULL, NULL, NULL);
31 | if (rc != SQLITE_OK)
32 | {
33 | fprintf(stderr, "SQL error: %s\n", sqlite3_errmsg(db));
34 | sqlite3_close(db);
35 | return 1;
36 | }
37 | rc = sqlite3_close(db);
38 | if (rc != SQLITE_OK)
39 | {
40 | fprintf(stderr, "Failed to close database: %s\n", sqlite3_errmsg(db));
41 | return 1;
42 | }
43 |
44 | // Reopen and provide wrong key
45 | rc = sqlite3_open("test.db", &db);
46 | if (rc != SQLITE_OK)
47 | {
48 | fprintf(stderr, "Failed to open database: %s\n", sqlite3_errmsg(db));
49 | sqlite3_close(db);
50 | return 1;
51 | }
52 | sqlite3_key(db, wrongKey, strlen(wrongKey));
53 |
54 | // Try to access the database, should fail
55 | rc = sqlite3_exec(db, "SELECT name FROM users WHERE ID = '12345'", NULL, NULL, NULL);
56 | if (rc == SQLITE_OK)
57 | {
58 | fprintf(stderr, "Access was provided without the proper key\n");
59 | sqlite3_close(db);
60 | return 1;
61 | }
62 | rc = sqlite3_close(db);
63 | if (rc != SQLITE_OK)
64 | {
65 | fprintf(stderr, "Failed to close database: %s\n", sqlite3_errmsg(db));
66 | return 1;
67 | }
68 |
69 |
70 | fprintf(stdout, "Test successful\n");
71 | return 0;
72 | }
73 |
--------------------------------------------------------------------------------
/conan/config.yml:
--------------------------------------------------------------------------------
1 | ---
2 | versions:
3 | "1.8.0":
4 | folder: all
5 |
--------------------------------------------------------------------------------
/scripts/patchshell.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Generate patched shell.c from SQLite3 amalgamation distribution and write it to stdout.
3 | # Usage: ./script/patchshell.sh shell.c >shellpatched.c
4 |
5 | INPUT="$([ "$#" -eq 1 ] && echo "$1" || echo "shell.c")"
6 | if ! [ -f "$INPUT" ]; then
7 | echo "Usage: $0 " >&2
8 | echo " e.g.: $0 shell.c" >&2
9 | exit 1
10 | fi
11 |
12 | die() {
13 | echo "[-]" "$@" >&2
14 | exit 2
15 | }
16 |
17 | sed -e '/^ sputf(stdout, "SQLite version/{n;N;d}' "$INPUT" \
18 | | sed '/#ifdef SQLITE_CUSTOM_INCLUDE/!{p;d;};n;n;n;a #if SQLITE3MC_USE_MINIZ != 0 && !defined(SQLITE_ENABLE_COMPRESS)\n#include "miniz.c"\n#ifdef SQLITE_HAVE_ZLIB\n#undef SQLITE_HAVE_ZLIB\n#endif\n#define SQLITE_HAVE_ZLIB 1\n#endif\n' \
19 | | sed '/#include /c #include "zlibwrap.h"' \
20 | | sed '/^ sqlite3_fprintf(stdout,$/c \ extern char* sqlite3mc_version();\n sqlite3_fprintf(stdout,' \
21 | | sed '/^ "SQLite version/c \ "SQLite version \%s \%.19s" \/\*extra-version-info\*\/\n " (\%s)\\n" \/\*SQLite3-Multiple-Ciphers-version-info\*\/' \
22 | | sed '/^ sqlite3_libversion(), sqlite3_sourceid());/c \ sqlite3_libversion(), sqlite3_sourceid(), sqlite3mc_version());' \
23 | | sed '/^ sqlite3_libversion(), sqlite3_sourceid());/a \ extern char* sqlite3mc_version();\n sqlite3_fprintf(p->out, "\%s\\n", sqlite3mc_version());'
24 |
--------------------------------------------------------------------------------
/scripts/rekeyvacuum.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Generate rekeyvacuum.c from SQLite3 amalgamation and write it to stdout.
3 | # Usage: ./script/rekeyvacuum.sh sqlite3.c >rekeyvacuum.c
4 |
5 | INPUT="$([ "$#" -eq 1 ] && echo "$1" || echo "sqlite3.c")"
6 | if ! [ -f "$INPUT" ]; then
7 | echo "Usage: $0 " >&2
8 | echo " e.g.: $0 sqlite3.c" >&2
9 | exit 1
10 | fi
11 |
12 | die() {
13 | echo "[-]" "$@" >&2
14 | exit 2
15 | }
16 |
17 | VERSION="$(sed -n 's/^#define SQLITE_VERSION[^"]*"\([0-9]\+\.[0-9]\+\.[0-9]\+\)"$/\1/p' "$INPUT")"
18 | [ -z "$VERSION" ] && die "cannot find SQLite3 version (is '$INPUT' a valid amalgamation?)"
19 |
20 | cat <nextPagesize ){\n extern void sqlite3mcCodecGetKey(sqlite3*, int, void**, int*);\n int nKey;\n char *zKey;\n sqlite3mcCodecGetKey(db, iDb, (void**)&zKey, &nKey);\n if( nKey ) db->nextPagesize = 0;\n }' \
58 | | grep -v "int nRes;\|nRes = " \
59 | | grep "^" || die "Error generating rekeyvacuum.c"
60 |
--------------------------------------------------------------------------------
/scripts/sqlite3mc.c.json:
--------------------------------------------------------------------------------
1 | {
2 | "project": "sqlite3mc.c",
3 | "target": "sqlite3mc_amalgamation.c",
4 | "sources": [
5 | "sqlite3mc.c"
6 | ],
7 | "include_paths": [
8 | "aegis/include", "argon2/include", "."
9 | ],
10 | "force_include": [
11 | "aegis/common/func_names_define.h",
12 | "aegis/common/func_names_undefine.h",
13 | "aegis/common/type_names_undefine.h",
14 | "aegis/common/func_table.h",
15 | "aegis/aegis128l/aegis128l_common.h",
16 | "aegis/aegis128x2/aegis128x2_common.h",
17 | "aegis/aegis128x4/aegis128x4_common.h",
18 | "aegis/aegis256/aegis256_common.h",
19 | "aegis/aegis256x2/aegis256x2_common.h",
20 | "aegis/aegis256x4/aegis256x4_common.h"
21 | ]
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/scripts/sqlite3mc.h.json:
--------------------------------------------------------------------------------
1 | {
2 | "project": "sqlite3mc.h",
3 | "target": "sqlite3mc_amalgamation.h",
4 | "sources": [
5 | "sqlite3mc.h"
6 | ],
7 | "include_paths": [
8 | "src", "."
9 | ],
10 | "force_include": [
11 | ]
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/sqlite3mc.pc.in:
--------------------------------------------------------------------------------
1 | # Package Information for pkg-config
2 |
3 | prefix=@prefix@
4 | exec_prefix=@exec_prefix@
5 | includedir=@includedir@
6 | libdir=@libdir@
7 |
8 | Name: sqlite3mc-@VERSION@
9 | Description: SQLite3 with encryption extension supporting multiple ciphers
10 | Version: @VERSION@
11 | Libs: -L${libdir} -l@SQLITE3MC_LIBNAME@
12 | Libs.private: -lpthread
13 | Cflags: -I${includedir}/sqlite3mc
14 |
--------------------------------------------------------------------------------
/src/aegis/aegis128l/aegis128l_aesni.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128l_aesni.h
3 | ** Purpose: Header for implementation structure of AEGIS-128L - AES-NI
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128L_AESNI_H
9 | #define AEGIS128L_AESNI_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128l_implementation aegis128l_aesni_implementation;
15 |
16 | #endif /* AEGIS128L_AESNI_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128l/aegis128l_altivec.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128l_altivec.h
3 | ** Purpose: Header for implementation structure of AEGIS-128L - AltiVec
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128L_ALTIVEC_H
9 | #define AEGIS128L_ALTIVEC_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128l_implementation aegis128l_altivec_implementation;
15 |
16 | #endif /* AEGIS128L_ALTIVEC_H */
--------------------------------------------------------------------------------
/src/aegis/aegis128l/aegis128l_armcrypto.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128l_armcrypto.h
3 | ** Purpose: Header for implementation structure of AEGIS-128L - ARM Crypto
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128L_ARMCRYPTO_H
9 | #define AEGIS128L_ARMCRYPTO_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128l_implementation aegis128l_armcrypto_implementation;
15 |
16 | #endif /* AEGIS128L_ARMCRYPTO_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128l/aegis128l_soft.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128l_soft.c
3 | ** Purpose: Implementation of AEGIS-128L - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #include "../common/common.h"
15 | #include "../common/cpu.h"
16 |
17 | #include "../common/softaes.h"
18 | #include "aegis128l.h"
19 | #include "aegis128l_soft.h"
20 |
21 | #define AES_BLOCK_LENGTH 16
22 |
23 | typedef SoftAesBlock aegis128l_soft_aes_block_t;
24 |
25 | #define AEGIS_AES_BLOCK_T aegis128l_soft_aes_block_t
26 | #define AEGIS_BLOCKS aegis128l_soft_blocks
27 | #define AEGIS_STATE _aegis128l_soft_state
28 | #define AEGIS_MAC_STATE _aegis128l_soft_mac_state
29 |
30 | #define AEGIS_FUNC_PREFIX aegis128l_soft_impl
31 |
32 | #include "../common/func_names_define.h"
33 |
34 | static inline AEGIS_AES_BLOCK_T
35 | AEGIS_AES_BLOCK_XOR(const AEGIS_AES_BLOCK_T a, const AEGIS_AES_BLOCK_T b)
36 | {
37 | return softaes_block_xor(a, b);
38 | }
39 |
40 | static inline AEGIS_AES_BLOCK_T
41 | AEGIS_AES_BLOCK_AND(const AEGIS_AES_BLOCK_T a, const AEGIS_AES_BLOCK_T b)
42 | {
43 | return softaes_block_and(a, b);
44 | }
45 |
46 | static inline AEGIS_AES_BLOCK_T
47 | AEGIS_AES_BLOCK_LOAD(const uint8_t *a)
48 | {
49 | return softaes_block_load(a);
50 | }
51 |
52 | static inline AEGIS_AES_BLOCK_T
53 | AEGIS_AES_BLOCK_LOAD_64x2(uint64_t a, uint64_t b)
54 | {
55 | return softaes_block_load64x2(a, b);
56 | }
57 |
58 | static inline void
59 | AEGIS_AES_BLOCK_STORE(uint8_t *a, const AEGIS_AES_BLOCK_T b)
60 | {
61 | softaes_block_store(a, b);
62 | }
63 |
64 | static inline AEGIS_AES_BLOCK_T
65 | AEGIS_AES_ENC(const AEGIS_AES_BLOCK_T a, const AEGIS_AES_BLOCK_T b)
66 | {
67 | return softaes_block_encrypt(a, b);
68 | }
69 |
70 | static inline void
71 | AEGIS_update(AEGIS_AES_BLOCK_T *const state, const AEGIS_AES_BLOCK_T d1, const AEGIS_AES_BLOCK_T d2)
72 | {
73 | AEGIS_AES_BLOCK_T tmp;
74 |
75 | tmp = state[7];
76 | state[7] = AEGIS_AES_ENC(state[6], state[7]);
77 | state[6] = AEGIS_AES_ENC(state[5], state[6]);
78 | state[5] = AEGIS_AES_ENC(state[4], state[5]);
79 | state[4] = AEGIS_AES_ENC(state[3], state[4]);
80 | state[3] = AEGIS_AES_ENC(state[2], state[3]);
81 | state[2] = AEGIS_AES_ENC(state[1], state[2]);
82 | state[1] = AEGIS_AES_ENC(state[0], state[1]);
83 | state[0] = AEGIS_AES_ENC(tmp, state[0]);
84 |
85 | state[0] = AEGIS_AES_BLOCK_XOR(state[0], d1);
86 | state[4] = AEGIS_AES_BLOCK_XOR(state[4], d2);
87 | }
88 |
89 | #include "aegis128l_common.h"
90 |
91 | struct aegis128l_implementation aegis128l_soft_implementation = {
92 | #include "../common/func_table.h"
93 | };
94 |
95 | #include "../common/type_names_undefine.h"
96 | #include "../common/func_names_undefine.h"
97 |
--------------------------------------------------------------------------------
/src/aegis/aegis128l/aegis128l_soft.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128l_soft.h
3 | ** Purpose: Header for implementation structure of AEGIS-128L - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128L_SOFT_H
9 | #define AEGIS128L_SOFT_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128l_implementation aegis128l_soft_implementation;
15 |
16 | #endif /* AEGIS128L_SOFT_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128l/implementations.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: implementations.h
3 | ** Purpose: Header for implementation structure of AEGIS-128L
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128L_IMPLEMENTATIONS_H
9 | #define AEGIS128L_IMPLEMENTATIONS_H
10 |
11 | #include
12 | #include
13 |
14 | #include "aegis128l.h"
15 |
16 | typedef struct aegis128l_implementation {
17 | int (*encrypt_detached)(uint8_t *c, uint8_t *mac, size_t maclen, const uint8_t *m, size_t mlen,
18 | const uint8_t *ad, size_t adlen, const uint8_t *npub, const uint8_t *k);
19 | int (*decrypt_detached)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *mac,
20 | size_t maclen, const uint8_t *ad, size_t adlen, const uint8_t *npub,
21 | const uint8_t *k);
22 | void (*stream)(uint8_t *out, size_t len, const uint8_t *npub, const uint8_t *k);
23 | void (*encrypt_unauthenticated)(uint8_t *c, const uint8_t *m, size_t mlen, const uint8_t *npub,
24 | const uint8_t *k);
25 | void (*decrypt_unauthenticated)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *npub,
26 | const uint8_t *k);
27 | #ifndef AEGIS_OMIT_INCREMENTAL
28 | void (*state_init)(aegis128l_state *st_, const uint8_t *ad, size_t adlen, const uint8_t *npub,
29 | const uint8_t *k);
30 | int (*state_encrypt_update)(aegis128l_state *st_, uint8_t *c, size_t clen_max, size_t *written,
31 | const uint8_t *m, size_t mlen);
32 | int (*state_encrypt_detached_final)(aegis128l_state *st_, uint8_t *c, size_t clen_max,
33 | size_t *written, uint8_t *mac, size_t maclen);
34 | int (*state_encrypt_final)(aegis128l_state *st_, uint8_t *c, size_t clen_max, size_t *written,
35 | size_t maclen);
36 | int (*state_decrypt_detached_update)(aegis128l_state *st_, uint8_t *m, size_t mlen_max,
37 | size_t *written, const uint8_t *c, size_t clen);
38 | int (*state_decrypt_detached_final)(aegis128l_state *st_, uint8_t *m, size_t mlen_max,
39 | size_t *written, const uint8_t *mac, size_t maclen);
40 | #endif /* AEGIS_OMIT_INCREMENTAL */
41 | #ifndef AEGIS_OMIT_MAC_API
42 | void (*state_mac_init)(aegis128l_mac_state *st_, const uint8_t *npub, const uint8_t *k);
43 | int (*state_mac_update)(aegis128l_mac_state *st_, const uint8_t *ad, size_t adlen);
44 | int (*state_mac_final)(aegis128l_mac_state *st_, uint8_t *mac, size_t maclen);
45 | void (*state_mac_reset)(aegis128l_mac_state *st);
46 | void (*state_mac_clone)(aegis128l_mac_state *dst, const aegis128l_mac_state *src);
47 | #endif /* AEGIS_OMIT_MAC_API */
48 | } aegis128l_implementation;
49 |
50 | #endif /* AEGIS128L_IMPLEMENTATIONS_H */
51 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x2/aegis128x2_aesni.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x2_aesni.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x2 - AES-NI
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X2_AESNI_H
9 | #define AEGIS128X2_AESNI_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x2_implementation aegis128x2_aesni_implementation;
15 |
16 | #endif /* AEGIS128X2_AESNI_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x2/aegis128x2_altivec.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x2_altivec.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x2 - AltiVec
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X2_ALTIVEC_H
9 | #define AEGIS128X2_ALTIVEC_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x2_implementation aegis128x2_altivec_implementation;
15 |
16 | #endif /* AEGIS128X2_ALTIVEC_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x2/aegis128x2_armcrypto.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x2_armcrypto.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x2 - ARM Crypto
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X2_ARMCRYPTO_H
9 | #define AEGIS128X2_ARMCRYPTO_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x2_implementation aegis128x2_armcrypto_implementation;
15 |
16 | #endif /* AEGIS128X2_ARMCRYPTO_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x2/aegis128x2_avx2.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x2_avx2.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x2 - AES-NI AVX2
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X2_AVX2_H
9 | #define AEGIS128X2_AVX2_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | #ifdef HAVE_VAESINTRIN_H
15 | extern struct aegis128x2_implementation aegis128x2_avx2_implementation;
16 | #endif
17 |
18 | #endif /* AEGIS128X2_AVX2_H */
19 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x2/aegis128x2_soft.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x2_soft.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x2 - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X2_SOFT_H
9 | #define AEGIS128X2_SOFT_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x2_implementation aegis128x2_soft_implementation;
15 |
16 | #endif /* AEGIS128X2_SOFT_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x2/implementations.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: implementations.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x2
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X2_IMPLEMENTATIONS_H
9 | #define AEGIS128X2_IMPLEMENTATIONS_H
10 |
11 | #include
12 | #include
13 |
14 | #include "aegis128x2.h"
15 |
16 | typedef struct aegis128x2_implementation {
17 | int (*encrypt_detached)(uint8_t *c, uint8_t *mac, size_t maclen, const uint8_t *m, size_t mlen,
18 | const uint8_t *ad, size_t adlen, const uint8_t *npub, const uint8_t *k);
19 | int (*decrypt_detached)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *mac,
20 | size_t maclen, const uint8_t *ad, size_t adlen, const uint8_t *npub,
21 | const uint8_t *k);
22 | void (*stream)(uint8_t *out, size_t len, const uint8_t *npub, const uint8_t *k);
23 | void (*encrypt_unauthenticated)(uint8_t *c, const uint8_t *m, size_t mlen, const uint8_t *npub,
24 | const uint8_t *k);
25 | void (*decrypt_unauthenticated)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *npub,
26 | const uint8_t *k);
27 | #ifndef AEGIS_OMIT_INCREMENTAL
28 | void (*state_init)(aegis128x2_state *st_, const uint8_t *ad, size_t adlen, const uint8_t *npub,
29 | const uint8_t *k);
30 | int (*state_encrypt_update)(aegis128x2_state *st_, uint8_t *c, size_t clen_max, size_t *written,
31 | const uint8_t *m, size_t mlen);
32 | int (*state_encrypt_detached_final)(aegis128x2_state *st_, uint8_t *c, size_t clen_max,
33 | size_t *written, uint8_t *mac, size_t maclen);
34 | int (*state_encrypt_final)(aegis128x2_state *st_, uint8_t *c, size_t clen_max, size_t *written,
35 | size_t maclen);
36 | int (*state_decrypt_detached_update)(aegis128x2_state *st_, uint8_t *m, size_t mlen_max,
37 | size_t *written, const uint8_t *c, size_t clen);
38 | int (*state_decrypt_detached_final)(aegis128x2_state *st_, uint8_t *m, size_t mlen_max,
39 | size_t *written, const uint8_t *mac, size_t maclen);
40 | #endif /* AEGIS_OMIT_INCREMENTAL */
41 | #ifndef AEGIS_OMIT_MAC_API
42 | void (*state_mac_init)(aegis128x2_mac_state *st_, const uint8_t *npub, const uint8_t *k);
43 | int (*state_mac_update)(aegis128x2_mac_state *st_, const uint8_t *ad, size_t adlen);
44 | int (*state_mac_final)(aegis128x2_mac_state *st_, uint8_t *mac, size_t maclen);
45 | void (*state_mac_reset)(aegis128x2_mac_state *st);
46 | void (*state_mac_clone)(aegis128x2_mac_state *dst, const aegis128x2_mac_state *src);
47 | #endif /* AEGIS_OMIT_MAC_API */
48 | } aegis128x2_implementation;
49 |
50 | #endif /* AEGIS128X2_IMPLEMENTATIONS_H */
51 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/aegis128x4_aesni.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x4_aesni.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4 - AES-NI
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_AESNI_H
9 | #define AEGIS128X4_AESNI_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x4_implementation aegis128x4_aesni_implementation;
15 |
16 | #endif /* AEGIS128X4_AESNI_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/aegis128x4_altivec.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x4_altivec.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4 - AltiVec
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_ALTIVEC_H
9 | #define AEGIS128X4_ALTIVEC_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x4_implementation aegis128x4_altivec_implementation;
15 |
16 | #endif /* AEGIS128X4_ALTIVEC_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/aegis128x4_armcrypto.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x4_armcrypto.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4 - ARM Crypto
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_ARMCRYPTO_H
9 | #define AEGIS128X4_ARMCRYPTO_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x4_implementation aegis128x4_armcrypto_implementation;
15 |
16 | #endif /* AEGIS128X4_ARMCRYPTO_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/aegis128x4_avx2.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x4_avx2.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4 - AES-NI AVX2
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_AVX2_H
9 | #define AEGIS128X4_AVX2_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | #ifdef HAVE_VAESINTRIN_H
15 | extern struct aegis128x4_implementation aegis128x4_avx2_implementation;
16 | #endif
17 |
18 | #endif /* AEGIS128X4_AVX2_H */
19 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/aegis128x4_avx512.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x4_avx512.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4 - AES-NI AVX512
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_AVX512_H
9 | #define AEGIS128X4_AVX512_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | #ifdef HAVE_VAESINTRIN_H
15 | extern struct aegis128x4_implementation aegis128x4_avx512_implementation;
16 | #endif
17 |
18 | #endif /* AEGIS128X4_AVX512_H */
19 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/aegis128x4_soft.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis128x4_soft.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4 - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_SOFT_H
9 | #define AEGIS128X4_SOFT_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis128x4_implementation aegis128x4_soft_implementation;
15 |
16 | #endif /* AEGIS128X4_SOFT_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis128x4/implementations.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: implementations.h
3 | ** Purpose: Header for implementation structure of AEGIS-128x4
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS128X4_IMPLEMENTATIONS_H
9 | #define AEGIS128X4_IMPLEMENTATIONS_H
10 |
11 | #include
12 | #include
13 |
14 | #include "aegis128x4.h"
15 |
16 | typedef struct aegis128x4_implementation {
17 | int (*encrypt_detached)(uint8_t *c, uint8_t *mac, size_t maclen, const uint8_t *m, size_t mlen,
18 | const uint8_t *ad, size_t adlen, const uint8_t *npub, const uint8_t *k);
19 | int (*decrypt_detached)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *mac,
20 | size_t maclen, const uint8_t *ad, size_t adlen, const uint8_t *npub,
21 | const uint8_t *k);
22 | void (*stream)(uint8_t *out, size_t len, const uint8_t *npub, const uint8_t *k);
23 | void (*encrypt_unauthenticated)(uint8_t *c, const uint8_t *m, size_t mlen, const uint8_t *npub,
24 | const uint8_t *k);
25 | void (*decrypt_unauthenticated)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *npub,
26 | const uint8_t *k);
27 | #ifndef AEGIS_OMIT_INCREMENTAL
28 | void (*state_init)(aegis128x4_state *st_, const uint8_t *ad, size_t adlen, const uint8_t *npub,
29 | const uint8_t *k);
30 | int (*state_encrypt_update)(aegis128x4_state *st_, uint8_t *c, size_t clen_max, size_t *written,
31 | const uint8_t *m, size_t mlen);
32 | int (*state_encrypt_detached_final)(aegis128x4_state *st_, uint8_t *c, size_t clen_max,
33 | size_t *written, uint8_t *mac, size_t maclen);
34 | int (*state_encrypt_final)(aegis128x4_state *st_, uint8_t *c, size_t clen_max, size_t *written,
35 | size_t maclen);
36 | int (*state_decrypt_detached_update)(aegis128x4_state *st_, uint8_t *m, size_t mlen_max,
37 | size_t *written, const uint8_t *c, size_t clen);
38 | int (*state_decrypt_detached_final)(aegis128x4_state *st_, uint8_t *m, size_t mlen_max,
39 | size_t *written, const uint8_t *mac, size_t maclen);
40 | #endif /* AEGIS_OMIT_INCREMENTAL */
41 | #ifndef AEGIS_OMIT_MAC_API
42 | void (*state_mac_init)(aegis128x4_mac_state *st_, const uint8_t *npub, const uint8_t *k);
43 | int (*state_mac_update)(aegis128x4_mac_state *st_, const uint8_t *ad, size_t adlen);
44 | int (*state_mac_final)(aegis128x4_mac_state *st_, uint8_t *mac, size_t maclen);
45 | void (*state_mac_reset)(aegis128x4_mac_state *st);
46 | void (*state_mac_clone)(aegis128x4_mac_state *dst, const aegis128x4_mac_state *src);
47 | #endif /* AEGIS_OMIT_MAC_API */
48 | } aegis128x4_implementation;
49 |
50 | #endif /* AEGIS128X4_IMPLEMENTATIONS_H */
51 |
--------------------------------------------------------------------------------
/src/aegis/aegis256/aegis256_aesni.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256_aesni.h
3 | ** Purpose: Header for implementation structure of AEGIS-256 - AES-NI
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256_AESNI_H
9 | #define AEGIS256_AESNI_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256_implementation aegis256_aesni_implementation;
15 |
16 | #endif /* AEGIS256_AESNI_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256/aegis256_altivec.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256_altivec.h
3 | ** Purpose: Header for implementation structure of AEGIS-256 - AltiVec
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256_ALTIVEC_H
9 | #define AEGIS256_ALTIVEC_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256_implementation aegis256_altivec_implementation;
15 |
16 | #endif /* AEGIS256_ALTIVEC_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256/aegis256_armcrypto.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256_armcrypto.h
3 | ** Purpose: Header for implementation structure of AEGIS-256 - ARM Crypto
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256_ARMCRYPTO_H
9 | #define AEGIS256_ARMCRYPTO_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256_implementation aegis256_armcrypto_implementation;
15 |
16 | #endif /* AEGIS256_ARMCRYPTO_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256/aegis256_soft.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256_soft.c
3 | ** Purpose: Implementation of AEGIS-256 - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #include "../common/common.h"
15 | #include "../common/cpu.h"
16 |
17 | #include "../common/softaes.h"
18 | #include "aegis256.h"
19 | #include "aegis256_soft.h"
20 |
21 | #define AES_BLOCK_LENGTH 16
22 |
23 | typedef SoftAesBlock aegis256_soft_aes_block_t;
24 |
25 | #define AEGIS_AES_BLOCK_T aegis256_soft_aes_block_t
26 | #define AEGIS_BLOCKS aegis256_soft_blocks
27 | #define AEGIS_STATE _aegis256_soft_state
28 | #define AEGIS_MAC_STATE _aegis256_soft_mac_state
29 |
30 | #define AEGIS_FUNC_PREFIX aegis256_soft_impl
31 |
32 | #include "../common/func_names_define.h"
33 |
34 | static inline AEGIS_AES_BLOCK_T
35 | AEGIS_AES_BLOCK_XOR(const AEGIS_AES_BLOCK_T a, const AEGIS_AES_BLOCK_T b)
36 | {
37 | return softaes_block_xor(a, b);
38 | }
39 |
40 | static inline AEGIS_AES_BLOCK_T
41 | AEGIS_AES_BLOCK_AND(const AEGIS_AES_BLOCK_T a, const AEGIS_AES_BLOCK_T b)
42 | {
43 | return softaes_block_and(a, b);
44 | }
45 |
46 | static inline AEGIS_AES_BLOCK_T
47 | AEGIS_AES_BLOCK_LOAD(const uint8_t *a)
48 | {
49 | return softaes_block_load(a);
50 | }
51 |
52 | static inline AEGIS_AES_BLOCK_T
53 | AEGIS_AES_BLOCK_LOAD_64x2(uint64_t a, uint64_t b)
54 | {
55 | return softaes_block_load64x2(a, b);
56 | }
57 |
58 | static inline void
59 | AEGIS_AES_BLOCK_STORE(uint8_t *a, const AEGIS_AES_BLOCK_T b)
60 | {
61 | softaes_block_store(a, b);
62 | }
63 |
64 | static inline AEGIS_AES_BLOCK_T
65 | AEGIS_AES_ENC(const AEGIS_AES_BLOCK_T a, const AEGIS_AES_BLOCK_T b)
66 | {
67 | return softaes_block_encrypt(a, b);
68 | }
69 |
70 | static inline void
71 | AEGIS_update(AEGIS_AES_BLOCK_T *const state, const AEGIS_AES_BLOCK_T d)
72 | {
73 | AEGIS_AES_BLOCK_T tmp;
74 |
75 | tmp = state[5];
76 | state[5] = AEGIS_AES_ENC(state[4], state[5]);
77 | state[4] = AEGIS_AES_ENC(state[3], state[4]);
78 | state[3] = AEGIS_AES_ENC(state[2], state[3]);
79 | state[2] = AEGIS_AES_ENC(state[1], state[2]);
80 | state[1] = AEGIS_AES_ENC(state[0], state[1]);
81 | state[0] = AEGIS_AES_BLOCK_XOR(AEGIS_AES_ENC(tmp, state[0]), d);
82 | }
83 |
84 | #include "aegis256_common.h"
85 |
86 | struct aegis256_implementation aegis256_soft_implementation = {
87 | #include "../common/func_table.h"
88 | };
89 |
90 | #include "../common/type_names_undefine.h"
91 | #include "../common/func_names_undefine.h"
92 |
--------------------------------------------------------------------------------
/src/aegis/aegis256/aegis256_soft.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256_soft.h
3 | ** Purpose: Header for implementation structure of AEGIS-256 - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256_SOFT_H
9 | #define AEGIS256_SOFT_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256_implementation aegis256_soft_implementation;
15 |
16 | #endif /* AEGIS256_SOFT_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256/implementations.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: implementations.h
3 | ** Purpose: Header for implementation structure of AEGIS-256
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256_IMPLEMENTATIONS_H
9 | #define AEGIS256_IMPLEMENTATIONS_H
10 |
11 | #include
12 | #include
13 |
14 | #include "aegis256.h"
15 |
16 | typedef struct aegis256_implementation {
17 | int (*encrypt_detached)(uint8_t *c, uint8_t *mac, size_t maclen, const uint8_t *m, size_t mlen,
18 | const uint8_t *ad, size_t adlen, const uint8_t *npub, const uint8_t *k);
19 | int (*decrypt_detached)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *mac,
20 | size_t maclen, const uint8_t *ad, size_t adlen, const uint8_t *npub,
21 | const uint8_t *k);
22 | void (*stream)(uint8_t *out, size_t len, const uint8_t *npub, const uint8_t *k);
23 | void (*encrypt_unauthenticated)(uint8_t *c, const uint8_t *m, size_t mlen, const uint8_t *npub,
24 | const uint8_t *k);
25 | void (*decrypt_unauthenticated)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *npub,
26 | const uint8_t *k);
27 | #ifndef AEGIS_OMIT_INCREMENTAL
28 | void (*state_init)(aegis256_state *st_, const uint8_t *ad, size_t adlen, const uint8_t *npub,
29 | const uint8_t *k);
30 | int (*state_encrypt_update)(aegis256_state *st_, uint8_t *c, size_t clen_max, size_t *written,
31 | const uint8_t *m, size_t mlen);
32 | int (*state_encrypt_detached_final)(aegis256_state *st_, uint8_t *c, size_t clen_max,
33 | size_t *written, uint8_t *mac, size_t maclen);
34 | int (*state_encrypt_final)(aegis256_state *st_, uint8_t *c, size_t clen_max, size_t *written,
35 | size_t maclen);
36 | int (*state_decrypt_detached_update)(aegis256_state *st_, uint8_t *m, size_t mlen_max,
37 | size_t *written, const uint8_t *c, size_t clen);
38 | int (*state_decrypt_detached_final)(aegis256_state *st_, uint8_t *m, size_t mlen_max,
39 | size_t *written, const uint8_t *mac, size_t maclen);
40 | #endif /* AEGIS_OMIT_INCREMENTAL */
41 | #ifndef AEGIS_OMIT_MAC_API
42 | void (*state_mac_init)(aegis256_mac_state *st_, const uint8_t *npub, const uint8_t *k);
43 | int (*state_mac_update)(aegis256_mac_state *st_, const uint8_t *ad, size_t adlen);
44 | int (*state_mac_final)(aegis256_mac_state *st_, uint8_t *mac, size_t maclen);
45 | void (*state_mac_reset)(aegis256_mac_state *st);
46 | void (*state_mac_clone)(aegis256_mac_state *dst, const aegis256_mac_state *src);
47 | #endif /* AEGIS_OMIT_MAC_API */
48 | } aegis256_implementation;
49 |
50 | #endif /* AEGIS256_IMPLEMENTATIONS_H */
51 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x2/aegis256x2_aesni.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x2_aesni.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x2 - AES-NI
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X2_AESNI_H
9 | #define AEGIS256X2_AESNI_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x2_implementation aegis256x2_aesni_implementation;
15 |
16 | #endif /* AEGIS256X2_AESNI_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x2/aegis256x2_altivec.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x2_altivec.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x2 - AltiVec
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X2_ALTIVEC_H
9 | #define AEGIS256X2_ALTIVEC_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x2_implementation aegis256x2_altivec_implementation;
15 |
16 | #endif /* AEGIS256X2_ALTIVEC_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x2/aegis256x2_armcrypto.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x2_armcrypto.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x2 - ARM Crypto
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X2_ARMCRYPTO_H
9 | #define AEGIS256X2_ARMCRYPTO_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x2_implementation aegis256x2_armcrypto_implementation;
15 |
16 | #endif /* AEGIS256X2_ARMCRYPTO_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x2/aegis256x2_avx2.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x2_avx2.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x2 - AES-NI AVX2
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X2_AVX2_H
9 | #define AEGIS256X2_AVX2_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | #ifdef HAVE_VAESINTRIN_H
15 | extern struct aegis256x2_implementation aegis256x2_avx2_implementation;
16 | #endif
17 |
18 | #endif /* AEGIS256X2_AVX2_H */
19 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x2/aegis256x2_soft.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x2_soft.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x2 - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X2_SOFT_H
9 | #define AEGIS256X2_SOFT_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x2_implementation aegis256x2_soft_implementation;
15 |
16 | #endif /* AEGIS256X2_SOFT_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x2/implementations.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: implementations.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x2
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X2_IMPLEMENTATIONS_H
9 | #define AEGIS256X2_IMPLEMENTATIONS_H
10 |
11 | #include
12 | #include
13 |
14 | #include "aegis256x2.h"
15 |
16 | typedef struct aegis256x2_implementation {
17 | int (*encrypt_detached)(uint8_t *c, uint8_t *mac, size_t maclen, const uint8_t *m, size_t mlen,
18 | const uint8_t *ad, size_t adlen, const uint8_t *npub, const uint8_t *k);
19 | int (*decrypt_detached)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *mac,
20 | size_t maclen, const uint8_t *ad, size_t adlen, const uint8_t *npub,
21 | const uint8_t *k);
22 | void (*stream)(uint8_t *out, size_t len, const uint8_t *npub, const uint8_t *k);
23 | void (*encrypt_unauthenticated)(uint8_t *c, const uint8_t *m, size_t mlen, const uint8_t *npub,
24 | const uint8_t *k);
25 | void (*decrypt_unauthenticated)(uint8_t *m, const uint8_t *c, size_t clen, const uint8_t *npub,
26 | const uint8_t *k);
27 | #ifndef AEGIS_OMIT_INCREMENTAL
28 | void (*state_init)(aegis256x2_state *st_, const uint8_t *ad, size_t adlen, const uint8_t *npub,
29 | const uint8_t *k);
30 | int (*state_encrypt_update)(aegis256x2_state *st_, uint8_t *c, size_t clen_max, size_t *written,
31 | const uint8_t *m, size_t mlen);
32 | int (*state_encrypt_detached_final)(aegis256x2_state *st_, uint8_t *c, size_t clen_max,
33 | size_t *written, uint8_t *mac, size_t maclen);
34 | int (*state_encrypt_final)(aegis256x2_state *st_, uint8_t *c, size_t clen_max, size_t *written,
35 | size_t maclen);
36 | int (*state_decrypt_detached_update)(aegis256x2_state *st_, uint8_t *m, size_t mlen_max,
37 | size_t *written, const uint8_t *c, size_t clen);
38 | int (*state_decrypt_detached_final)(aegis256x2_state *st_, uint8_t *m, size_t mlen_max,
39 | size_t *written, const uint8_t *mac, size_t maclen);
40 | #endif /* AEGIS_OMIT_INCREMENTAL */
41 | #ifndef AEGIS_OMIT_MAC_API
42 | void (*state_mac_init)(aegis256x2_mac_state *st_, const uint8_t *npub, const uint8_t *k);
43 | int (*state_mac_update)(aegis256x2_mac_state *st_, const uint8_t *ad, size_t adlen);
44 | int (*state_mac_final)(aegis256x2_mac_state *st_, uint8_t *mac, size_t maclen);
45 | void (*state_mac_reset)(aegis256x2_mac_state *st);
46 | void (*state_mac_clone)(aegis256x2_mac_state *dst, const aegis256x2_mac_state *src);
47 | #endif /* AEGIS_OMIT_MAC_API */
48 | } aegis256x2_implementation;
49 |
50 | #endif /* AEGIS256X2_IMPLEMENTATIONS_H */
51 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x4/aegis256x4_aesni.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x4_aesni.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x4 - AES-NI
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X4_AESNI_H
9 | #define AEGIS256X4_AESNI_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x4_implementation aegis256x4_aesni_implementation;
15 |
16 | #endif /* AEGIS256X4_AESNI_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x4/aegis256x4_altivec.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x4_altivec.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x4 - AltiVec
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X4_ALTIVEC_H
9 | #define AEGIS256X4_ALTIVEC_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x4_implementation aegis256x4_altivec_implementation;
15 |
16 | #endif /* AEGIS256X4_ALTIVEC_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x4/aegis256x4_armcrypto.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x4_armcrypto.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x4 - ARM Crypto
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X4_ARMCRYPTO_H
9 | #define AEGIS256X4_ARMCRYPTO_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x4_implementation aegis256x4_armcrypto_implementation;
15 |
16 | #endif /* AEGIS256X4_ARMCRYPTO_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x4/aegis256x4_avx2.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x4_avx2.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x4 - AES-NI AVX2
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X4_AVX2_H
9 | #define AEGIS256X4_AVX2_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | #ifdef HAVE_VAESINTRIN_H
15 | extern struct aegis256x4_implementation aegis256x4_avx2_implementation;
16 | #endif
17 |
18 | #endif /* AEGIS256X4_AVX2_H */
19 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x4/aegis256x4_avx512.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x4_avx512.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x4 - AES-NI AVX512
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X4_AVX512_H
9 | #define AEGIS256X4_AVX512_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | #ifdef HAVE_VAESINTRIN_H
15 | extern struct aegis256x4_implementation aegis256x4_avx512_implementation;
16 | #endif
17 |
18 | #endif /* AEGIS256X4_AVX512_H */
19 |
--------------------------------------------------------------------------------
/src/aegis/aegis256x4/aegis256x4_soft.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis256x4_soft.h
3 | ** Purpose: Header for implementation structure of AEGIS-256x4 - Software
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS256X4_SOFT_H
9 | #define AEGIS256X4_SOFT_H
10 |
11 | #include "../common/common.h"
12 | #include "implementations.h"
13 |
14 | extern struct aegis256x4_implementation aegis256x4_soft_implementation;
15 |
16 | #endif /* AEGIS256X4_SOFT_H */
17 |
--------------------------------------------------------------------------------
/src/aegis/common/common.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: common.c
3 | ** Purpose: Implementation of common utility functions
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #include
9 | #include
10 |
11 | #include "common.h"
12 | #include "cpu.h"
13 |
14 | static volatile uint16_t optblocker_u16;
15 |
16 | static inline int
17 | aegis_verify_n(const uint8_t *x_, const uint8_t *y_, const int n)
18 | {
19 | const volatile uint8_t *volatile x = (const volatile uint8_t *volatile) x_;
20 | const volatile uint8_t *volatile y = (const volatile uint8_t *volatile) y_;
21 | volatile uint16_t d = 0U;
22 | int i;
23 |
24 | for (i = 0; i < n; i++) {
25 | d |= x[i] ^ y[i];
26 | }
27 | #if defined(__GNUC__) || defined(__clang__)
28 | __asm__("" : "+r"(d) :);
29 | #endif
30 | d--;
31 | d = ((d >> 13) ^ optblocker_u16) >> 2;
32 |
33 | return (int) d - 1;
34 | }
35 |
36 | AEGIS_API
37 | int
38 | aegis_verify_16(const uint8_t *x, const uint8_t *y)
39 | {
40 | return aegis_verify_n(x, y, 16);
41 | }
42 |
43 | AEGIS_API
44 | int
45 | aegis_verify_32(const uint8_t *x, const uint8_t *y)
46 | {
47 | return aegis_verify_n(x, y, 32);
48 | }
49 |
50 | AEGIS_PRIVATE int aegis128l_pick_best_implementation(void);
51 | AEGIS_PRIVATE int aegis128x2_pick_best_implementation(void);
52 | AEGIS_PRIVATE int aegis128x4_pick_best_implementation(void);
53 | AEGIS_PRIVATE int aegis256_pick_best_implementation(void);
54 | AEGIS_PRIVATE int aegis256x2_pick_best_implementation(void);
55 | AEGIS_PRIVATE int aegis256x4_pick_best_implementation(void);
56 |
57 | AEGIS_API
58 | int
59 | aegis_init(void)
60 | {
61 | static int initialized = 0;
62 |
63 | if (initialized) {
64 | return 0;
65 | }
66 | if (aegis_runtime_get_cpu_features() != 0) {
67 | return 0;
68 | }
69 | if (aegis128l_pick_best_implementation() != 0 || aegis128x2_pick_best_implementation() != 0 ||
70 | aegis128x4_pick_best_implementation() != 0 || aegis256_pick_best_implementation() != 0 ||
71 | aegis256x2_pick_best_implementation() != 0 || aegis256x4_pick_best_implementation() != 0) {
72 | return -1;
73 | }
74 | initialized = 1;
75 |
76 | return 0;
77 | }
78 |
79 | #if 0
80 | #if defined(_MSC_VER)
81 | # pragma section(".CRT$XCU", read)
82 | static void __cdecl _do_aegis_init(void);
83 | __declspec(allocate(".CRT$XCU")) void (*aegis_init_constructor)(void) = _do_aegis_init;
84 | #else
85 | static void _do_aegis_init(void) __attribute__((constructor));
86 | #endif
87 |
88 | static void
89 | _do_aegis_init(void)
90 | {
91 | (void) aegis_init();
92 | }
93 | #endif
94 |
--------------------------------------------------------------------------------
/src/aegis/common/cpu.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: cpu.h
3 | ** Purpose: Header for CPU identification and AES hardware support detection
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS_CPU_H
9 | #define AEGIS_CPU_H
10 |
11 | #include "aeshardware.h"
12 |
13 | AEGIS_PRIVATE
14 | int aegis_runtime_get_cpu_features(void);
15 |
16 | AEGIS_PRIVATE
17 | int aegis_runtime_has_neon(void);
18 |
19 | AEGIS_PRIVATE
20 | int aegis_runtime_has_armcrypto(void);
21 |
22 | AEGIS_PRIVATE
23 | int aegis_runtime_has_avx(void);
24 |
25 | AEGIS_PRIVATE
26 | int aegis_runtime_has_avx2(void);
27 |
28 | AEGIS_PRIVATE
29 | int aegis_runtime_has_avx512f(void);
30 |
31 | AEGIS_PRIVATE
32 | int aegis_runtime_has_aesni(void);
33 |
34 | AEGIS_PRIVATE
35 | int aegis_runtime_has_vaes(void);
36 |
37 | AEGIS_PRIVATE
38 | int aegis_runtime_has_altivec(void);
39 |
40 | #endif /* AEGIS_CPU_H */
41 |
--------------------------------------------------------------------------------
/src/aegis/common/func_names_define.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: func_names_define.h
3 | ** Purpose: Defines for AEGIS function names
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | /*
9 | ** NOTE:
10 | ** Do NOT use include guards, because including this header
11 | ** multiple times is intended behaviour.
12 | */
13 |
14 | #define AEGIS_AES_BLOCK_XOR AEGIS_FUNC(aes_block_xor)
15 | #define AEGIS_AES_BLOCK_AND AEGIS_FUNC(aes_block_and)
16 | #define AEGIS_AES_BLOCK_LOAD AEGIS_FUNC(aes_block_load)
17 | #define AEGIS_AES_BLOCK_LOAD_64x2 AEGIS_FUNC(aes_block_load_64x2)
18 | #define AEGIS_AES_BLOCK_STORE AEGIS_FUNC(aes_block_store)
19 | #define AEGIS_AES_ENC AEGIS_FUNC(aes_enc)
20 | #define AEGIS_update AEGIS_FUNC(update)
21 | #define AEGIS_encrypt_detached AEGIS_FUNC(encrypt_detached)
22 | #define AEGIS_decrypt_detached AEGIS_FUNC(decrypt_detached)
23 | #define AEGIS_encrypt_unauthenticated AEGIS_FUNC(encrypt_unauthenticated)
24 | #define AEGIS_decrypt_unauthenticated AEGIS_FUNC(decrypt_unauthenticated)
25 | #define AEGIS_stream AEGIS_FUNC(stream)
26 | #define AEGIS_state_init AEGIS_FUNC(state_init)
27 | #define AEGIS_state_encrypt_update AEGIS_FUNC(state_encrypt_update)
28 | #define AEGIS_state_encrypt_detached_final AEGIS_FUNC(state_encrypt_detached_final)
29 | #define AEGIS_state_encrypt_final AEGIS_FUNC(state_encrypt_final)
30 | #define AEGIS_state_decrypt_detached_update AEGIS_FUNC(state_decrypt_detached_update)
31 | #define AEGIS_state_decrypt_detached_final AEGIS_FUNC(state_decrypt_detached_final)
32 | #define AEGIS_state_mac_init AEGIS_FUNC(state_mac_init)
33 | #define AEGIS_state_mac_update AEGIS_FUNC(state_mac_update)
34 | #define AEGIS_state_mac_final AEGIS_FUNC(state_mac_final)
35 | #define AEGIS_state_mac_reset AEGIS_FUNC(state_mac_reset)
36 | #define AEGIS_state_mac_clone AEGIS_FUNC(state_mac_clone)
37 |
--------------------------------------------------------------------------------
/src/aegis/common/func_names_undefine.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: func_names_undefine.h
3 | ** Purpose: Undefines for AEGIS function names
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | /*
9 | ** NOTE:
10 | ** Do NOT use include guards, because including this header
11 | ** multiple times is intended behaviour.
12 | */
13 |
14 | /* Undefine function name prefix */
15 | #undef AEGIS_FUNC_PREFIX
16 |
17 | /* Undefine all function names */
18 | #undef AEGIS_AES_BLOCK_XOR
19 | #undef AEGIS_AES_BLOCK_AND
20 | #undef AEGIS_AES_BLOCK_LOAD
21 | #undef AEGIS_AES_BLOCK_LOAD_64x2
22 | #undef AEGIS_AES_BLOCK_STORE
23 | #undef AEGIS_AES_ENC
24 | #undef AEGIS_update
25 | #undef AEGIS_encrypt_detached
26 | #undef AEGIS_decrypt_detached
27 | #undef AEGIS_encrypt_unauthenticated
28 | #undef AEGIS_decrypt_unauthenticated
29 | #undef AEGIS_stream
30 | #undef AEGIS_state_init
31 | #undef AEGIS_state_encrypt_update
32 | #undef AEGIS_state_encrypt_detached_final
33 | #undef AEGIS_state_encrypt_final
34 | #undef AEGIS_state_decrypt_detached_update
35 | #undef AEGIS_state_decrypt_detached_final
36 | #undef AEGIS_state_mac_init
37 | #undef AEGIS_state_mac_update
38 | #undef AEGIS_state_mac_final
39 | #undef AEGIS_state_mac_reset
40 | #undef AEGIS_state_mac_clone
41 |
--------------------------------------------------------------------------------
/src/aegis/common/func_table.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: func_table.h
3 | ** Purpose: Table of AEGIS API function implementations
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | /*
9 | ** NOTE:
10 | ** Do NOT use include guards, because including this header
11 | ** multiple times is intended behaviour.
12 | */
13 |
14 | AEGIS_API_IMPL_LIST_STD
15 | #ifndef AEGIS_OMIT_INCREMENTAL
16 | AEGIS_API_IMPL_LIST_INC
17 | #endif
18 | #ifndef AEGIS_OMIT_MAC_API
19 | AEGIS_API_IMPL_LIST_MAC
20 | #endif
21 |
22 |
--------------------------------------------------------------------------------
/src/aegis/common/softaes.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: softaes.h
3 | ** Purpose: Header for API of AES software implementation
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS_SOFTAES_H
9 | #define AEGIS_SOFTAES_H
10 |
11 | #include
12 |
13 | #include "common.h"
14 |
15 | typedef struct SoftAesBlock {
16 | uint32_t w0;
17 | uint32_t w1;
18 | uint32_t w2;
19 | uint32_t w3;
20 | } SoftAesBlock;
21 |
22 | static SoftAesBlock
23 | softaes_block_encrypt(const SoftAesBlock block, const SoftAesBlock rk);
24 |
25 | static inline SoftAesBlock
26 | softaes_block_load(const uint8_t in[16])
27 | {
28 | #ifdef NATIVE_LITTLE_ENDIAN
29 | SoftAesBlock out;
30 | memcpy(&out, in, 16);
31 | #else
32 | const SoftAesBlock out = { AEGIS_LOAD32_LE(in + 0), AEGIS_LOAD32_LE(in + 4), AEGIS_LOAD32_LE(in + 8),
33 | AEGIS_LOAD32_LE(in + 12) };
34 | #endif
35 | return out;
36 | }
37 |
38 | static inline SoftAesBlock
39 | softaes_block_load64x2(const uint64_t a, const uint64_t b)
40 | {
41 | const SoftAesBlock out = { (uint32_t) b, (uint32_t) (b >> 32), (uint32_t) a,
42 | (uint32_t) (a >> 32) };
43 | return out;
44 | }
45 |
46 | static inline void
47 | softaes_block_store(uint8_t out[16], const SoftAesBlock in)
48 | {
49 | #ifdef NATIVE_LITTLE_ENDIAN
50 | memcpy(out, &in, 16);
51 | #else
52 | AEGIS_STORE32_LE(out + 0, in.w0);
53 | AEGIS_STORE32_LE(out + 4, in.w1);
54 | AEGIS_STORE32_LE(out + 8, in.w2);
55 | AEGIS_STORE32_LE(out + 12, in.w3);
56 | #endif
57 | }
58 |
59 | static inline SoftAesBlock
60 | softaes_block_xor(const SoftAesBlock a, const SoftAesBlock b)
61 | {
62 | const SoftAesBlock out = { a.w0 ^ b.w0, a.w1 ^ b.w1, a.w2 ^ b.w2, a.w3 ^ b.w3 };
63 | return out;
64 | }
65 |
66 | static inline SoftAesBlock
67 | softaes_block_and(const SoftAesBlock a, const SoftAesBlock b)
68 | {
69 | const SoftAesBlock out = { a.w0 & b.w0, a.w1 & b.w1, a.w2 & b.w2, a.w3 & b.w3 };
70 | return out;
71 | }
72 |
73 | #endif /* AEGIS_SOFTAES_H */
74 |
--------------------------------------------------------------------------------
/src/aegis/common/type_names_undefine.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: type_names_undefine.h
3 | ** Purpose: Undefines for AEGIS type names
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | /*
9 | ** NOTE:
10 | ** Do NOT use include guards, because including this header
11 | ** multiple times is intended behaviour.
12 | */
13 |
14 | /* Undefine AES block length */
15 | #undef AES_BLOCK_LENGTH
16 |
17 | /* Undefine type names */
18 | #undef AEGIS_AES_BLOCK_T
19 | #undef AEGIS_BLOCKS
20 | #undef AEGIS_STATE
21 | #undef AEGIS_MAC_STATE
22 |
--------------------------------------------------------------------------------
/src/aegis/include/aegis.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: aegis.h
3 | ** Purpose: Header for AEGIS API
4 | ** Copyright: (c) 2023-2024 Frank Denis
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | #ifndef AEGIS_H
9 | #define AEGIS_H
10 |
11 | #include
12 |
13 | #if !defined(__clang__) && !defined(__GNUC__)
14 | # ifdef __attribute__
15 | # undef __attribute__
16 | # endif
17 | # define __attribute__(a)
18 | #endif
19 |
20 | #ifndef CRYPTO_ALIGN
21 | # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
22 | # define CRYPTO_ALIGN(x) __declspec(align(x))
23 | # else
24 | # define CRYPTO_ALIGN(x) __attribute__((aligned(x)))
25 | # endif
26 | #endif
27 |
28 | #ifndef AEGIS_API
29 | #define AEGIS_API
30 | #endif
31 | #ifndef AEGIS_PRIVATE
32 | #define AEGIS_PRIVATE static
33 | #endif
34 |
35 | #include "aegis128l.h"
36 | #include "aegis128x2.h"
37 | #include "aegis128x4.h"
38 | #include "aegis256.h"
39 | #include "aegis256x2.h"
40 | #include "aegis256x4.h"
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 | /* Initialize the AEGIS library.
47 | *
48 | * This function does runtime CPU capability detection, and must be called once
49 | * in your application before doing anything else with the library.
50 | *
51 | * If you don't, AEGIS will still work, but it may be much slower.
52 | *
53 | * The function can be called multiple times but is not thread-safe.
54 | */
55 | AEGIS_API
56 | int aegis_init(void);
57 |
58 | /* Compare two 16-byte blocks for equality.
59 | *
60 | * This function is designed to be used in constant-time code.
61 | *
62 | * Returns 0 if the blocks are equal, -1 otherwise.
63 | */
64 | AEGIS_API
65 | int aegis_verify_16(const uint8_t *x, const uint8_t *y) __attribute__((warn_unused_result));
66 |
67 | /* Compare two 32-byte blocks for equality.
68 | *
69 | * This function is designed to be used in constant-time code.
70 | *
71 | * Returns 0 if the blocks are equal, -1 otherwise.
72 | */
73 | AEGIS_API
74 | int aegis_verify_32(const uint8_t *x, const uint8_t *y) __attribute__((warn_unused_result));
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif /* AEGIS_H */
81 |
--------------------------------------------------------------------------------
/src/aegis/libaegis.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: libaegis.c
3 | ** Purpose: Amalgamation of the AEGIS library
4 | ** Copyright: (c) 2024-2024 Ulrich Telle
5 | ** SPDX-License-Identifier: MIT
6 | */
7 |
8 | /*
9 | ** AEGIS library source code
10 | */
11 |
12 | #ifndef AEGIS_API
13 | #define AEGIS_API
14 | #endif
15 | #ifndef AEGIS_PRIVATE
16 | #define AEGIS_PRIVATE static
17 | #endif
18 |
19 | #include "common/cpu.h"
20 |
21 | /* AEGIS common functions */
22 | #include "common/common.c"
23 | #include "common/cpu.c"
24 | #include "common/softaes.c"
25 |
26 | #if defined(__GNUC__)
27 | # pragma GCC push_options
28 | #endif
29 |
30 | /* AEGIS 128 L */
31 | #include "aegis128l/implementations.h"
32 | #include "aegis128l/aegis128l_aesni.c"
33 | #include "aegis128l/aegis128l_altivec.c"
34 | #include "aegis128l/aegis128l_armcrypto.c"
35 | #include "aegis128l/aegis128l_soft.c"
36 | #include "aegis128l/aegis128l.c"
37 |
38 | /* AEGIS 128 x2 */
39 | #include "aegis128x2/implementations.h"
40 | #include "aegis128x2/aegis128x2_aesni.c"
41 | #include "aegis128x2/aegis128x2_altivec.c"
42 | #include "aegis128x2/aegis128x2_armcrypto.c"
43 | #include "aegis128x2/aegis128x2_avx2.c"
44 | #include "aegis128x2/aegis128x2_soft.c"
45 | #include "aegis128x2/aegis128x2.c"
46 |
47 | /* AEGIS 128 x4 */
48 | #include "aegis128x4/implementations.h"
49 | #include "aegis128x4/aegis128x4_aesni.c"
50 | #include "aegis128x4/aegis128x4_altivec.c"
51 | #include "aegis128x4/aegis128x4_armcrypto.c"
52 | #include "aegis128x4/aegis128x4_avx2.c"
53 | #include "aegis128x4/aegis128x4_avx512.c"
54 | #include "aegis128x4/aegis128x4_soft.c"
55 | #include "aegis128x4/aegis128x4.c"
56 |
57 | /* AEGIS 256 */
58 | #include "aegis256/implementations.h"
59 | #include "aegis256/aegis256_aesni.c"
60 | #include "aegis256/aegis256_altivec.c"
61 | #include "aegis256/aegis256_armcrypto.c"
62 | #include "aegis256/aegis256_soft.c"
63 | #include "aegis256/aegis256.c"
64 |
65 | /* AEGIS 256 x2 */
66 | #include "aegis256x2/implementations.h"
67 | #include "aegis256x2/aegis256x2_aesni.c"
68 | #include "aegis256x2/aegis256x2_altivec.c"
69 | #include "aegis256x2/aegis256x2_armcrypto.c"
70 | #include "aegis256x2/aegis256x2_avx2.c"
71 | #include "aegis256x2/aegis256x2_soft.c"
72 | #include "aegis256x2/aegis256x2.c"
73 |
74 | /* AEGIS 256 x4 */
75 | #include "aegis256x4/implementations.h"
76 | #include "aegis256x4/aegis256x4_aesni.c"
77 | #include "aegis256x4/aegis256x4_altivec.c"
78 | #include "aegis256x4/aegis256x4_armcrypto.c"
79 | #include "aegis256x4/aegis256x4_avx2.c"
80 | #include "aegis256x4/aegis256x4_avx512.c"
81 | #include "aegis256x4/aegis256x4_soft.c"
82 | #include "aegis256x4/aegis256x4.c"
83 |
84 | #if defined(__GNUC__)
85 | # pragma GCC pop_options
86 | #endif
87 |
--------------------------------------------------------------------------------
/src/argon2/libargon2.c:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_API
2 | #define ARGON2_API static
3 | #endif
4 |
5 | #ifndef ARGON2_PRIVATE
6 | #define ARGON2_PRIVATE static
7 | #endif
8 |
9 | #ifndef ARGON2_PUBLIC
10 | #define ARGON2_PUBLIC static
11 | #endif
12 |
13 | #ifndef ARGON2_LOCAL
14 | #define ARGON2_LOCAL static
15 | #endif
16 |
17 | #ifndef BLAKE2B_API
18 | #define BLAKE2B_API static
19 | #endif
20 |
21 | #include "src/blake2/blake2b.c"
22 | #include "src/argon2.c"
23 | #include "src/core.c"
24 | #include "src/encoding.c"
25 | #include "src/ref.c"
26 | #include "src/thread.c"
27 |
--------------------------------------------------------------------------------
/src/argon2/src/blake2/blamka-round-ref.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Argon2 reference source code package - reference C implementations
3 | *
4 | * Copyright 2015
5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
6 | *
7 | * You may use this work under the terms of a Creative Commons CC0 1.0
8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of
9 | * these licenses can be found at:
10 | *
11 | * - CC0 1.0 Universal : https://creativecommons.org/publicdomain/zero/1.0
12 | * - Apache 2.0 : https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * You should have received a copy of both of these licenses along with this
15 | * software. If not, they may be obtained at the above URLs.
16 | */
17 |
18 | #ifndef BLAKE_ROUND_MKA_H
19 | #define BLAKE_ROUND_MKA_H
20 |
21 | #include "blake2.h"
22 | #include "blake2-impl.h"
23 |
24 | /* designed by the Lyra PHC team */
25 | static BLAKE2_INLINE uint64_t fBlaMka(uint64_t x, uint64_t y) {
26 | const uint64_t m = UINT64_C(0xFFFFFFFF);
27 | const uint64_t xy = (x & m) * (y & m);
28 | return x + y + 2 * xy;
29 | }
30 |
31 | #define BLAKE2_G(a, b, c, d) \
32 | do { \
33 | a = fBlaMka(a, b); \
34 | d = _blake2b_rotr64(d ^ a, 32); \
35 | c = fBlaMka(c, d); \
36 | b = _blake2b_rotr64(b ^ c, 24); \
37 | a = fBlaMka(a, b); \
38 | d = _blake2b_rotr64(d ^ a, 16); \
39 | c = fBlaMka(c, d); \
40 | b = _blake2b_rotr64(b ^ c, 63); \
41 | } while ((void)0, 0)
42 |
43 | #define BLAKE2_ROUND_NOMSG(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \
44 | v12, v13, v14, v15) \
45 | do { \
46 | BLAKE2_G(v0, v4, v8, v12); \
47 | BLAKE2_G(v1, v5, v9, v13); \
48 | BLAKE2_G(v2, v6, v10, v14); \
49 | BLAKE2_G(v3, v7, v11, v15); \
50 | BLAKE2_G(v0, v5, v10, v15); \
51 | BLAKE2_G(v1, v6, v11, v12); \
52 | BLAKE2_G(v2, v7, v8, v13); \
53 | BLAKE2_G(v3, v4, v9, v14); \
54 | } while ((void)0, 0)
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/src/argon2/src/encoding.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Argon2 reference source code package - reference C implementations
3 | *
4 | * Copyright 2015
5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
6 | *
7 | * You may use this work under the terms of a Creative Commons CC0 1.0
8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of
9 | * these licenses can be found at:
10 | *
11 | * - CC0 1.0 Universal : https://creativecommons.org/publicdomain/zero/1.0
12 | * - Apache 2.0 : https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * You should have received a copy of both of these licenses along with this
15 | * software. If not, they may be obtained at the above URLs.
16 | */
17 |
18 | #ifndef ARGON2_ENCODING_H
19 | #define ARGON2_ENCODING_H
20 | #include "argon2.h"
21 |
22 | #define ARGON2_MAX_DECODED_LANES UINT32_C(255)
23 | #define ARGON2_MIN_DECODED_SALT_LEN UINT32_C(8)
24 | #define ARGON2_MIN_DECODED_OUT_LEN UINT32_C(12)
25 |
26 | /*
27 | * encode an Argon2 hash string into the provided buffer. 'dst_len'
28 | * contains the size, in characters, of the 'dst' buffer; if 'dst_len'
29 | * is less than the number of required characters (including the
30 | * terminating 0), then this function returns ARGON2_ENCODING_ERROR.
31 | *
32 | * on success, ARGON2_OK is returned.
33 | */
34 | ARGON2_PRIVATE
35 | int _argon2_encode_string(char *dst, size_t dst_len, argon2_context *ctx,
36 | argon2_type type);
37 |
38 | /*
39 | * Decodes an Argon2 hash string into the provided structure 'ctx'.
40 | * The only fields that must be set prior to this call are ctx.saltlen and
41 | * ctx.outlen (which must be the maximal salt and out length values that are
42 | * allowed), ctx.salt and ctx.out (which must be buffers of the specified
43 | * length), and ctx.pwd and ctx.pwdlen which must hold a valid password.
44 | *
45 | * Invalid input string causes an error. On success, the ctx is valid and all
46 | * fields have been initialized.
47 | *
48 | * Returned value is ARGON2_OK on success, other ARGON2_ codes on error.
49 | */
50 | ARGON2_PRIVATE
51 | int _argon2_decode_string(argon2_context *ctx, const char *str, argon2_type type);
52 |
53 | /* Returns the length of the encoded byte stream with length len */
54 | ARGON2_PRIVATE
55 | size_t _argon2_b64len(uint32_t len);
56 |
57 | /* Returns the length of the encoded number num */
58 | ARGON2_PRIVATE
59 | size_t _argon2_numlen(uint32_t num);
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/src/argon2/src/genkat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Argon2 reference source code package - reference C implementations
3 | *
4 | * Copyright 2015
5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
6 | *
7 | * You may use this work under the terms of a Creative Commons CC0 1.0
8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of
9 | * these licenses can be found at:
10 | *
11 | * - CC0 1.0 Universal : https://creativecommons.org/publicdomain/zero/1.0
12 | * - Apache 2.0 : https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * You should have received a copy of both of these licenses along with this
15 | * software. If not, they may be obtained at the above URLs.
16 | */
17 |
18 | #ifndef ARGON2_KAT_H
19 | #define ARGON2_KAT_H
20 |
21 | #include "core.h"
22 |
23 | /*
24 | * Initial KAT function that prints the inputs to the file
25 | * @param blockhash Array that contains pre-hashing digest
26 | * @param context Holds inputs
27 | * @param type Argon2 type
28 | * @pre blockhash must point to INPUT_INITIAL_HASH_LENGTH bytes
29 | * @pre context member pointers must point to allocated memory of size according
30 | * to the length values
31 | */
32 | void initial_kat(const uint8_t *blockhash, const argon2_context *context,
33 | argon2_type type);
34 |
35 | /*
36 | * Function that prints the output tag
37 | * @param out output array pointer
38 | * @param outlen digest length
39 | * @pre out must point to @a outlen bytes
40 | **/
41 | void print_tag(const void *out, uint32_t outlen);
42 |
43 | /*
44 | * Function that prints the internal state at given moment
45 | * @param instance pointer to the current instance
46 | * @param pass current pass number
47 | * @pre instance must have necessary memory allocated
48 | **/
49 | void internal_kat(const argon2_instance_t *instance, uint32_t pass);
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/src/argon2/src/thread.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Argon2 reference source code package - reference C implementations
3 | *
4 | * Copyright 2015
5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
6 | *
7 | * You may use this work under the terms of a Creative Commons CC0 1.0
8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of
9 | * these licenses can be found at:
10 | *
11 | * - CC0 1.0 Universal : https://creativecommons.org/publicdomain/zero/1.0
12 | * - Apache 2.0 : https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * You should have received a copy of both of these licenses along with this
15 | * software. If not, they may be obtained at the above URLs.
16 | */
17 |
18 | #if !defined(ARGON2_NO_THREADS)
19 |
20 | #include "thread.h"
21 | #if defined(_WIN32)
22 | #include
23 | #endif
24 |
25 | ARGON2_PRIVATE
26 | int argon2_thread_create(argon2_thread_handle_t *handle,
27 | argon2_thread_func_t func, void *args) {
28 | if (NULL == handle || func == NULL) {
29 | return -1;
30 | }
31 | #if defined(_WIN32)
32 | *handle = _beginthreadex(NULL, 0, func, args, 0, NULL);
33 | return *handle != 0 ? 0 : -1;
34 | #else
35 | return pthread_create(handle, NULL, func, args);
36 | #endif
37 | }
38 |
39 | ARGON2_PRIVATE
40 | int argon2_thread_join(argon2_thread_handle_t handle) {
41 | #if defined(_WIN32)
42 | if (WaitForSingleObject((HANDLE)handle, INFINITE) == WAIT_OBJECT_0) {
43 | return CloseHandle((HANDLE)handle) != 0 ? 0 : -1;
44 | }
45 | return -1;
46 | #else
47 | return pthread_join(handle, NULL);
48 | #endif
49 | }
50 |
51 | ARGON2_PRIVATE
52 | void argon2_thread_exit(void) {
53 | #if defined(_WIN32)
54 | _endthreadex(0);
55 | #else
56 | pthread_exit(NULL);
57 | #endif
58 | }
59 |
60 | #endif /* ARGON2_NO_THREADS */
61 |
--------------------------------------------------------------------------------
/src/argon2/src/thread.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Argon2 reference source code package - reference C implementations
3 | *
4 | * Copyright 2015
5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
6 | *
7 | * You may use this work under the terms of a Creative Commons CC0 1.0
8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of
9 | * these licenses can be found at:
10 | *
11 | * - CC0 1.0 Universal : https://creativecommons.org/publicdomain/zero/1.0
12 | * - Apache 2.0 : https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * You should have received a copy of both of these licenses along with this
15 | * software. If not, they may be obtained at the above URLs.
16 | */
17 |
18 | #ifndef ARGON2_THREAD_H
19 | #define ARGON2_THREAD_H
20 |
21 | #if !defined(ARGON2_NO_THREADS)
22 |
23 | /*
24 | Here we implement an abstraction layer for the simple requirements
25 | of the Argon2 code. We only require 3 primitives---thread creation,
26 | joining, and termination---so full emulation of the pthreads API
27 | is unwarranted. Currently we wrap pthreads and Win32 threads.
28 |
29 | The API defines 2 types: the function pointer type,
30 | argon2_thread_func_t,
31 | and the type of the thread handle---argon2_thread_handle_t.
32 | */
33 | #if defined(_WIN32)
34 | #include
35 | typedef unsigned(__stdcall *argon2_thread_func_t)(void *);
36 | typedef uintptr_t argon2_thread_handle_t;
37 | #else
38 | #include
39 | typedef void *(*argon2_thread_func_t)(void *);
40 | typedef pthread_t argon2_thread_handle_t;
41 | #endif
42 |
43 | /* Creates a thread
44 | * @param handle pointer to a thread handle, which is the output of this
45 | * function. Must not be NULL.
46 | * @param func A function pointer for the thread's entry point. Must not be
47 | * NULL.
48 | * @param args Pointer that is passed as an argument to @func. May be NULL.
49 | * @return 0 if @handle and @func are valid pointers and a thread is successfully
50 | * created.
51 | */
52 | ARGON2_PRIVATE
53 | int argon2_thread_create(argon2_thread_handle_t *handle,
54 | argon2_thread_func_t func, void *args);
55 |
56 | /* Waits for a thread to terminate
57 | * @param handle Handle to a thread created with argon2_thread_create.
58 | * @return 0 if @handle is a valid handle, and joining completed successfully.
59 | */
60 | ARGON2_PRIVATE
61 | int argon2_thread_join(argon2_thread_handle_t handle);
62 |
63 | /* Terminate the current thread. Must be run inside a thread created by
64 | * argon2_thread_create.
65 | */
66 | ARGON2_PRIVATE
67 | void argon2_thread_exit(void);
68 |
69 | #endif /* ARGON2_NO_THREADS */
70 | #endif
71 |
--------------------------------------------------------------------------------
/src/ascon/api.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: api.h
3 | ** Purpose: Definition of preprocessor symbols
4 | ** Based on: Public domain Ascon reference implementation
5 | ** and optimized variants for 32- and 64-bit
6 | ** (see https://github.com/ascon/ascon-c)
7 | ** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
8 | ** Combined symbols from AEAD and HASH
9 | ** Modified by: Ulrich Telle
10 | ** Copyright: (c) 2023-2023 Ulrich Telle
11 | ** License: MIT
12 | */
13 |
14 | #define CRYPTO_VERSION "1.2.7"
15 | #define CRYPTO_KEYBYTES 16
16 | #define CRYPTO_NSECBYTES 0
17 | #define CRYPTO_NPUBBYTES 16
18 | #define CRYPTO_ABYTES 16
19 | #define CRYPTO_NOOVERLAP 1
20 | #define ASCON_AEAD_RATE 8
21 |
22 | #define CRYPTO_BYTES 32
23 | #define ASCON_HASH_BYTES 32 /* HASH */
24 | #define ASCON_HASH_ROUNDS 12
25 |
26 | #define ASCON_AEAD_KEY_LEN CRYPTO_KEYBYTES
27 | #define ASCON_AEAD_NONCE_LEN CRYPTO_NPUBBYTES
28 | #define ASCON_AEAD_TAG_LEN CRYPTO_ABYTES
29 | #define ASCON_SALT_LEN CRYPTO_NPUBBYTES
30 |
--------------------------------------------------------------------------------
/src/ascon/ascon.h:
--------------------------------------------------------------------------------
1 | #ifndef ASCON_H_
2 | #define ASCON_H_
3 |
4 | #include
5 |
6 | #include "api.h"
7 | #include "config.h"
8 |
9 | typedef union {
10 | uint64_t x[5];
11 | uint32_t w[5][2];
12 | uint8_t b[5][8];
13 | } ascon_state_t;
14 |
15 | #ifdef ASCON_AEAD_RATE
16 |
17 | #define ASCON_KEYWORDS (CRYPTO_KEYBYTES + 7) / 8
18 |
19 | typedef union {
20 | uint64_t x[ASCON_KEYWORDS];
21 | uint32_t w[ASCON_KEYWORDS][2];
22 | uint8_t b[ASCON_KEYWORDS][8];
23 | } ascon_key_t;
24 |
25 | #if !ASCON_INLINE_MODE
26 |
27 | void ascon_loadkey(ascon_key_t* key, const uint8_t* k);
28 | void ascon_initaead(ascon_state_t* s, const ascon_key_t* key,
29 | const uint8_t* npub);
30 | void ascon_adata(ascon_state_t* s, const uint8_t* ad, uint64_t adlen);
31 | void ascon_encrypt(ascon_state_t* s, uint8_t* c, const uint8_t* m,
32 | uint64_t mlen);
33 | void ascon_decrypt(ascon_state_t* s, uint8_t* m, const uint8_t* c,
34 | uint64_t clen);
35 | void ascon_final(ascon_state_t* s, const ascon_key_t* k);
36 |
37 | #endif
38 |
39 | #endif
40 |
41 | #ifdef ASCON_HASH_BYTES
42 |
43 | #if !ASCON_INLINE_MODE
44 |
45 | void ascon_inithash(ascon_state_t* s);
46 | void ascon_absorb(ascon_state_t* s, const uint8_t* in, uint64_t inlen);
47 | void ascon_squeeze(ascon_state_t* s, uint8_t* out, uint64_t outlen);
48 |
49 | #endif
50 |
51 | #endif
52 |
53 | #endif /* ASCON_H_ */
54 |
--------------------------------------------------------------------------------
/src/ascon/bendian.h:
--------------------------------------------------------------------------------
1 | #ifndef ENDIAN_H_
2 | #define ENDIAN_H_
3 |
4 | #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
5 |
6 | /* macros for big endian machines */
7 | #ifdef PRAGMA_ENDIAN
8 | #pragma message("Using macros for big endian machines")
9 | #endif
10 | #define ASCON_U64BIG(x) (x)
11 | #define ASCON_U32BIG(x) (x)
12 | #define ASCON_U16BIG(x) (x)
13 |
14 | #elif defined(_MSC_VER) || \
15 | (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
16 |
17 | /* macros for little endian machines */
18 | #ifdef PRAGMA_ENDIAN
19 | #pragma message("Using macros for little endian machines")
20 | #endif
21 | #define ASCON_U64BIG(x) \
22 | (((0x00000000000000FFULL & (x)) << 56) | \
23 | ((0x000000000000FF00ULL & (x)) << 40) | \
24 | ((0x0000000000FF0000ULL & (x)) << 24) | \
25 | ((0x00000000FF000000ULL & (x)) << 8) | \
26 | ((0x000000FF00000000ULL & (x)) >> 8) | \
27 | ((0x0000FF0000000000ULL & (x)) >> 24) | \
28 | ((0x00FF000000000000ULL & (x)) >> 40) | \
29 | ((0xFF00000000000000ULL & (x)) >> 56))
30 | #define ASCON_U32BIG(x) \
31 | (((0x000000FF & (x)) << 24) | ((0x0000FF00 & (x)) << 8) | \
32 | ((0x00FF0000 & (x)) >> 8) | ((0xFF000000 & (x)) >> 24))
33 | #define ASCON_U16BIG(x) (((0x00FF & (x)) << 8) | ((0xFF00 & (x)) >> 8))
34 |
35 | #else
36 | #error "Ascon byte order macros not defined in bendian.h"
37 | #endif
38 |
39 | #endif /* ENDIAN_H_ */
40 |
--------------------------------------------------------------------------------
/src/ascon/config.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIG_H_
2 | #define CONFIG_H_
3 |
4 | /* inline the ascon mode */
5 | #ifndef ASCON_INLINE_MODE
6 | #define ASCON_INLINE_MODE 1
7 | #endif
8 |
9 | /* inline all permutations */
10 | #ifndef ASCON_INLINE_PERM
11 | #define ASCON_INLINE_PERM 1
12 | #endif
13 |
14 | /* unroll permutation loops */
15 | #ifndef ASCON_UNROLL_LOOPS
16 | #define ASCON_UNROLL_LOOPS 1
17 | #endif
18 |
19 | #endif /* CONFIG_H_ */
20 |
--------------------------------------------------------------------------------
/src/ascon/constants.h:
--------------------------------------------------------------------------------
1 | #ifndef CONSTANTS_H_
2 | #define CONSTANTS_H_
3 |
4 | #include
5 |
6 | #define ASCON_128_KEYBYTES 16
7 | #define ASCON_128A_KEYBYTES 16
8 | #define ASCON_80PQ_KEYBYTES 20
9 |
10 | #define ASCON_128_RATE 8
11 | #define ASCON_128A_RATE 16
12 | #define ASCON_HASH_RATE 8
13 | #define ASCON_PRF_IN_RATE 32
14 | #define ASCON_PRFA_IN_RATE 40
15 | #define ASCON_PRF_OUT_RATE 16
16 |
17 | #define ASCON_128_PA_ROUNDS 12
18 | #define ASCON_128_PB_ROUNDS 6
19 | #define ASCON_128A_PA_ROUNDS 12
20 | #define ASCON_128A_PB_ROUNDS 8
21 |
22 | #define ASCON_HASH_PA_ROUNDS 12
23 | #define ASCON_HASH_PB_ROUNDS 12
24 | #define ASCON_HASHA_PA_ROUNDS 12
25 | #define ASCON_HASHA_PB_ROUNDS 8
26 |
27 | #define ASCON_PRF_PA_ROUNDS 12
28 | #define ASCON_PRF_PB_ROUNDS 12
29 | #define ASCON_PRFA_PA_ROUNDS 12
30 | #define ASCON_PRFA_PB_ROUNDS 8
31 |
32 | #define ASCON_128_IV 0x80400c0600000000ull
33 | #define ASCON_128A_IV 0x80800c0800000000ull
34 | #define ASCON_80PQ_IV 0xa0400c0600000000ull
35 |
36 | #define ASCON_HASH_IV 0x00400c0000000100ull
37 | #define ASCON_HASHA_IV 0x00400c0400000100ull
38 | #define ASCON_XOF_IV 0x00400c0000000000ull
39 | #define ASCON_XOFA_IV 0x00400c0400000000ull
40 |
41 | #define ASCON_HASH_IV0 0xee9398aadb67f03dull
42 | #define ASCON_HASH_IV1 0x8bb21831c60f1002ull
43 | #define ASCON_HASH_IV2 0xb48a92db98d5da62ull
44 | #define ASCON_HASH_IV3 0x43189921b8f8e3e8ull
45 | #define ASCON_HASH_IV4 0x348fa5c9d525e140ull
46 |
47 | #define ASCON_HASHA_IV0 0x01470194fc6528a6ull
48 | #define ASCON_HASHA_IV1 0x738ec38ac0adffa7ull
49 | #define ASCON_HASHA_IV2 0x2ec8e3296c76384cull
50 | #define ASCON_HASHA_IV3 0xd6f6a54d7f52377dull
51 | #define ASCON_HASHA_IV4 0xa13c42a223be8d87ull
52 |
53 | #define ASCON_XOF_IV0 0xb57e273b814cd416ull
54 | #define ASCON_XOF_IV1 0x2b51042562ae2420ull
55 | #define ASCON_XOF_IV2 0x66a3a7768ddf2218ull
56 | #define ASCON_XOF_IV3 0x5aad0a7a8153650cull
57 | #define ASCON_XOF_IV4 0x4f3e0e32539493b6ull
58 |
59 | #define ASCON_XOFA_IV0 0x44906568b77b9832ull
60 | #define ASCON_XOFA_IV1 0xcd8d6cae53455532ull
61 | #define ASCON_XOFA_IV2 0xf7b5212756422129ull
62 | #define ASCON_XOFA_IV3 0x246885e1de0d225bull
63 | #define ASCON_XOFA_IV4 0xa8cb5ce33449973full
64 |
65 | #define ASCON_MAC_IV 0x80808c0000000080ull
66 | #define ASCON_MACA_IV 0x80808c0400000080ull
67 | #define ASCON_PRF_IV 0x80808c0000000000ull
68 | #define ASCON_PRFA_IV 0x80808c0400000000ull
69 | #define ASCON_PRFS_IV 0x80004c8000000000ull
70 |
71 | #define ASCON_RC0 0xf0
72 | #define ASCON_RC1 0xe1
73 | #define ASCON_RC2 0xd2
74 | #define ASCON_RC3 0xc3
75 | #define ASCON_RC4 0xb4
76 | #define ASCON_RC5 0xa5
77 | #define ASCON_RC6 0x96
78 | #define ASCON_RC7 0x87
79 | #define ASCON_RC8 0x78
80 | #define ASCON_RC9 0x69
81 | #define ASCON_RCa 0x5a
82 | #define ASCON_RCb 0x4b
83 |
84 | #define ASCON_RC(i) (i)
85 |
86 | #define ASCON_START(n) ((3 + (n)) << 4 | (12 - (n)))
87 | #define ASCON_INC -0x0f
88 | #define ASCON_END 0x3c
89 |
90 | #endif /* CONSTANTS_H_ */
91 |
--------------------------------------------------------------------------------
/src/ascon/crypto_aead.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: hash.c
3 | ** Purpose: API definition for Hash algorithm with Ascon
4 | ** Based on: Public domain Ascon reference implementation
5 | ** and optimized variants for 32- and 64-bit
6 | ** (see https://github.com/ascon/ascon-c)
7 | ** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
8 | ** Modified by: Ulrich Telle
9 | ** Copyright: (c) 2023-2023 Ulrich Telle
10 | ** License: MIT
11 | */
12 |
13 | #ifndef CRYPTO_AEAD_H
14 | #define CRYPTO_AEAD_H
15 |
16 | #ifndef SQLITE_PRIVATE
17 | #define SQLITE_PRIVATE
18 | #endif
19 |
20 | #include
21 |
22 | /*
23 | ** Encryption using ASCON-AEAD.
24 | **
25 | ** \param ctext Output buffer for encrypted text (same length as plain text)
26 | ** \param tag Output buffer for tag with fixed length of ASCON_AEAD_TAG_LEN
27 | ** \param mtext Input buffer with plain message text
28 | ** \param mlen Length of message text
29 | ** \param ad Input buffer with associated data
30 | ** \param adlen Length of associated data
31 | ** \param nonce Buffer with nonce data
32 | ** \param k Buffer with key data
33 | */
34 | SQLITE_PRIVATE
35 | int ascon_aead_encrypt(uint8_t* ctext, uint8_t tag[ASCON_AEAD_TAG_LEN],
36 | const uint8_t* mtext, uint64_t mlen,
37 | const uint8_t* ad, uint64_t adlen,
38 | const uint8_t nonce[ASCON_AEAD_NONCE_LEN],
39 | const uint8_t k[ASCON_AEAD_KEY_LEN]);
40 |
41 | /*
42 | ** Encryption using ASCON-AEAD.
43 | **
44 | ** \param mtext Output buffer with decrypted plain message text (same length as encrypted text)
45 | ** \param ctext Input buffer for encrypted text
46 | ** \param clen Length of encrypted text
47 | ** \param ad Input buffer with associated data
48 | ** \param adlen Length of associated data
49 | ** \param tag Input buffer for expected tag with fixed length of ASCON_AEAD_TAG_LEN
50 | ** \param nonce Buffer with nonce data
51 | ** \param k Buffer with key data
52 | */
53 | SQLITE_PRIVATE
54 | int ascon_aead_decrypt(uint8_t* mtext, const uint8_t* ctext, uint64_t clen,
55 | const uint8_t* ad, uint64_t adlen,
56 | const uint8_t tag[ASCON_AEAD_TAG_LEN],
57 | const uint8_t nonce[ASCON_AEAD_NONCE_LEN],
58 | const uint8_t k[ASCON_AEAD_KEY_LEN]);
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/src/ascon/crypto_hash.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: hash.c
3 | ** Purpose: API definition for Hash algorithm with Ascon
4 | ** Based on: Public domain Ascon reference implementation
5 | ** and optimized variants for 32- and 64-bit
6 | ** (see https://github.com/ascon/ascon-c)
7 | ** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
8 | ** Modified by: Ulrich Telle
9 | ** Copyright: (c) 2023-2023 Ulrich Telle
10 | ** License: MIT
11 | */
12 |
13 | #ifndef CRYPTO_HASH_H
14 | #define CRYPTO_HASH_H
15 |
16 | #ifndef SQLITE_PRIVATE
17 | #define SQLITE_PRIVATE
18 | #endif
19 |
20 | #include
21 |
22 | /*
23 | ** Derives hash value using ASCON-HASH.
24 | **
25 | ** \param out Output buffer for hash with fixed length of ASCON_HASH_BYTES
26 | ** \param in Buffer with input data
27 | ** \param passwordlen Length of input data in bytes
28 | */
29 | SQLITE_PRIVATE
30 | int ascon_hash(uint8_t* out, const uint8_t* in, uint64_t inlen);
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/ascon/crypto_pbkdf2.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: pbkdf2.h
3 | ** Purpose: API definition of PBKDF2 algoritm with Ascon
4 | ** Password-based key derivation function based on ASCON.
5 | ** (see https://tools.ietf.org/html/rfc8018)
6 | ** Based on: Public domain Ascon reference implementation
7 | ** and optimized variants for 32- and 64-bit
8 | ** (see https://github.com/ascon/ascon-c)
9 | ** and the paper "Additional Modes for ASCON Version 1.1"
10 | ** by Rhys Weatherley, Southern Storm Software, Pty Ltd.
11 | ** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
12 | ** Created by: Ulrich Telle
13 | ** Copyright: (c) 2023-2023 Ulrich Telle
14 | ** License: MIT
15 | */
16 |
17 | #ifndef ASCON_PBKDF2_H
18 | #define ASCON_PBKDF2_H
19 |
20 | #ifndef SQLITE_PRIVATE
21 | #define SQLITE_PRIVATE
22 | #endif
23 |
24 | #include
25 |
26 | /*
27 | ** Default output block size for ASCON-PBKDF2
28 | */
29 | #define ASCON_PBKDF2_SIZE 32
30 |
31 | /*
32 | ** Derives key material using ASCON-PBKDF2.
33 | **
34 | ** \param out Output buffer for generated key material
35 | ** \param outlen Number of bytes in generated key material
36 | ** \param password Password bytes
37 | ** \param passwordlen Length of password in bytes
38 | ** \param salt Salt bytes
39 | ** \param saltlen Number of bytes in the salt
40 | ** \param count Number of iterations to perform
41 | */
42 | SQLITE_PRIVATE
43 | void ascon_pbkdf2(uint8_t* out, uint32_t outlen,
44 | const uint8_t* password, uint32_t passwordlen,
45 | const uint8_t* salt, uint32_t saltlen, uint32_t count)
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/ascon/forceinline.h:
--------------------------------------------------------------------------------
1 | #ifndef FORCEINLINE_H_
2 | #define FORCEINLINE_H_
3 |
4 | /* define forceinline macro */
5 | #ifdef _MSC_VER
6 | #define forceinline __forceinline
7 | #elif defined(__GNUC__)
8 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
9 | #define forceinline inline __attribute__((__always_inline__))
10 | #else
11 | #define forceinline static inline
12 | #endif
13 | #elif defined(__CLANG__)
14 | #if __has_attribute(__always_inline__)
15 | #define forceinline inline __attribute__((__always_inline__))
16 | #else
17 | #define forceinline inline
18 | #endif
19 | #else
20 | #define forceinline inline
21 | #endif
22 |
23 | #endif /* FORCEINLINE_H_ */
24 |
--------------------------------------------------------------------------------
/src/ascon/permutations.c:
--------------------------------------------------------------------------------
1 | #include "permutations.h"
2 |
3 | #if !ASCON_INLINE_PERM && ASCON_UNROLL_LOOPS
4 |
5 | void P12(ascon_state_t* s) { P12ROUNDS(s); }
6 |
7 | #endif
8 |
9 | #if ((defined(ASCON_AEAD_RATE) && ASCON_AEAD_RATE == 16) || \
10 | (defined(ASCON_HASH_ROUNDS) && ASCON_HASH_ROUNDS == 8) || \
11 | (defined(ASCON_PRF_ROUNDS) && ASCON_PRF_ROUNDS == 8)) && \
12 | !ASCON_INLINE_PERM && ASCON_UNROLL_LOOPS
13 |
14 | void P8(ascon_state_t* s) { P8ROUNDS(s); }
15 |
16 | #endif
17 |
18 | #if (defined(ASCON_AEAD_RATE) && ASCON_AEAD_RATE == 8) && \
19 | !ASCON_INLINE_PERM && ASCON_UNROLL_LOOPS
20 |
21 | void P6(ascon_state_t* s) { P6ROUNDS(s); }
22 |
23 | #endif
24 |
25 | #if !ASCON_INLINE_PERM && !ASCON_UNROLL_LOOPS
26 |
27 | void P(ascon_state_t* s, int nr) { PROUNDS(s, nr); }
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/src/ascon/permutations.h:
--------------------------------------------------------------------------------
1 | #ifndef PERMUTATIONS_H_
2 | #define PERMUTATIONS_H_
3 |
4 | #include
5 |
6 | #include "api.h"
7 | #include "ascon.h"
8 | #include "config.h"
9 | #include "constants.h"
10 | #include "printstate.h"
11 | #include "round.h"
12 |
13 | forceinline void ASCON_P12ROUNDS(ascon_state_t* s) {
14 | ASCON_ROUND(s, ASCON_RC0);
15 | ASCON_ROUND(s, ASCON_RC1);
16 | ASCON_ROUND(s, ASCON_RC2);
17 | ASCON_ROUND(s, ASCON_RC3);
18 | ASCON_ROUND(s, ASCON_RC4);
19 | ASCON_ROUND(s, ASCON_RC5);
20 | ASCON_ROUND(s, ASCON_RC6);
21 | ASCON_ROUND(s, ASCON_RC7);
22 | ASCON_ROUND(s, ASCON_RC8);
23 | ASCON_ROUND(s, ASCON_RC9);
24 | ASCON_ROUND(s, ASCON_RCa);
25 | ASCON_ROUND(s, ASCON_RCb);
26 | }
27 |
28 | forceinline void ASCON_P8ROUNDS(ascon_state_t* s) {
29 | ASCON_ROUND(s, ASCON_RC4);
30 | ASCON_ROUND(s, ASCON_RC5);
31 | ASCON_ROUND(s, ASCON_RC6);
32 | ASCON_ROUND(s, ASCON_RC7);
33 | ASCON_ROUND(s, ASCON_RC8);
34 | ASCON_ROUND(s, ASCON_RC9);
35 | ASCON_ROUND(s, ASCON_RCa);
36 | ASCON_ROUND(s, ASCON_RCb);
37 | }
38 |
39 | forceinline void ASCON_P6ROUNDS(ascon_state_t* s) {
40 | ASCON_ROUND(s, ASCON_RC6);
41 | ASCON_ROUND(s, ASCON_RC7);
42 | ASCON_ROUND(s, ASCON_RC8);
43 | ASCON_ROUND(s, ASCON_RC9);
44 | ASCON_ROUND(s, ASCON_RCa);
45 | ASCON_ROUND(s, ASCON_RCb);
46 | }
47 |
48 | #if ASCON_INLINE_PERM && ASCON_UNROLL_LOOPS
49 |
50 | forceinline void ASCON_P(ascon_state_t* s, int nr) {
51 | if (nr == 12) ASCON_P12ROUNDS(s);
52 | if (nr == 8) ASCON_P8ROUNDS(s);
53 | if (nr == 6) ASCON_P6ROUNDS(s);
54 | }
55 |
56 | #elif !ASCON_INLINE_PERM && ASCON_UNROLL_LOOPS
57 |
58 | void ASCON_P12(ascon_state_t* s);
59 | void ASCON_P8(ascon_state_t* s);
60 | void ASCON_P6(ascon_state_t* s);
61 |
62 | forceinline void ASCON_P(ascon_state_t* s, int nr) {
63 | if (nr == 12) ASCON_P12(s);
64 | if (nr == 8) ASCON_P8(s);
65 | if (nr == 6) ASCON_P6(s);
66 | }
67 |
68 | #elif ASCON_INLINE_PERM && !ASCON_UNROLL_LOOPS
69 |
70 | forceinline void ASCON_P(ascon_state_t* s, int nr) { ASCON_PROUNDS(s, nr); }
71 |
72 | #else /* !ASCON_INLINE_PERM && !ASCON_UNROLL_LOOPS */
73 |
74 | void ASCON_P(ascon_state_t* s, int nr);
75 |
76 | #endif
77 |
78 | #endif /* PERMUTATIONS_H_ */
79 |
--------------------------------------------------------------------------------
/src/ascon/printstate.c:
--------------------------------------------------------------------------------
1 | #ifdef ASCON_PRINT_STATE
2 |
3 | #include "printstate.h"
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | #ifndef WORDTOU64
10 | #define WORDTOU64
11 | #endif
12 |
13 | #ifndef U64BIG
14 | #define U64BIG
15 | #endif
16 |
17 | void printword(const char* text, const uint64_t x) {
18 | printf("%s=%016" PRIx64, text, U64BIG(WORDTOU64(x)));
19 | }
20 |
21 | void printstate(const char* text, const ascon_state_t* s) {
22 | int i;
23 | printf("%s:", text);
24 | for (i = strlen(text); i < 17; ++i) printf(" ");
25 | printword(" x0", s->x[0]);
26 | printword(" x1", s->x[1]);
27 | printword(" x2", s->x[2]);
28 | printword(" x3", s->x[3]);
29 | printword(" x4", s->x[4]);
30 | #ifdef ASCON_PRINT_BI
31 | printf(" ");
32 | printf(" x0=%08x_%08x", s->w[0][1], s->w[0][0]);
33 | printf(" x1=%08x_%08x", s->w[1][1], s->w[1][0]);
34 | printf(" x2=%08x_%08x", s->w[2][1], s->w[2][0]);
35 | printf(" x3=%08x_%08x", s->w[3][1], s->w[3][0]);
36 | printf(" x4=%08x_%08x", s->w[4][1], s->w[4][0]);
37 | #endif
38 | printf("\n");
39 | }
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/ascon/printstate.h:
--------------------------------------------------------------------------------
1 | #ifndef PRINTSTATE_H_
2 | #define PRINTSTATE_H_
3 |
4 | #ifdef ASCON_PRINT_STATE
5 |
6 | #include "ascon.h"
7 | #include "word.h"
8 |
9 | void ascon_printword(const char* text, const uint64_t x);
10 | void ascon_printstate(const char* text, const ascon_state_t* s);
11 |
12 | #else
13 |
14 | #define ascon_printword(text, w) \
15 | do { \
16 | } while (0)
17 |
18 | #define ascon_printstate(text, s) \
19 | do { \
20 | } while (0)
21 |
22 | #endif
23 |
24 | #endif /* PRINTSTATE_H_ */
25 |
--------------------------------------------------------------------------------
/src/ascon/prolog.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: prolog.h
3 | ** Purpose: Include important header files, before
4 | ** Based on: Public domain Ascon reference implementation
5 | ** and optimized variants for 32- and 64-bit
6 | ** (see https://github.com/ascon/ascon-c)
7 | ** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
8 | ** Modified by: Ulrich Telle
9 | ** Copyright: (c) 2023-2023 Ulrich Telle
10 | ** License: MIT
11 | */
12 |
13 | #ifndef PROLOG_H
14 | #define PROLOG_H
15 |
16 | #include "word.h"
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/ascon/round.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: round.h
3 | ** Purpose: Selector for Ascon implementation variant for 32- resp 64-bit
4 | ** Based on: Public domain Ascon reference implementation
5 | ** and optimized variants for 32- and 64-bit
6 | ** (see https://github.com/ascon/ascon-c)
7 | ** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
8 | ** Modified by: Ulrich Telle
9 | ** Copyright: (c) 2023-2023 Ulrich Telle
10 | ** License: MIT
11 | */
12 |
13 | #ifndef ROUND_H
14 | #define ROUND_H
15 |
16 | #include "forceinline.h"
17 |
18 | #if defined(__LP64__) || defined(_WIN64)
19 | /* 64-bit machine, Windows or Linux or OS X */
20 | #include "round64.h"
21 | #else
22 | /* 32-bit machine, Windows or Linux or OS X */
23 | #include "round32.h"
24 | #endif
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/ascon/round32.h:
--------------------------------------------------------------------------------
1 | #ifndef ROUND32_H_
2 | #define ROUND32_H_
3 |
4 | #include "ascon.h"
5 | #include "constants.h"
6 | #include "forceinline.h"
7 | #include "printstate.h"
8 | #include "word.h"
9 |
10 | forceinline void ASCON_ROUND(ascon_state_t* s, uint8_t C) {
11 | uint64_t xtemp;
12 | /* round constant */
13 | s->x[2] ^= C;
14 | /* s-box layer */
15 | s->x[0] ^= s->x[4];
16 | s->x[4] ^= s->x[3];
17 | s->x[2] ^= s->x[1];
18 | xtemp = s->x[0] & ~s->x[4];
19 | s->x[0] ^= s->x[2] & ~s->x[1];
20 | s->x[2] ^= s->x[4] & ~s->x[3];
21 | s->x[4] ^= s->x[1] & ~s->x[0];
22 | s->x[1] ^= s->x[3] & ~s->x[2];
23 | s->x[3] ^= xtemp;
24 | s->x[1] ^= s->x[0];
25 | s->x[3] ^= s->x[2];
26 | s->x[0] ^= s->x[4];
27 | s->x[2] = ~s->x[2];
28 | /* linear layer */
29 | s->x[0] ^=
30 | (s->x[0] >> 19) ^ (s->x[0] << 45) ^ (s->x[0] >> 28) ^ (s->x[0] << 36);
31 | s->x[1] ^=
32 | (s->x[1] >> 61) ^ (s->x[1] << 3) ^ (s->x[1] >> 39) ^ (s->x[1] << 25);
33 | s->x[2] ^=
34 | (s->x[2] >> 1) ^ (s->x[2] << 63) ^ (s->x[2] >> 6) ^ (s->x[2] << 58);
35 | s->x[3] ^=
36 | (s->x[3] >> 10) ^ (s->x[3] << 54) ^ (s->x[3] >> 17) ^ (s->x[3] << 47);
37 | s->x[4] ^=
38 | (s->x[4] >> 7) ^ (s->x[4] << 57) ^ (s->x[4] >> 41) ^ (s->x[4] << 23);
39 | ascon_printstate(" round output", s);
40 | }
41 |
42 | forceinline void ASCON_PROUNDS(ascon_state_t* s, int nr) {
43 | int i = ASCON_START(nr);
44 | do {
45 | ASCON_ROUND(s, ASCON_RC(i));
46 | i += ASCON_INC;
47 | } while (i != ASCON_END);
48 | }
49 |
50 | #endif /* ROUND32_H_ */
51 |
--------------------------------------------------------------------------------
/src/ascon/round64.h:
--------------------------------------------------------------------------------
1 | #ifndef ROUND64_H_
2 | #define ROUND64_H_
3 |
4 | #include "ascon.h"
5 | #include "constants.h"
6 | #include "forceinline.h"
7 | #include "printstate.h"
8 | #include "word.h"
9 |
10 | forceinline void ASCON_ROUND(ascon_state_t* s, uint8_t C) {
11 | ascon_state_t t;
12 | /* round constant */
13 | s->x[2] ^= C;
14 | /* s-box layer */
15 | s->x[0] ^= s->x[4];
16 | s->x[4] ^= s->x[3];
17 | s->x[2] ^= s->x[1];
18 | t.x[0] = s->x[0] ^ (~s->x[1] & s->x[2]);
19 | t.x[2] = s->x[2] ^ (~s->x[3] & s->x[4]);
20 | t.x[4] = s->x[4] ^ (~s->x[0] & s->x[1]);
21 | t.x[1] = s->x[1] ^ (~s->x[2] & s->x[3]);
22 | t.x[3] = s->x[3] ^ (~s->x[4] & s->x[0]);
23 | t.x[1] ^= t.x[0];
24 | t.x[3] ^= t.x[2];
25 | t.x[0] ^= t.x[4];
26 | /* linear layer */
27 | s->x[2] = t.x[2] ^ ASCON_ROR(t.x[2], 6 - 1);
28 | s->x[3] = t.x[3] ^ ASCON_ROR(t.x[3], 17 - 10);
29 | s->x[4] = t.x[4] ^ ASCON_ROR(t.x[4], 41 - 7);
30 | s->x[0] = t.x[0] ^ ASCON_ROR(t.x[0], 28 - 19);
31 | s->x[1] = t.x[1] ^ ASCON_ROR(t.x[1], 61 - 39);
32 | s->x[2] = t.x[2] ^ ASCON_ROR(s->x[2], 1);
33 | s->x[3] = t.x[3] ^ ASCON_ROR(s->x[3], 10);
34 | s->x[4] = t.x[4] ^ ASCON_ROR(s->x[4], 7);
35 | s->x[0] = t.x[0] ^ ASCON_ROR(s->x[0], 19);
36 | s->x[1] = t.x[1] ^ ASCON_ROR(s->x[1], 39);
37 | s->x[2] = ~s->x[2];
38 | ascon_printstate(" round output", s);
39 | }
40 |
41 | forceinline void ASCON_PROUNDS(ascon_state_t* s, int nr) {
42 | int i = ASCON_START(nr);
43 | do {
44 | ASCON_ROUND(s, ASCON_RC(i));
45 | i += ASCON_INC;
46 | } while (i != ASCON_END);
47 | }
48 |
49 | #endif /* ROUND64_H_ */
50 |
--------------------------------------------------------------------------------
/src/ascon/word.h:
--------------------------------------------------------------------------------
1 | #ifndef WORD_H_
2 | #define WORD_H_
3 |
4 | #include
5 | #include
6 |
7 | #include "bendian.h"
8 | #include "forceinline.h"
9 |
10 | typedef union {
11 | uint64_t x;
12 | uint32_t w[2];
13 | uint8_t b[8];
14 | } word_t;
15 |
16 | #define ASCON_U64TOWORD(x) ASCON_U64BIG(x)
17 | #define ASCON_WORDTOU64(x) ASCON_U64BIG(x)
18 | #define ASCON_LOAD(b, n) ASCON_LOADBYTES(b, n)
19 | #define ASCON_STORE(b, w, n) ASCON_STOREBYTES(b, w, n)
20 |
21 | forceinline uint64_t ASCON_ROR(uint64_t x, int n) { return x >> n | x << (-n & 63); }
22 |
23 | forceinline uint64_t ASCON_KEYROT(uint64_t lo2hi, uint64_t hi2lo) {
24 | return lo2hi << 32 | hi2lo >> 32;
25 | }
26 |
27 | forceinline int ASCON_NOTZERO(uint64_t a, uint64_t b) {
28 | uint64_t result = a | b;
29 | result |= result >> 32;
30 | result |= result >> 16;
31 | result |= result >> 8;
32 | return ((((int)(result & 0xff) - 1) >> 8) & 1) - 1;
33 | }
34 |
35 | forceinline uint64_t ASCON_PAD(int i) { return 0x80ull << (56 - 8 * i); }
36 |
37 | forceinline uint64_t ASCON_DSEP() { return 0x01; }
38 |
39 | forceinline uint64_t ASCON_PRFS_MLEN(uint64_t len) { return len << 51; }
40 |
41 | forceinline uint64_t ASCON_CLEAR(uint64_t w, int n) {
42 | /* undefined for n == 0 */
43 | uint64_t mask = ~0ull >> (8 * n);
44 | return w & mask;
45 | }
46 |
47 | forceinline uint64_t ASCON_MASK(int n) {
48 | /* undefined for n == 0 */
49 | return ~0ull >> (64 - 8 * n);
50 | }
51 |
52 | forceinline uint64_t ASCON_LOADBYTES(const uint8_t* bytes, int n) {
53 | uint64_t x = 0;
54 | memcpy(&x, bytes, n);
55 | return ASCON_U64TOWORD(x);
56 | }
57 |
58 | forceinline void ASCON_STOREBYTES(uint8_t* bytes, uint64_t w, int n) {
59 | uint64_t x = ASCON_WORDTOU64(w);
60 | memcpy(bytes, &x, n);
61 | }
62 |
63 | #endif /* WORD_H_ */
64 |
--------------------------------------------------------------------------------
/src/carray.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** 2020-11-17
3 | **
4 | ** The author disclaims copyright to this source code. In place of
5 | ** a legal notice, here is a blessing:
6 | **
7 | ** May you do good and not evil.
8 | ** May you find forgiveness for yourself and forgive others.
9 | ** May you share freely, never taking more than you give.
10 | **
11 | *************************************************************************
12 | **
13 | ** Interface definitions for the CARRAY table-valued function
14 | ** extension.
15 | */
16 |
17 | #ifndef _CARRAY_H
18 | #define _CARRAY_H
19 |
20 | #include "sqlite3.h" /* Required for error code definitions */
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | /* Use this interface to bind an array to the single-argument version
27 | ** of CARRAY().
28 | */
29 | SQLITE_API int sqlite3_carray_bind(
30 | sqlite3_stmt *pStmt, /* Statement to be bound */
31 | int i, /* Parameter index */
32 | void *aData, /* Pointer to array data */
33 | int nData, /* Number of data elements */
34 | int mFlags, /* CARRAY flags */
35 | void (*xDel)(void*) /* Destructgor for aData*/
36 | );
37 |
38 | /* Allowed values for the mFlags parameter to sqlite3_carray_bind().
39 | */
40 | #define CARRAY_INT32 0 /* Data is 32-bit signed integers */
41 | #define CARRAY_INT64 1 /* Data is 64-bit signed integers */
42 | #define CARRAY_DOUBLE 2 /* Data is doubles */
43 | #define CARRAY_TEXT 3 /* Data is char* */
44 | #define CARRAY_BLOB 4 /* Data is struct iovec */
45 |
46 | #ifdef __cplusplus
47 | } /* end of the 'extern "C"' block */
48 | #endif
49 |
50 | #endif /* ifndef _CARRAY_H */
51 |
--------------------------------------------------------------------------------
/src/cipher_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: cipher_config.h
3 | ** Purpose: Header for the cipher configuration of SQLite3 Multiple Ciphers
4 | ** Author: Ulrich Telle
5 | ** Created: 2020-03-10
6 | ** Copyright: (c) 2006-2020 Ulrich Telle
7 | ** License: MIT
8 | */
9 |
10 | #ifndef CIPHER_CONFIG_H_
11 | #define CIPHER_CONFIG_H_
12 |
13 | #include "sqlite3mc.h"
14 |
15 | SQLITE_PRIVATE void sqlite3mcConfigTable(sqlite3_context* context, int argc, sqlite3_value** argv);
16 | SQLITE_PRIVATE CodecParameter* sqlite3mcGetCodecParams(sqlite3* db);
17 |
18 | /* Forward declaration */
19 | SQLITE_PRIVATE unsigned char* sqlite3mcGetSaltWriteCipher(Codec* codec);
20 |
21 | SQLITE_PRIVATE void sqlite3mcCodecDataSql(sqlite3_context* context, int argc, sqlite3_value** argv);
22 | SQLITE_PRIVATE void sqlite3mcConfigParams(sqlite3_context* context, int argc, sqlite3_value** argv);
23 | SQLITE_PRIVATE int sqlite3mcConfigureFromUri(sqlite3* db, const char *zDbName, int configDefault);
24 |
25 | SQLITE_PRIVATE int sqlite3mcFileControlPragma(sqlite3* db, const char* zDbName, int op, void* pArg);
26 | SQLITE_PRIVATE int sqlite3mcCodecQueryParameters(sqlite3* db, const char* zDb, const char* zUri);
27 | SQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3* db, const char* zName, const char* zPath, sqlite3_value* pKey, char** zErrDyn);
28 | SQLITE_PRIVATE int sqlite3mcHandleMainKey(sqlite3* db, const char* zPath);
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/mystdint.h:
--------------------------------------------------------------------------------
1 | #ifndef MY_STDINT_H_
2 | #define MY_STDINT_H_
3 |
4 | /*
5 | ** MS Visual C++ 2008 and below do not provide the header file
6 | ** That is, we need to define the necessary types ourselves
7 | */
8 |
9 | #if defined(_MSC_VER) && (_MSC_VER < 1600)
10 | typedef signed char int8_t;
11 | typedef short int16_t;
12 | typedef int int32_t;
13 | typedef long long int64_t;
14 | typedef unsigned char uint8_t;
15 | typedef unsigned short uint16_t;
16 | typedef unsigned int uint32_t;
17 | typedef unsigned long long uint64_t;
18 |
19 | #define UINT8_MAX 255
20 | #define UINT16_MAX 65535
21 | #define UINT32_MAX 0xffffffffU /* 4294967295U */
22 | #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
23 | #else
24 | #include
25 | #endif
26 |
27 | #endif /* MY_STDINT_H_ */
28 |
--------------------------------------------------------------------------------
/src/sha1.h:
--------------------------------------------------------------------------------
1 | /* public api for steve reid's public domain SHA-1 implementation */
2 | /* this file is in the public domain */
3 |
4 | #ifndef SHA1_H_
5 | #define SHA1_H_ (1)
6 |
7 | #ifndef SQLITE_PRIVATE
8 | #define SQLITE_PRIVATE
9 | #endif
10 |
11 | /** SHA-1 Context */
12 | typedef struct {
13 | uint32_t h[5];
14 | /**< Context state */
15 | uint32_t count[2];
16 | /**< Counter */
17 | uint8_t buffer[64]; /**< SHA-1 buffer */
18 | } sha1_ctx;
19 |
20 | #define SHA1_BLOCK_SIZE 64
21 | /** SHA-1 Digest size in bytes */
22 | #define SHA1_DIGEST_SIZE 20
23 |
24 | SQLITE_PRIVATE void sha1_init(sha1_ctx *context);
25 |
26 | SQLITE_PRIVATE void sha1_update(sha1_ctx *context, const void *p, size_t len);
27 |
28 | SQLITE_PRIVATE void sha1_final(sha1_ctx *context, uint8_t digest[SHA1_DIGEST_SIZE]);
29 |
30 | SQLITE_PRIVATE void sha1_transform(sha1_ctx *context, const uint8_t buffer[64]);
31 |
32 | #endif /* SHA1_H_ */
33 |
--------------------------------------------------------------------------------
/src/sqlite370.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/src/sqlite370.ico
--------------------------------------------------------------------------------
/src/sqlite3mc.rc:
--------------------------------------------------------------------------------
1 | #ifdef APSTUDIO_INVOKED
2 | #error This file is not editable by Microsoft Visual C++
3 | #endif /* APSTUDIO_INVOKED */
4 |
5 | /*
6 | ** SQLITE3MC_STRINGIZE works as the preprocessor # operator but also works with macros
7 | */
8 | #define SQLITE3MC_STRINGIZE_HELPER(x) #x
9 | #define SQLITE3MC_STRINGIZE(x) SQLITE3MC_STRINGIZE_HELPER(x)
10 |
11 | /*
12 | ** Version
13 | */
14 | #include "sqlite3mc_version.h"
15 | #include
16 |
17 | #define SQLITE3MC_MAKE_VERSION_DOT_STRING(x, y, z, w) \
18 | SQLITE3MC_STRINGIZE(x) "." SQLITE3MC_STRINGIZE(y) "." SQLITE3MC_STRINGIZE(z) "." SQLITE3MC_STRINGIZE(w)
19 |
20 | #define SQLITE3MC_FILE_VERSION_NUM_DOT_STRING \
21 | SQLITE3MC_MAKE_VERSION_DOT_STRING(SQLITE3MC_VERSION_MAJOR, SQLITE3MC_VERSION_MINOR, SQLITE3MC_VERSION_RELEASE, SQLITE3MC_VERSION_SUBRELEASE)
22 | #define SQLITE3MC_PROD_VERSION_NUM_DOT_STRING \
23 | SQLITE3MC_MAKE_VERSION_DOT_STRING(SQLITE3MC_VERSION_MAJOR, SQLITE3MC_VERSION_MINOR, SQLITE3MC_VERSION_RELEASE, SQLITE3MC_VERSION_SUBRELEASE)
24 |
25 | // 0x0409 is US English, 0x04b0 is Unicode and 0x0000 is 7 bit ASCII. see
26 | // http://msdn.microsoft.com/en-us/library/aa381049(VS.85).aspx for the full
27 | // list of languages and charsets
28 | #define LANG 0x0409
29 | #ifdef _UNICODE
30 | #define CHARSET 0x4b0
31 | #define LANG_WITH_CHARSET "040904b0"
32 | #else
33 | #define CHARSET 0
34 | #define LANG_WITH_CHARSET "04090000"
35 | #endif
36 |
37 | VS_VERSION_INFO VERSIONINFO
38 | FILEVERSION SQLITE3MC_VERSION_MAJOR,SQLITE3MC_VERSION_MINOR,SQLITE3MC_VERSION_RELEASE,SQLITE3MC_VERSION_SUBRELEASE
39 | PRODUCTVERSION SQLITE3MC_VERSION_MAJOR,SQLITE3MC_VERSION_MINOR,SQLITE3MC_VERSION_RELEASE,SQLITE3MC_VERSION_SUBRELEASE
40 | FILEFLAGSMASK 0x3fL
41 | #ifdef _DEBUG
42 | FILEFLAGS 0x1L
43 | #else
44 | FILEFLAGS 0x0L
45 | #endif
46 | FILEOS VOS_NT_WINDOWS32
47 | FILETYPE VFT_DLL
48 | FILESUBTYPE 0x0L
49 | BEGIN
50 | BLOCK "StringFileInfo"
51 | BEGIN
52 | BLOCK LANG_WITH_CHARSET
53 | BEGIN
54 | VALUE "CompanyName", "SQLite3 Multiple Ciphers Development Team"
55 | VALUE "FileDescription", "SQLite3 Multiple Ciphers Database Library"
56 | VALUE "FileVersion", SQLITE3MC_FILE_VERSION_NUM_DOT_STRING
57 | VALUE "InternalName", "sqlite3mc.dll"
58 | VALUE "LegalCopyright", "Copyright (C) 2019-2023, Ulrich Telle"
59 | VALUE "OriginalFilename", "sqlite3mc.dll"
60 | VALUE "ProductName", "SQLite3 Multiple Ciphers"
61 | VALUE "ProductVersion", SQLITE3MC_PROD_VERSION_NUM_DOT_STRING
62 | END
63 | END
64 | BLOCK "VarFileInfo"
65 | BEGIN
66 | VALUE "Translation", LANG, CHARSET
67 | END
68 | END
69 |
--------------------------------------------------------------------------------
/src/sqlite3mc_shell.rc:
--------------------------------------------------------------------------------
1 | #ifdef APSTUDIO_INVOKED
2 | #error This file is not editable by Microsoft Visual C++
3 | #endif /* APSTUDIO_INVOKED */
4 |
5 | /*
6 | ** SQLITE3MC_STRINGIZE works as the preprocessor # operator but also works with macros
7 | */
8 | #define SQLITE3MC_STRINGIZE_HELPER(x) #x
9 | #define SQLITE3MC_STRINGIZE(x) SQLITE3MC_STRINGIZE_HELPER(x)
10 |
11 | /*
12 | ** Version
13 | */
14 | ID_SQLITE3 ICON "sqlite370.ico"
15 |
16 | #include "sqlite3mc_version.h"
17 | #include
18 |
19 | #define SQLITE3MC_MAKE_VERSION_DOT_STRING(x, y, z, w) \
20 | SQLITE3MC_STRINGIZE(x) "." SQLITE3MC_STRINGIZE(y) "." SQLITE3MC_STRINGIZE(z) "." SQLITE3MC_STRINGIZE(w)
21 |
22 | #define SQLITE3MC_FILE_VERSION_NUM_DOT_STRING \
23 | SQLITE3MC_MAKE_VERSION_DOT_STRING(SQLITE3MC_VERSION_MAJOR, SQLITE3MC_VERSION_MINOR, SQLITE3MC_VERSION_RELEASE, SQLITE3MC_VERSION_SUBRELEASE)
24 | #define SQLITE3MC_PROD_VERSION_NUM_DOT_STRING \
25 | SQLITE3MC_MAKE_VERSION_DOT_STRING(SQLITE3MC_VERSION_MAJOR, SQLITE3MC_VERSION_MINOR, SQLITE3MC_VERSION_RELEASE, SQLITE3MC_VERSION_SUBRELEASE)
26 |
27 | // 0x0409 is US English, 0x04b0 is Unicode and 0x0000 is 7 bit ASCII. see
28 | // http://msdn.microsoft.com/en-us/library/aa381049(VS.85).aspx for the full
29 | // list of languages and charsets
30 | #define LANG 0x0409
31 | #ifdef _UNICODE
32 | #define CHARSET 0x4b0
33 | #define LANG_WITH_CHARSET "040904b0"
34 | #else
35 | #define CHARSET 0
36 | #define LANG_WITH_CHARSET "04090000"
37 | #endif
38 |
39 | VS_VERSION_INFO VERSIONINFO
40 | FILEVERSION SQLITE3MC_VERSION_MAJOR,SQLITE3MC_VERSION_MINOR,SQLITE3MC_VERSION_RELEASE,SQLITE3MC_VERSION_SUBRELEASE
41 | PRODUCTVERSION SQLITE3MC_VERSION_MAJOR,SQLITE3MC_VERSION_MINOR,SQLITE3MC_VERSION_RELEASE,SQLITE3MC_VERSION_SUBRELEASE
42 | FILEFLAGSMASK 0x3fL
43 | #ifdef _DEBUG
44 | FILEFLAGS 0x1L
45 | #else
46 | FILEFLAGS 0x0L
47 | #endif
48 | FILEOS VOS_NT_WINDOWS32
49 | FILETYPE VFT_APP
50 | FILESUBTYPE 0x0L
51 | BEGIN
52 | BLOCK "StringFileInfo"
53 | BEGIN
54 | BLOCK LANG_WITH_CHARSET
55 | BEGIN
56 | VALUE "CompanyName", "SQLite3 Multiple Ciphers Development Team"
57 | VALUE "FileDescription", "SQLite3 Multiple Ciphers Database Shell"
58 | VALUE "FileVersion", SQLITE3MC_FILE_VERSION_NUM_DOT_STRING
59 | VALUE "InternalName", "sqlite3mc_shell.exe"
60 | VALUE "LegalCopyright", "Copyright (C) 2019-2023, Ulrich Telle"
61 | VALUE "OriginalFilename", "sqlite3mc_shell.exe"
62 | VALUE "ProductName", "SQLite3 Multiple Ciphers"
63 | VALUE "ProductVersion", SQLITE3MC_PROD_VERSION_NUM_DOT_STRING
64 | END
65 | END
66 | BLOCK "VarFileInfo"
67 | BEGIN
68 | VALUE "Translation", LANG, CHARSET
69 | END
70 | END
71 |
--------------------------------------------------------------------------------
/src/sqlite3mc_version.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: sqlite3mc_version.h
3 | ** Purpose: SQLite3 Multiple Ciphers version numbers
4 | ** Author: Ulrich Telle
5 | ** Created: 2020-08-05
6 | ** Copyright: (c) 2020-2025 Ulrich Telle
7 | ** License: MIT
8 | */
9 |
10 | /// \file sqlite3mc_version.h Version information for the SQLite3 Multiple Ciphers library
11 |
12 | #ifndef SQLITE3MC_VERSION_H_
13 | #define SQLITE3MC_VERSION_H_
14 |
15 | #define SQLITE3MC_VERSION_MAJOR 2
16 | #define SQLITE3MC_VERSION_MINOR 1
17 | #define SQLITE3MC_VERSION_RELEASE 3
18 | #define SQLITE3MC_VERSION_SUBRELEASE 0
19 | #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.1.3"
20 |
21 | #endif /* SQLITE3MC_VERSION_H_ */
22 |
--------------------------------------------------------------------------------
/src/sqlite3mc_vfs.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: sqlite3mc_vfs.h
3 | ** Purpose: Header file for VFS of SQLite3 Multiple Ciphers support
4 | ** Author: Ulrich Telle
5 | ** Created: 2020-03-01
6 | ** Copyright: (c) 2020-2023 Ulrich Telle
7 | ** License: MIT
8 | */
9 |
10 | #ifndef SQLITE3MC_VFS_H_
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | #ifndef SQLITE_PRIVATE
17 | #define SQLITE_PRIVATE
18 | #endif
19 |
20 | SQLITE_PRIVATE int sqlite3mcCheckVfs(const char* zVfs);
21 |
22 | SQLITE_API int sqlite3mc_vfs_create(const char* zVfsReal, int makeDefault);
23 | SQLITE_API void sqlite3mc_vfs_destroy(const char* zName);
24 | SQLITE_API void sqlite3mc_vfs_shutdown();
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
30 | #endif /* SQLITE3MC_VFS_H_ */
31 |
--------------------------------------------------------------------------------
/src/zlibwrap.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Name: zlibwrap.h
3 | ** Purpose: Include wrapper for miniz.h
4 | ** Author: Ulrich Telle
5 | ** Created: 2022-05-09
6 | ** Copyright: (c) 2022 Ulrich Telle
7 | ** License: MIT
8 | */
9 |
10 | /// \file zlibwrap.h Include wrapper for using miniz.h instead of the original zlib.h
11 |
12 | #ifndef SQLITE3MC_ZLIBWRAP_H_
13 | #define SQLITE3MC_ZLIBWRAP_H_
14 |
15 | #if SQLITE3MC_USE_MINIZ != 0
16 | #include "miniz.h"
17 | #else
18 | #include
19 | #endif
20 |
21 |
22 | #endif /* SQLITE3MC_ZLIBWRAP_H_ */
23 |
--------------------------------------------------------------------------------
/test/sqlcipher-1.1.8-testkey.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/test/sqlcipher-1.1.8-testkey.db
--------------------------------------------------------------------------------
/test/sqlcipher-2.0-be-testkey.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/test/sqlcipher-2.0-be-testkey.db
--------------------------------------------------------------------------------
/test/sqlcipher-2.0-beta-testkey.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/test/sqlcipher-2.0-beta-testkey.db
--------------------------------------------------------------------------------
/test/sqlcipher-2.0-le-testkey.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/test/sqlcipher-2.0-le-testkey.db
--------------------------------------------------------------------------------
/test/sqlcipher-3.0-testkey.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/test/sqlcipher-3.0-testkey.db
--------------------------------------------------------------------------------
/test/sqlcipher-4.0-testkey.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utelle/SQLite3MultipleCiphers/8d0f02065fad3dacdfbb0bcbe59bd344d5d038bf/test/sqlcipher-4.0-testkey.db
--------------------------------------------------------------------------------
/test/sqlciphertest.sql:
--------------------------------------------------------------------------------
1 | .echo on
2 | -- Test to access database encrypted with SQLCipher version 1
3 | -- Result: 75709 1 1 one one 1 2 one two 1 2
4 | .open test/sqlcipher-1.1.8-testkey.db
5 | pragma cipher='sqlcipher';
6 | pragma legacy=1;
7 | pragma key='testkey';
8 | SELECT COUNT(*) FROM t1;
9 | SELECT DISTINCT * FROM t1;
10 |
11 | -- Test to access database encrypted with SQLCipher version 2
12 | -- using 4000 iterations for the HMAC key derivation and a HMAC salt mask of zero
13 | -- Result: 38768 test-0-0 test-0-1 test-1-0 test-1-1
14 | .open test/sqlcipher-2.0-beta-testkey.db
15 | pragma cipher='sqlcipher';
16 | pragma legacy=2;
17 | pragma fast_kdf_iter=4000;
18 | pragma hmac_salt_mask=0;
19 | pragma key='testkey';
20 | SELECT COUNT(*) FROM t1;
21 | SELECT DISTINCT * FROM t1;
22 |
23 | -- Test to access database encrypted with SQLCipher version 2
24 | -- using the page number in big endian form (BE) for the HMAC calculation
25 | -- Result: 78536 1 1 one one 1 2 one two
26 | .open test/sqlcipher-2.0-be-testkey.db
27 | pragma cipher='sqlcipher';
28 | pragma legacy=2;
29 | pragma hmac_pgno=2;
30 | pragma key='testkey';
31 | SELECT COUNT(*) FROM t1;
32 | SELECT DISTINCT * FROM t1;
33 |
34 | -- Test to access database encrypted with SQLCipher version 2
35 | -- using the page number in little endian form (LE) for the HMAC calculation
36 | -- Note: No change to the default initialization necessary
37 | -- Result: 78536 1 1 one one 1 2 one two
38 | .open test/sqlcipher-2.0-le-testkey.db
39 | pragma cipher='sqlcipher';
40 | pragma legacy=2;
41 | pragma key='testkey';
42 | SELECT COUNT(*) FROM t1;
43 | SELECT DISTINCT * FROM t1;
44 |
45 | -- // Test to access database encrypted with SQLCipher version 3
46 | -- // Result: 78536 1 1 one one 1 2 one two
47 | .open test/sqlcipher-3.0-testkey.db
48 | pragma cipher='sqlcipher';
49 | pragma legacy=3;
50 | pragma key='testkey';
51 | SELECT COUNT(*) FROM t1;
52 | SELECT DISTINCT * FROM t1;
53 |
54 | -- // Test to access database encrypted with SQLCipher version 4
55 | -- // Result: 78536 1 1 one one 1 2 one two
56 | .open test/sqlcipher-4.0-testkey.db
57 | pragma cipher='sqlcipher';
58 | pragma legacy=4;
59 | pragma key='testkey';
60 | SELECT COUNT(*) FROM t1;
61 | SELECT DISTINCT * FROM t1;
62 |
--------------------------------------------------------------------------------
/test/test1.sql:
--------------------------------------------------------------------------------
1 | .echo on
2 | pragma cipher='sqlcipher';
3 | pragma legacy=4;
4 | pragma key='test1';
5 | create table t1 (c1 int, c2 char);
6 | insert into t1 values (1,'Alf');
7 | insert into t1 values (2,'Bert');
8 | insert into t1 values (3,'Cecil');
9 | insert into t1 values (4,'Donald');
10 | select * from t1;
11 | .q
12 |
--------------------------------------------------------------------------------
/test/test2.sql:
--------------------------------------------------------------------------------
1 | .echo on
2 | pragma cipher='sqlcipher';
3 | pragma key='test2';
4 | create table t1 (c1 int, c2 char);
5 | insert into t1 values (1,'Alf');
6 | insert into t1 values (2,'Bert');
7 | insert into t1 values (3,'Cecil');
8 | insert into t1 values (4,'Donald');
9 | insert into t1 values (5,'Ernie');
10 | select * from t1;
11 | .q
12 |
--------------------------------------------------------------------------------