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 2015 Nexenta Systems, Inc. All rights reserved.
23 #include <sys/crypto/ioctl.h>
25 #define CTEST_INIT_FAILED (-1)
26 #define CTEST_NAME_RESOLVE_FAILED (-2)
27 #define CTEST_MECH_NO_PROVIDER (-3)
29 typedef struct cryptotest
{
44 typedef int (*testfunc_t
)(cryptotest_t
*);
46 typedef struct test_fg
{
51 #define CRYPTO_INVALID_SESSION ((size_t)-1)
52 typedef struct crypto_op crypto_op_t
;
54 int run_test(cryptotest_t
*args
, uint8_t *cmp
, size_t cmplen
, test_fg_t
*funcs
);
57 crypto_op_t
*cryptotest_init(cryptotest_t
*args
, crypto_func_group_t fg
);
58 int cryptotest_close(crypto_op_t
*op
);
59 int get_mech_info(crypto_op_t
*op
);
60 int get_hsession_by_mech(crypto_op_t
*op
);
63 int mac_init(crypto_op_t
*op
);
64 int mac_single(crypto_op_t
*op
);
65 int mac_update(crypto_op_t
*op
, int offset
);
66 int mac_final(crypto_op_t
*op
);
69 int encrypt_init(crypto_op_t
*op
);
70 int encrypt_single(crypto_op_t
*op
);
71 int encrypt_update(crypto_op_t
*op
, int offset
, size_t *encrlen
);
72 int encrypt_final(crypto_op_t
*op
, size_t encrlen
);
75 int decrypt_init(crypto_op_t
*op
);
76 int decrypt_single(crypto_op_t
*op
);
77 int decrypt_update(crypto_op_t
*op
, int offset
, size_t *encrlen
);
78 int decrypt_final(crypto_op_t
*op
, size_t encrlen
);
81 int test_mac_single(cryptotest_t
*args
);
82 int test_mac(cryptotest_t
*args
);
84 int test_encrypt_single(cryptotest_t
*args
);
85 int test_encrypt(cryptotest_t
*args
);
87 int test_decrypt_single(cryptotest_t
*args
);
88 int test_decrypt(cryptotest_t
*args
);
90 extern test_fg_t cryptotest_decr_fg
;
91 extern test_fg_t cryptotest_encr_fg
;
92 extern test_fg_t cryptotest_mac_fg
;
94 #define MAC_FG (&cryptotest_mac_fg)
95 #define ENCR_FG (&cryptotest_encr_fg)
96 #define DECR_FG (&cryptotest_decr_fg)
102 #endif /* _CRYPTOTEST_H */