mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 02:25:14 -07:00
int vs size_t
This commit is contained in:
parent
f4397f12d0
commit
212841b28d
@ -8,25 +8,25 @@ static unsigned char a[64];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int clen;
|
||||
size_t clen;
|
||||
|
||||
for (clen = 0; clen < sizeof c; ++clen) {
|
||||
randombytes_buf(key, sizeof key);
|
||||
randombytes_buf(c, clen);
|
||||
crypto_auth_hmacsha512(a, c, clen, key);
|
||||
if (crypto_auth_hmacsha512_verify(a, c, clen, key) != 0) {
|
||||
printf("fail %d\n", clen);
|
||||
printf("fail %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
if (clen > 0) {
|
||||
c[rand() % clen] += 1 + (rand() % 255);
|
||||
c[(size_t) rand() % clen] += 1 + (rand() % 255);
|
||||
if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %d\n", clen);
|
||||
printf("forgery %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
a[rand() % sizeof a] += 1 + (rand() % 255);
|
||||
if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %d\n", clen);
|
||||
printf("forgery %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user