5869 Need AES CMAC support in KCF+PKCS11
[unleashed.git] / usr / src / test / crypto-tests / tests / modes / aes / cmac / aes_cmac.c
bloba6e5936a80f7baf3d01417615636d92405c78f21
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.
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.
13 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
16 #include <aes/aes_impl.h>
17 #include <stdio.h>
19 #include "cryptotest.h"
20 #include "aes_cmac.h"
22 int
23 main(void)
25 int errs = 0;
26 int i;
27 uint8_t N[AES_BLOCK_LEN];
28 cryptotest_t args;
30 args.in = M;
31 args.out = N;
32 args.key = keytest;
33 args.param = NULL;
35 args.outlen = sizeof (N);
36 args.keylen = sizeof (keytest);
37 args.plen = 0;
39 args.mechname = SUN_CKM_AES_CMAC;
40 args.updatelen = 1;
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");
47 if (errs != 0)
48 (void) fprintf(stderr, "%d tests failed\n", errs);
50 return (errs);