]> git.codecow.com Git - Monocypher.git/commitdiff
Fix Chacha20 ctr test when size_t < u64
authorCuleX <cculex@gmail.com>
Fri, 25 Aug 2017 13:00:43 +0000 (15:00 +0200)
committerCuleX <cculex@gmail.com>
Fri, 25 Aug 2017 13:00:43 +0000 (15:00 +0200)
This can happen on 32-bit platforms and was reproduced on a 32-bit build
of Solaris 11.

tests/self.c

index 12309362412078912f7d03134668164edab1b420..ef3847e2952d2a7684e97144dd9f13909105f438 100644 (file)
@@ -389,7 +389,7 @@ static int p_chacha20_set_ctr()
         u8 output_more[stream_size * 2];
         u8 key        [32];          p_random(key  , 32);
         u8 nonce      [8];           p_random(nonce, 8 );
-        size_t ctr   = rand64() % CHACHA_NB_BLOCKS;
+        u64 ctr      = rand64() % CHACHA_NB_BLOCKS;
         size_t limit = ctr * CHACHA_BLOCK_SIZE;
         // Encrypt all at once
         crypto_chacha_ctx ctx;