diff options
author | Matthew Macy <[email protected]> | 2019-11-30 15:38:16 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-11-30 15:38:16 -0800 |
commit | 77323bcf5361ded9ca6b8eb1fee77a8dfd34654c (patch) | |
tree | 15545b6b3a086003f71719c9b1d2ff5be6b6d7fd /include/sys/zio_crypt.h | |
parent | a5b762ab1d9064bcae85f72c64c4a54bef7bbd80 (diff) |
Add FreeBSD support to zio_crypto.h
Minimal compatibility changes for FreeBSD.
Reviewed-by: Jorgen Lundman <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9631
Diffstat (limited to 'include/sys/zio_crypt.h')
-rw-r--r-- | include/sys/zio_crypt.h | 18 |
1 files changed, 17 insertions, 1 deletions
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 <sys/dmu.h> #include <sys/refcount.h> +#if defined(__FreeBSD__) && defined(_KERNEL) +#include <sys/freebsd_crypto.h> +#else #include <sys/crypto/api.h> +#endif /* __FreeBSD__ */ #include <sys/nvpair.h> #include <sys/avl.h> #include <sys/zio.h> @@ -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; |