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
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 2016 Nexenta Systems, Inc. All rights reserved.
18 #include "cryptotest.h"
21 const size_t GCM_SPEC_TAG_LEN
= 16;
28 size_t taglen
= GCM_SPEC_TAG_LEN
;
30 CK_AES_GCM_PARAMS param
;
33 bzero(¶m
, sizeof (param
));
34 param
.ulTagBits
= taglen
*8;
39 args
.outlen
= sizeof (N
);
40 args
.plen
= sizeof (param
);
42 args
.mechname
= SUN_CKM_AES_GCM
;
45 for (i
= 0; i
< sizeof (DATA
) / sizeof (DATA
[0]); i
++) {
49 args
.inlen
= DATALEN
[i
];
50 args
.keylen
= KEYLEN
[i
];
53 param
.ulIvLen
= IVLEN
[i
];
54 param
.ulIvBits
= IVLEN
[i
]*8;
56 param
.ulAADLen
= AUTHLEN
[i
];
59 errs
+= run_test(&args
, RES
[i
], RESLEN
[i
], ENCR_FG
);
60 (void) fprintf(stderr
, "----------\n");
63 (void) fprintf(stderr
, "\t\t\t=== decrypt ===\n----------\n\n");
65 for (i
= 0; i
< sizeof (DATA
) / sizeof (DATA
[0]); i
++) {
69 args
.inlen
= RESLEN
[i
];
70 args
.keylen
= KEYLEN
[i
];
73 param
.ulIvLen
= IVLEN
[i
];
74 param
.ulIvBits
= IVLEN
[i
]*8;
76 param
.ulAADLen
= AUTHLEN
[i
];
79 errs
+= run_test(&args
, DATA
[i
], DATALEN
[i
], DECR_FG
);
80 (void) fprintf(stderr
, "----------\n");
84 (void) fprintf(stderr
, "%d tests failed\n", errs
);