test tweaks

main
JP Aumasson 2014-03-23 18:03:51 +01:00
parent 2d4d778ffd
commit 9cb8888dff
2 changed files with 8 additions and 9 deletions

View File

@ -31,7 +31,7 @@ version of SipHash:
verifies 64 test vectors, and verifies 64 test vectors, and
```C ```c
./siphash24_test_debug ./siphash24_test_debug
``` ```
@ -49,7 +49,8 @@ lines
License License
------- -------
The SipHash reference code is released under [CC0 license](https://creativecommons.org/publicdomain/zero/1.0/), a public The SipHash reference code is released under [CC0
license](https://creativecommons.org/publicdomain/zero/1.0/), a public
domain-like licence. domain-like licence.

12
main.c
View File

@ -107,7 +107,7 @@ int test_vectors()
#define MAXLEN 64 #define MAXLEN 64
u8 in[MAXLEN], out[8], k[16]; u8 in[MAXLEN], out[8], k[16];
int i; int i;
int ok = 1; int fails = 0;
for( i = 0; i < 16; ++i ) k[i] = i; for( i = 0; i < 16; ++i ) k[i] = i;
@ -119,20 +119,18 @@ int test_vectors()
if ( memcmp( out, vectors[i], 8 ) ) if ( memcmp( out, vectors[i], 8 ) )
{ {
printf( "test vector failed for %d bytes\n", i ); printf( "test vector failed for %d bytes\n", i );
ok = 0; fails++;
} }
} }
return ok; return fails;
} }
int main() int main()
{ {
if ( test_vectors() ) if ( !test_vectors() )
printf( "test vectors ok\n" ); printf( "test vector ok\n" );
else
printf( "test vectors fail\n" );
return 0; return 0;
} }