@@ -285,7 +285,7 @@ void sqlcipher_deactivate() {
285285 Note: As suggested by Joachim Schipper (joachim.schipper@fox-it.com)
286286*/
287287void * sqlcipher_memset (void * v , unsigned char value , sqlite_uint64 len ) {
288- sqlite_uint64 i = 0 ;
288+ volatile sqlite_uint64 i = 0 ;
289289 volatile unsigned char * a = v ;
290290
291291 if (v == NULL ) return v ;
@@ -302,8 +302,8 @@ void* sqlcipher_memset(void *v, unsigned char value, sqlite_uint64 len) {
302302 matches a single value (i.e. the memory is all zeros)
303303 returns 0 if match, 1 of no match */
304304int sqlcipher_ismemset (const void * v , unsigned char value , sqlite_uint64 len ) {
305- const unsigned char * a = v ;
306- sqlite_uint64 i = 0 , result = 0 ;
305+ const volatile unsigned char * a = v ;
306+ volatile sqlite_uint64 i = 0 , result = 0 ;
307307
308308 for (i = 0 ; i < len ; i ++ ) {
309309 result |= a [i ] ^ value ;
@@ -315,8 +315,8 @@ int sqlcipher_ismemset(const void *v, unsigned char value, sqlite_uint64 len) {
315315/* constant time memory comparison routine.
316316 returns 0 if match, 1 if no match */
317317int sqlcipher_memcmp (const void * v0 , const void * v1 , int len ) {
318- const unsigned char * a0 = v0 , * a1 = v1 ;
319- int i = 0 , result = 0 ;
318+ const volatile unsigned char * a0 = v0 , * a1 = v1 ;
319+ volatile int i = 0 , result = 0 ;
320320
321321 for (i = 0 ; i < len ; i ++ ) {
322322 result |= a0 [i ] ^ a1 [i ];
0 commit comments