mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 18:15:18 -07:00
Revert "Fix integer narrowing warnings in tests."
This reverts commit 173ad74d3e
.
This commit is contained in:
parent
394c6a1970
commit
d311731bad
@ -14,12 +14,12 @@ unsigned char mac[crypto_box_MACBYTES];
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint32_t mlen;
|
unsigned long long mlen;
|
||||||
unsigned long long i;
|
unsigned long long i;
|
||||||
|
|
||||||
crypto_box_keypair(alicepk, alicesk);
|
crypto_box_keypair(alicepk, alicesk);
|
||||||
crypto_box_keypair(bobpk, bobsk);
|
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(m, mlen);
|
||||||
randombytes_buf(nonce, sizeof nonce);
|
randombytes_buf(nonce, sizeof nonce);
|
||||||
crypto_box_easy(c, m, mlen, nonce, bobpk, alicesk);
|
crypto_box_easy(c, m, mlen, nonce, bobpk, alicesk);
|
||||||
|
@ -7,7 +7,7 @@ int main(void)
|
|||||||
#define MAXLEN 64
|
#define MAXLEN 64
|
||||||
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
|
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
|
||||||
k[crypto_generichash_KEYBYTES_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)
|
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
|
||||||
k[h] = h;
|
k[h] = h;
|
||||||
|
@ -8,7 +8,7 @@ int main(void)
|
|||||||
crypto_generichash_state st;
|
crypto_generichash_state st;
|
||||||
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
|
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX],
|
||||||
k[crypto_generichash_KEYBYTES_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)
|
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
|
||||||
k[h] = h;
|
k[h] = h;
|
||||||
|
@ -14,7 +14,7 @@ int main(void)
|
|||||||
'3', '7', '4', '0', '0', 'd', '2', 'a' };
|
'3', '7', '4', '0', '0', 'd', '2', 'a' };
|
||||||
unsigned char in[MAXLEN], out[crypto_generichash_blake2b_BYTES_MAX],
|
unsigned char in[MAXLEN], out[crypto_generichash_blake2b_BYTES_MAX],
|
||||||
k[crypto_generichash_blake2b_KEYBYTES_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)
|
for (h = 0; h < crypto_generichash_blake2b_KEYBYTES_MAX; ++h)
|
||||||
k[h] = h;
|
k[h] = h;
|
||||||
|
@ -8,7 +8,7 @@ static void tv(void)
|
|||||||
const char *passwd_hex;
|
const char *passwd_hex;
|
||||||
unsigned long long passwdlen;
|
unsigned long long passwdlen;
|
||||||
const char *salt_hex;
|
const char *salt_hex;
|
||||||
size_t outlen;
|
unsigned long long outlen;
|
||||||
unsigned long long opslimit;
|
unsigned long long opslimit;
|
||||||
size_t memlimit;
|
size_t memlimit;
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
@ -114,7 +114,7 @@ static void tv2(void)
|
|||||||
const char *passwd_hex;
|
const char *passwd_hex;
|
||||||
unsigned long long passwdlen;
|
unsigned long long passwdlen;
|
||||||
const char *salt_hex;
|
const char *salt_hex;
|
||||||
size_t outlen;
|
unsigned long long outlen;
|
||||||
unsigned long long opslimit;
|
unsigned long long opslimit;
|
||||||
size_t memlimit;
|
size_t memlimit;
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
@ -285,8 +285,11 @@ int main(void)
|
|||||||
{
|
{
|
||||||
char str_out[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
char str_out[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
||||||
char str_out2[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 *salt = "[<~A 32-bytes salt for scrypt~>]";
|
||||||
const char *passwd = "Correct Horse Battery Staple";
|
const char *passwd = "Correct Horse Battery Staple";
|
||||||
|
size_t i;
|
||||||
|
|
||||||
tv();
|
tv();
|
||||||
tv2();
|
tv2();
|
||||||
|
@ -11,11 +11,11 @@ unsigned char mac[crypto_secretbox_MACBYTES];
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint32_t mlen;
|
unsigned long long mlen;
|
||||||
unsigned long long i;
|
unsigned long long i;
|
||||||
|
|
||||||
randombytes_buf(k, sizeof k);
|
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(m, mlen);
|
||||||
randombytes_buf(nonce, sizeof nonce);
|
randombytes_buf(nonce, sizeof nonce);
|
||||||
crypto_secretbox_easy(c, m, mlen, nonce, k);
|
crypto_secretbox_easy(c, m, mlen, nonce, k);
|
||||||
|
@ -7,7 +7,7 @@ int main(void)
|
|||||||
#define MAXLEN 64
|
#define MAXLEN 64
|
||||||
unsigned char in[MAXLEN], out[crypto_shorthash_BYTES],
|
unsigned char in[MAXLEN], out[crypto_shorthash_BYTES],
|
||||||
k[crypto_shorthash_KEYBYTES];
|
k[crypto_shorthash_KEYBYTES];
|
||||||
unsigned char i, j;
|
size_t i, j;
|
||||||
|
|
||||||
for (i = 0; i < crypto_shorthash_KEYBYTES; ++i)
|
for (i = 0; i < crypto_shorthash_KEYBYTES; ++i)
|
||||||
k[i] = i;
|
k[i] = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user