1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
14  */
15 
16 #include <aes/aes_impl.h>
17 #include <stdio.h>
18 
19 #include "cryptotest.h"
20 #include "aes_cmac.h"
21 
22 int
23 main(void)
24 {
25 	int errs = 0;
26 	int i;
27 	uint8_t N[AES_BLOCK_LEN];
28 	cryptotest_t args;
29 
30 	args.in = M;
31 	args.out = N;
32 	args.key = keytest;
33 	args.param = NULL;
34 
35 	args.outlen = sizeof (N);
36 	args.keylen = sizeof (keytest);
37 	args.plen = 0;
38 
39 	args.mechname = SUN_CKM_AES_CMAC;
40 	args.updatelen = 1;
41 
42 	for (i = 0; i < sizeof (RES) / sizeof (RES[0]); i++) {
43 		args.inlen = DATALEN[i];
44 		errs += run_test(&args, RES[i], AES_BLOCK_LEN, MAC_FG);
45 		(void) fprintf(stderr, "----------\n");
46 	}
47 	if (errs != 0)
48 		(void) fprintf(stderr, "%d tests failed\n", errs);
49 
50 	return (errs);
51 }
52