Skip to content

Commit 51079a8

Browse files
committed
resolve build warnings under clang
1 parent 9b1a921 commit 51079a8

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

src/crypto_cc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ static int sqlcipher_cc_hmac(void *ctx, unsigned char *hmac_key, int key_sz, uns
5454
return SQLITE_OK;
5555
}
5656

57-
static int sqlcipher_cc_kdf(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {
57+
static int sqlcipher_cc_kdf(void *ctx, const char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {
5858
CCKeyDerivationPBKDF(kCCPBKDF2, pass, pass_sz, salt, salt_sz, kCCPRFHmacAlgSHA1, workfactor, key, key_sz);
5959
return SQLITE_OK;
6060
}
6161

6262
static int sqlcipher_cc_cipher(void *ctx, int mode, unsigned char *key, int key_sz, unsigned char *iv, unsigned char *in, int in_sz, unsigned char *out) {
6363
CCCryptorRef cryptor;
64-
CCOptions cryptor_options;
6564
size_t tmp_csz, csz;
6665
CCOperation op = mode == CIPHER_ENCRYPT ? kCCEncrypt : kCCDecrypt;
6766

@@ -133,6 +132,7 @@ int sqlcipher_cc_setup(sqlcipher_provider *p) {
133132
p->ctx_cmp = sqlcipher_cc_ctx_cmp;
134133
p->ctx_init = sqlcipher_cc_ctx_init;
135134
p->ctx_free = sqlcipher_cc_ctx_free;
135+
return SQLITE_OK;
136136
}
137137

138138
#endif

src/crypto_impl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ int sqlcipher_register_provider(sqlcipher_provider *p) {
8585
sqlcipher_free(default_provider, sizeof(sqlcipher_provider));
8686
}
8787
default_provider = p;
88+
return SQLITE_OK;
8889
}
8990

9091
void sqlcipher_activate() {
@@ -637,7 +638,7 @@ static int sqlcipher_page_hmac(cipher_ctx *ctx, Pgno pgno, unsigned char *in, in
637638
int sqlcipher_page_cipher(codec_ctx *ctx, int for_ctx, Pgno pgno, int mode, int page_sz, unsigned char *in, unsigned char *out) {
638639
cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;
639640
unsigned char *iv_in, *iv_out, *hmac_in, *hmac_out, *out_start;
640-
int tmp_csz, csz, size;
641+
int size;
641642

642643
/* calculate some required positions into various buffers */
643644
size = page_sz - c_ctx->reserve_sz; /* adjust size to useable size and memset reserve at end of page */
@@ -733,7 +734,7 @@ static int sqlcipher_cipher_ctx_key_derive(codec_ctx *ctx, cipher_ctx *c_ctx) {
733734
cipher_hex2bin(z, n, c_ctx->key);
734735
} else {
735736
CODEC_TRACE(("codec_key_derive: deriving key using full PBKDF2 with %d iterations\n", c_ctx->kdf_iter));
736-
c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->pass, c_ctx->pass_sz,
737+
c_ctx->provider->kdf(c_ctx->provider_ctx, (const char*) c_ctx->pass, c_ctx->pass_sz,
737738
ctx->kdf_salt, ctx->kdf_salt_sz, c_ctx->kdf_iter,
738739
c_ctx->key_sz, c_ctx->key);
739740

src/crypto_libtomcrypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int sqlcipher_ltc_hmac(void *ctx, unsigned char *hmac_key, int key_sz, un
107107
return SQLITE_OK;
108108
}
109109

110-
static int sqlcipher_ltc_kdf(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {
110+
static int sqlcipher_ltc_kdf(void *ctx, const char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {
111111
int rc, hash_idx;
112112
unsigned long outlen = key_sz;
113113
unsigned long random_buffer_sz = 256;

src/crypto_openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static int sqlcipher_openssl_hmac(void *ctx, unsigned char *hmac_key, int key_sz
115115
return SQLITE_OK;
116116
}
117117

118-
static int sqlcipher_openssl_kdf(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {
118+
static int sqlcipher_openssl_kdf(void *ctx, const char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {
119119
unsigned long random_buffer_sz = 256;
120120
char random_buffer[random_buffer_sz];
121121

src/sqlcipher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct {
4343
int (*add_random)(void *ctx, void *buffer, int length);
4444
int (*random)(void *ctx, void *buffer, int length);
4545
int (*hmac)(void *ctx, unsigned char *hmac_key, int key_sz, unsigned char *in, int in_sz, unsigned char *in2, int in2_sz, unsigned char *out);
46-
int (*kdf)(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key);
46+
int (*kdf)(void *ctx, const char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key);
4747
int (*cipher)(void *ctx, int mode, unsigned char *key, int key_sz, unsigned char *iv, unsigned char *in, int in_sz, unsigned char *out);
4848
int (*set_cipher)(void *ctx, const char *cipher_name);
4949
const char* (*get_cipher)(void *ctx);

0 commit comments

Comments
 (0)