Skip to content

Commit 77ce86b

Browse files
authored
Revert patching the xoshiro functions to use sqlite_uint64 (sqlcipher/sqlcipher#542) (#6)
1 parent 7679808 commit 77ce86b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ let package = Package(
6363
.define("SQLITE_EXTRA_INIT", to: "sqlcipher_extra_init"),
6464
.define("SQLITE_EXTRA_SHUTDOWN", to: "sqlcipher_extra_shutdown"),
6565
.define("HAVE_GETHOSTUUID", to: "0"),
66+
.define("HAVE_STDINT_H"),
6667
.define("SQLCIPHER_CRYPTO_LIBTOMCRYPT"),
6768
],
6869
linkerSettings: [.linkedLibrary("log", .when(platforms: [.android]))]),

Sources/SQLCipher/sqlite/sqlite3.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107711,15 +107711,15 @@ struct private_block {
107711107711
* https://prng.di.unimi.it/ under the public domain via https://prng.di.unimi.it/xoshiro256plusplus.c
107712107712
* xoshiro is NEVER used for any cryptographic functions as CSPRNG. It is solely used for
107713107713
* generating random data for testing, debugging, and forensic purposes (overwriting memory segments) */
107714-
static volatile sqlite_uint64 xoshiro_s[4];
107714+
static volatile uint64_t xoshiro_s[4];
107715107715

107716-
static inline sqlite_uint64 xoshiro_rotl(const sqlite_uint64 x, int k) {
107716+
static inline uint64_t xoshiro_rotl(const uint64_t x, int k) {
107717107717
return (x << k) | (x >> (64 - k));
107718107718
}
107719107719

107720-
sqlite_uint64 xoshiro_next(void) {
107721-
volatile sqlite_uint64 result = xoshiro_rotl(xoshiro_s[0] + xoshiro_s[3], 23) + xoshiro_s[0];
107722-
volatile sqlite_uint64 t = xoshiro_s[1] << 17;
107720+
uint64_t xoshiro_next(void) {
107721+
volatile uint64_t result = xoshiro_rotl(xoshiro_s[0] + xoshiro_s[3], 23) + xoshiro_s[0];
107722+
volatile uint64_t t = xoshiro_s[1] << 17;
107723107723

107724107724
xoshiro_s[2] ^= xoshiro_s[0];
107725107725
xoshiro_s[3] ^= xoshiro_s[1];
@@ -107734,7 +107734,7 @@ sqlite_uint64 xoshiro_next(void) {
107734107734
}
107735107735

107736107736
static void xoshiro_randomness(unsigned char *ptr, int sz) {
107737-
volatile sqlite_uint64 val;
107737+
volatile uint64_t val;
107738107738
volatile int to_copy;
107739107739
while (sz > 0) {
107740107740
val = xoshiro_next();

0 commit comments

Comments
 (0)