From f86edf8abdb0f0aa7e4c5b6e94fcb67d39fdab52 Mon Sep 17 00:00:00 2001 From: jordan Date: Tue, 5 May 2026 00:57:45 -0500 Subject: [PATCH 1/2] zfs: support wolfzfs patch. --- configure.ac | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 786514eea32..5053ec73829 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,28 @@ AC_ARG_ENABLE([freebsdkm-crypto-register], [ENABLED_BSDKM_REGISTER=no] ) +# wolfzfs support +AC_ARG_ENABLE([wolfzfs], + [AS_HELP_STRING([--enable-wolfzfs],[Enable wolfZFS kernel support (default: disabled)])], + [ENABLED_WOLFZFS=$enableval], + [ENABLED_WOLFZFS=no] + ) +if test "x$ENABLED_WOLFZFS" = "xyes" || test "x$ENABLED_WOLFZFS" = "xkernel" +then + # zfs uses ccm, and gcm streaming. + ENABLED_AESCCM="yes" + ENABLED_AESGCM_STREAM="yes" + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_FENCE" + + if test "x$ENABLED_WOLFZFS" = "xyes"; then + AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES" + fi + + if test "x$ENABLED_WOLFZFS" = "xkernel"; then + AM_CFLAGS="$AM_CFLAGS -DNO_STDDEF_H" + fi +fi + AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h ctype.h sys/random.h]) AC_CHECK_LIB([network],[socket]) AC_C_BIGENDIAN @@ -192,7 +214,8 @@ if test "x$ENABLED_BSDKM" = "xyes"; then # The header should not be included in freebsd kernel build. # Look for instead. AC_CHECK_HEADER(machine/atomic.h, [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_HAVE_ATOMIC_H"],[]) -else +elif test "x$ENABLED_WOLFZFS" = "xno"; then + # Don't use stdatomic.h with wolfzfs kernel. It expects gcc builtins. AC_CHECK_HEADER(stdatomic.h, [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_HAVE_ATOMIC_H"],[]) fi AC_CHECK_HEADER(assert.h, [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_HAVE_ASSERT_H"],[]) @@ -3200,7 +3223,8 @@ AC_ARG_ENABLE([aesccm], [ ENABLED_AESCCM=no ] ) -if test "$ENABLED_AESCCM" = "yes" || test "$ENABLED_WOLFENGINE" = "yes" +if test "$ENABLED_AESCCM" = "yes" || test "$ENABLED_WOLFENGINE" = "yes" || + test "$ENABLED_WOLFZFS" = "yes" then AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM" AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESCCM" From a94c8d075303c6aac396a70076408423e1bef718 Mon Sep 17 00:00:00 2001 From: jordan Date: Tue, 5 May 2026 13:56:35 -0500 Subject: [PATCH 2/2] zfs: cleanup wolfzfs build. --- configure.ac | 16 +++++++++------- wolfssl/wolfcrypt/wc_port.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 5053ec73829..ed2996b1d1c 100644 --- a/configure.ac +++ b/configure.ac @@ -192,17 +192,12 @@ AC_ARG_ENABLE([wolfzfs], ) if test "x$ENABLED_WOLFZFS" = "xyes" || test "x$ENABLED_WOLFZFS" = "xkernel" then - # zfs uses ccm, and gcm streaming. - ENABLED_AESCCM="yes" - ENABLED_AESGCM_STREAM="yes" - AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_FENCE" - if test "x$ENABLED_WOLFZFS" = "xyes"; then AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES" fi if test "x$ENABLED_WOLFZFS" = "xkernel"; then - AM_CFLAGS="$AM_CFLAGS -DNO_STDDEF_H" + AM_CFLAGS="$AM_CFLAGS -DNO_STDDEF_H -DNO_STDATOMIC_H" fi fi @@ -3215,6 +3210,13 @@ then ENABLED_AESGCM="4bit" fi +if test "x$ENABLED_WOLFZFS" = "xyes" || test "x$ENABLED_WOLFZFS" = "xkernel" +then + # zfs uses ccm, and gcm streaming. + ENABLED_AESCCM="yes" + ENABLED_AESGCM="yes" + ENABLED_AESGCM_STREAM="yes" +fi # AES-CCM AC_ARG_ENABLE([aesccm], @@ -3224,7 +3226,7 @@ AC_ARG_ENABLE([aesccm], ) if test "$ENABLED_AESCCM" = "yes" || test "$ENABLED_WOLFENGINE" = "yes" || - test "$ENABLED_WOLFZFS" = "yes" + test "$ENABLED_WOLFZFS" != "no" then AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM" AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESCCM" diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index d722ea8d104..fcdf055f1f8 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -1785,7 +1785,7 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void); #ifdef XFENCE /* use user-supplied XFENCE definition. */ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ - !defined(__STDC_NO_ATOMICS__) + !defined(__STDC_NO_ATOMICS__) && !defined(NO_STDATOMIC_H) #ifdef WOLFSSL_NO_ATOMIC #define XFENCE() WC_DO_NOTHING #else