xref: /freebsd/sys/contrib/libsodium/test/default/auth6.c (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1*0ac341f1SConrad Meyer 
2*0ac341f1SConrad Meyer #define TEST_NAME "auth6"
3*0ac341f1SConrad Meyer #include "cmptest.h"
4*0ac341f1SConrad Meyer 
5*0ac341f1SConrad Meyer /* "Test Case 2" from RFC 4231 */
6*0ac341f1SConrad Meyer static unsigned char key[32] = "Jefe";
7*0ac341f1SConrad Meyer static unsigned char c[]     = "what do ya want for nothing?";
8*0ac341f1SConrad Meyer 
9*0ac341f1SConrad Meyer static unsigned char a[64];
10*0ac341f1SConrad Meyer 
11*0ac341f1SConrad Meyer int
main(void)12*0ac341f1SConrad Meyer main(void)
13*0ac341f1SConrad Meyer {
14*0ac341f1SConrad Meyer     int i;
15*0ac341f1SConrad Meyer 
16*0ac341f1SConrad Meyer     crypto_auth_hmacsha512(a, c, sizeof c - 1U, key);
17*0ac341f1SConrad Meyer     for (i = 0; i < 64; ++i) {
18*0ac341f1SConrad Meyer         printf(",0x%02x", (unsigned int) a[i]);
19*0ac341f1SConrad Meyer         if (i % 8 == 7)
20*0ac341f1SConrad Meyer             printf("\n");
21*0ac341f1SConrad Meyer     }
22*0ac341f1SConrad Meyer     return 0;
23*0ac341f1SConrad Meyer }
24