diff --git a/include/sys/zio_crypt.h b/include/sys/zio_crypt.h index a02912791..fdd65f5a6 100644 --- a/include/sys/zio_crypt.h +++ b/include/sys/zio_crypt.h @@ -22,7 +22,11 @@ #include #include +#if defined(__FreeBSD__) && defined(_KERNEL) +#include +#else #include +#endif /* __FreeBSD__ */ #include #include #include @@ -47,8 +51,15 @@ typedef enum zio_crypt_type { /* table of supported crypto algorithms, modes and keylengths. */ typedef struct zio_crypt_info { /* mechanism name, needed by ICP */ +#if defined(__FreeBSD__) && defined(_KERNEL) + /* + * I've deliberately used a different name here, to catch + * ICP-using code. + */ + const char *ci_algname; +#else crypto_mech_name_t ci_mechname; - +#endif /* cipher mode type (GCM, CCM) */ zio_crypt_type_t ci_crypt_type; @@ -90,8 +101,13 @@ typedef struct zio_crypt_key { /* illumos crypto api current encryption key */ crypto_key_t zk_current_key; +#if defined(__FreeBSD__) && defined(_KERNEL) + /* Session for current encrpytion key. Must always be set */ + freebsd_crypt_session_t zk_session; +#else /* template of current encryption key for illumos crypto api */ crypto_ctx_template_t zk_current_tmpl; +#endif /* illumos crypto api current hmac key */ crypto_key_t zk_hmac_key;