summaryrefslogtreecommitdiff
path: root/test/crypto.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2013-08-13 15:43:01 -0400
committerHans-Christoph Steiner <hans@eds.org>2013-08-13 15:43:01 -0400
commit4228998fd796fa2f9e84fb73632e0a07cc7cd188 (patch)
tree15b2336f351468fedd0c39e9de4ad905a686f3b0 /test/crypto.test
parentbdee7cf7d974b2f70d5934786c5666006e7360be (diff)
parent08119c361d1181b3e8f1abb429236e488a664753 (diff)
Merge tag 'upstream/2.2.1'
Upstream version 2.2.1 # gpg: Signature made Tue 13 Aug 2013 03:42:56 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]" # gpg: aka "Hans-Christoph Steiner <hs420@nyu.edu>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hansi@nyu.edu>" # gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>"
Diffstat (limited to 'test/crypto.test')
-rw-r--r--test/crypto.test52
1 files changed, 49 insertions, 3 deletions
diff --git a/test/crypto.test b/test/crypto.test
index e8bbe85..8a58fe0 100644
--- a/test/crypto.test
+++ b/test/crypto.test
@@ -62,6 +62,32 @@ proc setup {file key} {
db close
}
+proc get_cipher_provider {} {
+ sqlite_orig db test.db
+ return [execsql {
+ PRAGMA key = 'test';
+ PRAGMA cipher_provider;
+ }];
+}
+
+proc if_built_with_openssl {name cmd expected} {
+ if {[get_cipher_provider] == "openssl"} {
+ do_test $name $cmd $expected
+ }
+}
+
+proc if_built_with_libtomcrypt {name cmd expected} {
+ if {[get_cipher_provider] == "libtomcrypt"} {
+ do_test $name $cmd $expected
+ }
+}
+
+proc if_built_with_commoncrypto {name cmd expected} {
+ if {[get_cipher_provider] == "commoncrypto"} {
+ do_test $name $cmd $expected
+ }
+}
+
# The database is initially empty.
# set an hex key create some basic data
# create table and insert operations should work
@@ -1392,7 +1418,7 @@ do_test verify-pragma-cipher-version {
execsql {
PRAGMA cipher_version;
}
-} {2.1.1}
+} {2.2.1}
db close
file delete -force test.db
@@ -1735,7 +1761,7 @@ file delete -force test.db
# verify the pragma cipher
# reports the default value
-do_test verify-pragma-cipher-default {
+if_built_with_openssl verify-pragma-cipher-default {
sqlite_orig db test.db
execsql {
PRAGMA key = 'test';
@@ -1747,7 +1773,7 @@ file delete -force test.db
# verify the pragma cipher
# reports a change in value
-do_test verify-pragma-cipher-changed {
+if_built_with_openssl verify-pragma-cipher-changed {
sqlite_orig db test.db
execsql {
PRAGMA key = 'test';
@@ -1856,4 +1882,24 @@ do_test 2.0-beta-to-2.0-migration {
db close
file delete -force test.db
+if_built_with_libtomcrypt verify-default-cipher {
+ sqlite_orig db test.db
+ execsql {
+ PRAGMA key='test';
+ PRAGMA cipher;
+ }
+} {rijndael}
+db close
+file delete -force test.db
+
+if_built_with_commoncrypto verify-default-cipher {
+ sqlite_orig db test.db
+ execsql {
+ PRAGMA key='test';
+ PRAGMA cipher;
+ }
+} {aes-256-cbc}
+db close
+file delete -force test.db
+
finish_test