Skip to content

Commit 9c94733

Browse files
Adding tests for checking initial value and changes to the following
PRAGMAs: cipher_use_hmac, cipher_default_use_hmac, kdf_iter, cipher_page_size
1 parent 69ef105 commit 9c94733

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

test/crypto.test

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,4 +1606,102 @@ do_test be-to-le-migration {
16061606
db close
16071607
file delete -force test.db
16081608

1609+
# verify the pragma cipher_use_hmac
1610+
# is set to true be default
1611+
do_test verify-pragma-cipher-use-hmac-default {
1612+
sqlite_orig db test.db
1613+
execsql {
1614+
PRAGMA key = 'test';
1615+
PRAGMA cipher_use_hmac;
1616+
}
1617+
} {1}
1618+
db close
1619+
file delete -force test.db
1620+
1621+
# verify the pragma cipher_use_hmac
1622+
# reports the flag turned off
1623+
do_test verify-pragma-cipher-use-hmac-off {
1624+
sqlite_orig db test.db
1625+
execsql {
1626+
PRAGMA key = 'test';
1627+
PRAGMA cipher_use_hmac = off;
1628+
PRAGMA cipher_use_hmac;
1629+
}
1630+
} {0}
1631+
db close
1632+
file delete -force test.db
1633+
1634+
# verify the pragma default_cipher_use_hmac
1635+
# is set to true by default
1636+
do_test verify-pragma-cipher-default-use-hmac-default {
1637+
sqlite_orig db test.db
1638+
execsql {
1639+
PRAGMA cipher_default_use_hmac;
1640+
}
1641+
} {1}
1642+
db close
1643+
file delete -force test.db
1644+
1645+
# verify the pragma default_cipher_use_hmac
1646+
# reports the flag turned off
1647+
do_test verify-pragma-cipher-default-use-hmac-off {
1648+
sqlite_orig db test.db
1649+
execsql {
1650+
PRAGMA cipher_default_use_hmac = off;
1651+
PRAGMA cipher_default_use_hmac;
1652+
}
1653+
} {0}
1654+
db close
1655+
file delete -force test.db
1656+
1657+
# verify the pragma kdf_iter
1658+
# reports the default value
1659+
do_test verify-pragma-kdf-iter-reports-default {
1660+
sqlite_orig db test.db
1661+
execsql {
1662+
PRAGMA key = 'test';
1663+
PRAGMA kdf_iter;
1664+
}
1665+
} {4000}
1666+
db close
1667+
file delete -force test.db
1668+
1669+
# verify the pragma kdf_iter
1670+
# reports value changed
1671+
do_test verify-pragma-kdf-iter-reports-value-changed {
1672+
sqlite_orig db test.db
1673+
execsql {
1674+
PRAGMA key = 'test';
1675+
PRAGMA kdf_iter = 8000;
1676+
PRAGMA kdf_iter;
1677+
}
1678+
} {8000}
1679+
db close
1680+
file delete -force test.db
1681+
1682+
# verify the pragma cipher_page_size
1683+
# reports default value
1684+
do_test verify-pragma-cipher-page-size-default {
1685+
sqlite_orig db test.db
1686+
execsql {
1687+
PRAGMA key = 'test';
1688+
PRAGMA cipher_page_size;
1689+
}
1690+
} {1024}
1691+
db close
1692+
file delete -force test.db
1693+
1694+
# verify the pragma cipher_page_size
1695+
# reports change in value
1696+
do_test verify-pragma-cipher-page-size-changed {
1697+
sqlite_orig db test.db
1698+
execsql {
1699+
PRAGMA key = 'test';
1700+
PRAGMA cipher_page_size = 4096;
1701+
PRAGMA cipher_page_size;
1702+
}
1703+
} {4096}
1704+
db close
1705+
file delete -force test.db
1706+
16091707
finish_test

0 commit comments

Comments
 (0)