@@ -73,7 +73,7 @@ int sqlcipher_memcmp(const unsigned char *a0, const unsigned char *a1, int len)
7373
7474/* generate a defined number of pseudorandom bytes */
7575int sqlcipher_random (void * buffer , int length ) {
76- return RAND_bytes (buffer , length );
76+ return RAND_bytes (( unsigned char * ) buffer , length );
7777}
7878
7979/**
@@ -105,7 +105,7 @@ void sqlcipher_free(void *ptr, int sz) {
105105 * reference counted and leak detection works. Unless compiled with OMIT_MEMLOCK
106106 * attempts to lock the memory pages so sensitive information won't be swapped
107107 */
108- void * sqlcipher_malloc (size_t sz ) {
108+ void * sqlcipher_malloc (int sz ) {
109109 void * ptr = sqlite3Malloc (sz );
110110#ifndef OMIT_MEMLOCK
111111 if (ptr ) {
@@ -129,12 +129,12 @@ void* sqlcipher_malloc(size_t sz) {
129129 */
130130int sqlcipher_cipher_ctx_init (cipher_ctx * * iCtx ) {
131131 cipher_ctx * ctx ;
132- * iCtx = sqlcipher_malloc (sizeof (cipher_ctx ));
132+ * iCtx = ( cipher_ctx * ) sqlcipher_malloc (sizeof (cipher_ctx ));
133133 ctx = * iCtx ;
134134 if (ctx == NULL ) return SQLITE_NOMEM ;
135135 memset (ctx , 0 , sizeof (cipher_ctx ));
136- ctx -> key = sqlcipher_malloc (EVP_MAX_KEY_LENGTH );
137- ctx -> hmac_key = sqlcipher_malloc (EVP_MAX_KEY_LENGTH );
136+ ctx -> key = ( unsigned char * ) sqlcipher_malloc (EVP_MAX_KEY_LENGTH );
137+ ctx -> hmac_key = ( unsigned char * ) sqlcipher_malloc (EVP_MAX_KEY_LENGTH );
138138 if (ctx -> key == NULL ) return SQLITE_NOMEM ;
139139 if (ctx -> hmac_key == NULL ) return SQLITE_NOMEM ;
140140 return SQLITE_OK ;
@@ -419,7 +419,7 @@ int sqlcipher_page_cipher(codec_ctx *ctx, int for_ctx, Pgno pgno, int mode, int
419419 cipher_ctx * c_ctx = for_ctx ? ctx -> write_ctx : ctx -> read_ctx ;
420420 EVP_CIPHER_CTX ectx ;
421421 unsigned char * iv_in , * iv_out , * hmac_in , * hmac_out , * out_start ;
422- int tmp_csz , csz , size , rc ;
422+ int tmp_csz , csz , size ;
423423
424424 /* calculate some required positions into various buffers */
425425 size = page_sz - c_ctx -> reserve_sz ; /* adjust size to useable size and memset reserve at end of page */
@@ -532,8 +532,6 @@ int sqlcipher_cipher_ctx_key_derive(codec_ctx *ctx, cipher_ctx *c_ctx) {
532532}
533533
534534int sqlcipher_codec_key_derive (codec_ctx * ctx ) {
535- int rc ;
536-
537535 /* derive key on first use if necessary */
538536 if (ctx -> read_ctx -> derive_key ) {
539537 if (sqlcipher_cipher_ctx_key_derive (ctx , ctx -> read_ctx ) != SQLITE_OK ) return SQLITE_ERROR ;
0 commit comments