1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License (), 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 2018, Joyent, Inc.
14 */
15
16 #include <stdio.h>
17 #include <sys/types.h>
18 #include "cryptotest.h"
19
20 extern size_t msgcount;
21 extern uint8_t *MSG[];
22 extern size_t MSGLEN[];
23 extern uint8_t *MD[];
24 extern size_t mdlen;
25 extern char *mechname;
26
27 int
28 main(void)
29 {
30 int i, errs = 0;
31 uint8_t N[1024];
32 cryptotest_t args = { 0 };
33
34 args.out = N;
35 args.outlen = sizeof (N);
36
37 args.mechname = mechname;
38 args.updatelen = 1;
39
40 for (i = 0; i < msgcount; i++) {
41 args.in = MSG[i];
42 args.inlen = MSGLEN[i];
43
44 errs += run_test(&args, MD[i], mdlen, DIGEST_FG);
45 }
46
47 if (errs != 0)
48 (void) fprintf(stderr, "%d tests failed\n", errs);
49
50 return (errs);
51 }