Print this page
9697 Add digest tests to crypto test framework
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/test/crypto-tests/tests/common/cryptotest.h
+++ new/usr/src/test/crypto-tests/tests/common/cryptotest.h
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
14 + * Copyright 2018, Joyent, Inc.
14 15 */
15 16
16 17 #ifndef _CRYPTOTEST_H
17 18 #define _CRYPTOTEST_H
18 19
19 20 #ifdef __cplusplus
20 21 extern "C" {
21 22 #endif
22 23
23 24 #include <sys/crypto/ioctl.h>
24 25
25 26 #define CTEST_INIT_FAILED (-1)
26 27 #define CTEST_NAME_RESOLVE_FAILED (-2)
27 28 #define CTEST_MECH_NO_PROVIDER (-3)
28 29
29 30 typedef struct cryptotest {
30 31 uint8_t *in;
31 32 uint8_t *out;
32 33 uint8_t *key;
33 34 void *param;
34 35
35 36 size_t inlen;
36 37 size_t outlen;
37 38 size_t keylen;
38 39 size_t plen;
39 40
40 41 char *mechname;
41 42 size_t updatelen;
42 43 } cryptotest_t;
43 44
44 45 typedef int (*testfunc_t)(cryptotest_t *);
45 46
46 47 typedef struct test_fg {
47 48 testfunc_t single;
48 49 testfunc_t update;
49 50 } test_fg_t;
50 51
51 52 #define CRYPTO_INVALID_SESSION ((size_t)-1)
52 53 typedef struct crypto_op crypto_op_t;
53 54
54 55 int run_test(cryptotest_t *args, uint8_t *cmp, size_t cmplen, test_fg_t *funcs);
55 56
56 57 /* utils */
57 58 crypto_op_t *cryptotest_init(cryptotest_t *args, crypto_func_group_t fg);
58 59 int cryptotest_close(crypto_op_t *op);
59 60 int get_mech_info(crypto_op_t *op);
60 61 int get_hsession_by_mech(crypto_op_t *op);
61 62
62 63 /* CRYPTO_MAC */
63 64 int mac_init(crypto_op_t *op);
64 65 int mac_single(crypto_op_t *op);
65 66 int mac_update(crypto_op_t *op, int offset);
66 67 int mac_final(crypto_op_t *op);
67 68
68 69 /* CRYPTO_ENCRYPT */
69 70 int encrypt_init(crypto_op_t *op);
↓ open down ↓ |
46 lines elided |
↑ open up ↑ |
70 71 int encrypt_single(crypto_op_t *op);
71 72 int encrypt_update(crypto_op_t *op, int offset, size_t *encrlen);
72 73 int encrypt_final(crypto_op_t *op, size_t encrlen);
73 74
74 75 /* CRYPTO_DECRYPT */
75 76 int decrypt_init(crypto_op_t *op);
76 77 int decrypt_single(crypto_op_t *op);
77 78 int decrypt_update(crypto_op_t *op, int offset, size_t *encrlen);
78 79 int decrypt_final(crypto_op_t *op, size_t encrlen);
79 80
81 +/* CRYPTO_DIGEST */
82 +int digest_init(crypto_op_t *op);
83 +int digest_single(crypto_op_t *op);
84 +int digest_update(crypto_op_t *op, int);
85 +int digest_final(crypto_op_t *op);
86 +
80 87 /* wrappers */
81 88 int test_mac_single(cryptotest_t *args);
82 89 int test_mac(cryptotest_t *args);
83 90
84 91 int test_encrypt_single(cryptotest_t *args);
85 92 int test_encrypt(cryptotest_t *args);
86 93
87 94 int test_decrypt_single(cryptotest_t *args);
88 95 int test_decrypt(cryptotest_t *args);
89 96
97 +int test_digest_single(cryptotest_t *args);
98 +int test_digest(cryptotest_t *args);
99 +
90 100 extern test_fg_t cryptotest_decr_fg;
91 101 extern test_fg_t cryptotest_encr_fg;
92 102 extern test_fg_t cryptotest_mac_fg;
103 +extern test_fg_t cryptotest_digest_fg;
93 104
94 105 #define MAC_FG (&cryptotest_mac_fg)
95 106 #define ENCR_FG (&cryptotest_encr_fg)
96 107 #define DECR_FG (&cryptotest_decr_fg)
108 +#define DIGEST_FG (&cryptotest_digest_fg)
97 109
98 110 #ifdef __cplusplus
99 111 }
100 112 #endif
101 113
102 114 #endif /* _CRYPTOTEST_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX