Add FreeBSD support to zio_crypto.h
Minimal compatibility changes for FreeBSD. Reviewed-by: Jorgen Lundman <lundman@lundman.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9631
This commit is contained in:
parent
a5b762ab1d
commit
77323bcf53
|
@ -22,7 +22,11 @@
|
||||||
|
|
||||||
#include <sys/dmu.h>
|
#include <sys/dmu.h>
|
||||||
#include <sys/refcount.h>
|
#include <sys/refcount.h>
|
||||||
|
#if defined(__FreeBSD__) && defined(_KERNEL)
|
||||||
|
#include <sys/freebsd_crypto.h>
|
||||||
|
#else
|
||||||
#include <sys/crypto/api.h>
|
#include <sys/crypto/api.h>
|
||||||
|
#endif /* __FreeBSD__ */
|
||||||
#include <sys/nvpair.h>
|
#include <sys/nvpair.h>
|
||||||
#include <sys/avl.h>
|
#include <sys/avl.h>
|
||||||
#include <sys/zio.h>
|
#include <sys/zio.h>
|
||||||
|
@ -47,8 +51,15 @@ typedef enum zio_crypt_type {
|
||||||
/* table of supported crypto algorithms, modes and keylengths. */
|
/* table of supported crypto algorithms, modes and keylengths. */
|
||||||
typedef struct zio_crypt_info {
|
typedef struct zio_crypt_info {
|
||||||
/* mechanism name, needed by ICP */
|
/* 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;
|
crypto_mech_name_t ci_mechname;
|
||||||
|
#endif
|
||||||
/* cipher mode type (GCM, CCM) */
|
/* cipher mode type (GCM, CCM) */
|
||||||
zio_crypt_type_t ci_crypt_type;
|
zio_crypt_type_t ci_crypt_type;
|
||||||
|
|
||||||
|
@ -90,8 +101,13 @@ typedef struct zio_crypt_key {
|
||||||
/* illumos crypto api current encryption key */
|
/* illumos crypto api current encryption key */
|
||||||
crypto_key_t zk_current_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 */
|
/* template of current encryption key for illumos crypto api */
|
||||||
crypto_ctx_template_t zk_current_tmpl;
|
crypto_ctx_template_t zk_current_tmpl;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* illumos crypto api current hmac key */
|
/* illumos crypto api current hmac key */
|
||||||
crypto_key_t zk_hmac_key;
|
crypto_key_t zk_hmac_key;
|
||||||
|
|
Loading…
Reference in New Issue