Revert "Fix integer narrowing warnings in tests."

This reverts commit 173ad74d3e.
This commit is contained in:
Frank Denis 2014-11-20 12:00:37 -08:00
parent 394c6a1970
commit d311731bad
7 changed files with 13 additions and 10 deletions

View File

@ -14,12 +14,12 @@ unsigned char mac[crypto_box_MACBYTES];
int main(void)
{
uint32_t mlen;
unsigned long long mlen;
unsigned long long i;
crypto_box_keypair(alicepk, alicesk);
crypto_box_keypair(bobpk, bobsk);
mlen = randombytes_uniform((uint32_t)sizeof m);
mlen = (unsigned long long)randombytes_uniform((uint32_t)sizeof m);
randombytes_buf(m, mlen);
randombytes_buf(nonce, sizeof nonce);
crypto_box_easy(c, m, mlen, nonce, bobpk, alicesk);

View File

@ -7,7 +7,7 @@ int main(void)
#define MAXLEN 64
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
k[crypto_generichash_KEYBYTES_MAX];
unsigned char h, i, j;
size_t h, i, j;
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
k[h] = h;

View File

@ -8,7 +8,7 @@ int main(void)
crypto_generichash_state st;
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
k[crypto_generichash_KEYBYTES_MAX];
unsigned char h, i, j;
size_t h, i, j;
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
k[h] = h;

View File

@ -14,7 +14,7 @@ int main(void)
'3', '7', '4', '0', '0', 'd', '2', 'a' };
unsigned char in[MAXLEN], out[crypto_generichash_blake2b_BYTES_MAX],
k[crypto_generichash_blake2b_KEYBYTES_MAX];
unsigned char h, i, j;
size_t h, i, j;
for (h = 0; h < crypto_generichash_blake2b_KEYBYTES_MAX; ++h)
k[h] = h;

View File

@ -8,7 +8,7 @@ static void tv(void)
const char *passwd_hex;
unsigned long long passwdlen;
const char *salt_hex;
size_t outlen;
unsigned long long outlen;
unsigned long long opslimit;
size_t memlimit;
} tests[] = {
@ -114,7 +114,7 @@ static void tv2(void)
const char *passwd_hex;
unsigned long long passwdlen;
const char *salt_hex;
size_t outlen;
unsigned long long outlen;
unsigned long long opslimit;
size_t memlimit;
} tests[] = {
@ -285,8 +285,11 @@ int main(void)
{
char str_out[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
char str_out2[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
unsigned char out[OUT_LEN];
char out_hex[OUT_LEN * 2 + 1];
const char *salt = "[<~A 32-bytes salt for scrypt~>]";
const char *passwd = "Correct Horse Battery Staple";
size_t i;
tv();
tv2();

View File

@ -11,11 +11,11 @@ unsigned char mac[crypto_secretbox_MACBYTES];
int main(void)
{
uint32_t mlen;
unsigned long long mlen;
unsigned long long i;
randombytes_buf(k, sizeof k);
mlen = randombytes_uniform((uint32_t)sizeof m);
mlen = (unsigned long long)randombytes_uniform((uint32_t)sizeof m);
randombytes_buf(m, mlen);
randombytes_buf(nonce, sizeof nonce);
crypto_secretbox_easy(c, m, mlen, nonce, k);

View File

@ -7,7 +7,7 @@ int main(void)
#define MAXLEN 64
unsigned char in[MAXLEN], out[crypto_shorthash_BYTES],
k[crypto_shorthash_KEYBYTES];
unsigned char i, j;
size_t i, j;
for (i = 0; i < crypto_shorthash_KEYBYTES; ++i)
k[i] = i;