Keep ming Visual C++ happy

This commit is contained in:
Frank Denis 2013-04-26 21:52:21 -07:00
parent de517b70d9
commit 47de75e935
3 changed files with 6 additions and 6 deletions

View File

@ -5,14 +5,14 @@
/* "Test Case 2" from RFC 4231 */ /* "Test Case 2" from RFC 4231 */
unsigned char key[32] = "Jefe"; unsigned char key[32] = "Jefe";
unsigned char c[28] = "what do ya want for nothing?"; unsigned char c[] = "what do ya want for nothing?";
unsigned char a[32]; unsigned char a[32];
int main(void) int main(void)
{ {
int i; int i;
crypto_auth_hmacsha512256(a,c,sizeof c,key); crypto_auth_hmacsha512256(a,c,sizeof c - 1U,key);
for (i = 0;i < 32;++i) { for (i = 0;i < 32;++i) {
printf(",0x%02x",(unsigned int) a[i]); printf(",0x%02x",(unsigned int) a[i]);
if (i % 8 == 7) printf("\n"); if (i % 8 == 7) printf("\n");

View File

@ -3,13 +3,13 @@
#define TEST_NAME "hash" #define TEST_NAME "hash"
#include "cmptest.h" #include "cmptest.h"
unsigned char x[8] = "testing\n"; unsigned char x[] = "testing\n";
unsigned char h[crypto_hash_BYTES]; unsigned char h[crypto_hash_BYTES];
int main(void) int main(void)
{ {
int i; int i;
crypto_hash(h,x,sizeof x); crypto_hash(h,x,sizeof x - 1U);
for (i = 0;i < crypto_hash_BYTES;++i) printf("%02x",(unsigned int) h[i]); for (i = 0;i < crypto_hash_BYTES;++i) printf("%02x",(unsigned int) h[i]);
printf("\n"); printf("\n");
return 0; return 0;

View File

@ -3,13 +3,13 @@
#define TEST_NAME "hash3" #define TEST_NAME "hash3"
#include "cmptest.h" #include "cmptest.h"
unsigned char x[8] = "testing\n"; unsigned char x[] = "testing\n";
unsigned char h[crypto_hash_sha512_BYTES]; unsigned char h[crypto_hash_sha512_BYTES];
int main(void) int main(void)
{ {
int i; int i;
crypto_hash_sha512(h,x,sizeof x); crypto_hash_sha512(h,x,sizeof x - 1U);
for (i = 0;i < crypto_hash_sha512_BYTES;++i) printf("%02x",(unsigned int) h[i]); for (i = 0;i < crypto_hash_sha512_BYTES;++i) printf("%02x",(unsigned int) h[i]);
printf("\n"); printf("\n");
return 0; return 0;