aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/module/icp/algs
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2023-01-25 18:50:29 +0000
committerMartin Matuska <mm@FreeBSD.org>2023-01-25 18:50:29 +0000
commit15f0b8c309dea1dcb14d3e374686576ff68ac43f (patch)
tree8deb5ea3d3e71ae088585ae5d9081d647edf2b3c /sys/contrib/openzfs/module/icp/algs
parentda52fc464a4c80fdbed551824064d203831b4e7b (diff)
parent9cd71c8604d52def22ffaddc35755712f0fb9349 (diff)
downloadsrc-15f0b8c309dea1dcb14d3e374686576ff68ac43f.tar.gz
src-15f0b8c309dea1dcb14d3e374686576ff68ac43f.zip
zfs: merge openzfs/zfs@9cd71c860 (master)
Notable upstream pull request merges: #13805 Configure zed's diagnosis engine with vdev properties #14110 zfs list: Allow more fields in ZFS_ITER_SIMPLE mode #14121 Batch enqueue/dequeue for bqueue #14123 arc_read()/arc_access() refactoring and cleanup #14159 Bypass metaslab throttle for removal allocations #14243 Implement uncached prefetch #14251 Cache dbuf_hash() calculation #14253 Allow reciever to override encryption property in case of replication #14254 Restrict visibility of per-dataset kstats inside FreeBSD jails #14255 Zero end of embedded block buffer in dump_write_embedded() #14263 Cleanups identified by CodeQL and Coverity #14264 Miscellaneous fixes #14272 Change ZEVENT_POOL_GUID to ZEVENT_POOL to display pool names #14287 FreeBSD: Remove stray debug printf #14288 Colorize zfs diff output #14289 deadlock between spa_errlog_lock and dp_config_rwlock #14291 FreeBSD: Fix potential boot panic with bad label #14292 Add tunable to allow changing micro ZAP's max size #14293 Turn default_bs and default_ibs into ZFS_MODULE_PARAMs #14295 zed: add hotplug support for spare vdevs #14304 Activate filesystem features only in syncing context #14311 zpool: do guid-based comparison in is_vdev_cb() #14317 Pack zrlock_t by 8 bytes #14320 Update arc_summary and arcstat outputs #14328 FreeBSD: catch up to 1400077 #14376 Use setproctitle to report progress of zfs send #14340 Remove some dead ARC code #14358 Wait for txg sync if the last DRR_FREEOBJECTS might result in a hole #14360 libzpool: fix ddi_strtoull to update nptr #14364 Fix unprotected zfs_znode_dmu_fini #14379 zfs_receive_one: Check for the more likely error first #14380 Cleanup of dead code suggested by Clang Static Analyzer #14397 Avoid passing an uninitialized index to dsl_prop_known_index #14404 Fix reading uninitialized variable in receive_read #14407 free_blocks(): Fix reports from 2016 PVS Studio FreeBSD report #14418 Introduce minimal ZIL block commit delay #14422 x86 assembly: fix .size placement and replace .align with .balign Obtained from: OpenZFS OpenZFS commit: 9cd71c8604d52def22ffaddc35755712f0fb9349
Diffstat (limited to 'sys/contrib/openzfs/module/icp/algs')
-rw-r--r--sys/contrib/openzfs/module/icp/algs/aes/aes_impl.c2
-rw-r--r--sys/contrib/openzfs/module/icp/algs/aes/aes_impl_aesni.c9
-rw-r--r--sys/contrib/openzfs/module/icp/algs/blake3/blake3_impl.h1
-rw-r--r--sys/contrib/openzfs/module/icp/algs/blake3/blake3_x86-64.c20
-rw-r--r--sys/contrib/openzfs/module/icp/algs/modes/ccm.c2
-rw-r--r--sys/contrib/openzfs/module/icp/algs/modes/gcm.c20
-rw-r--r--sys/contrib/openzfs/module/icp/algs/modes/gcm_pclmulqdq.c3
-rw-r--r--sys/contrib/openzfs/module/icp/algs/sha2/sha2.c5
8 files changed, 33 insertions, 29 deletions
diff --git a/sys/contrib/openzfs/module/icp/algs/aes/aes_impl.c b/sys/contrib/openzfs/module/icp/algs/aes/aes_impl.c
index 9d90914aacfa..9daa975226fe 100644
--- a/sys/contrib/openzfs/module/icp/algs/aes/aes_impl.c
+++ b/sys/contrib/openzfs/module/icp/algs/aes/aes_impl.c
@@ -211,7 +211,7 @@ aes_alloc_keysched(size_t *size, int kmflag)
{
aes_key_t *keysched;
- keysched = (aes_key_t *)kmem_alloc(sizeof (aes_key_t), kmflag);
+ keysched = kmem_alloc(sizeof (aes_key_t), kmflag);
if (keysched != NULL) {
*size = sizeof (aes_key_t);
return (keysched);
diff --git a/sys/contrib/openzfs/module/icp/algs/aes/aes_impl_aesni.c b/sys/contrib/openzfs/module/icp/algs/aes/aes_impl_aesni.c
index 5bc1bf92dad4..61085214c77b 100644
--- a/sys/contrib/openzfs/module/icp/algs/aes/aes_impl_aesni.c
+++ b/sys/contrib/openzfs/module/icp/algs/aes/aes_impl_aesni.c
@@ -26,15 +26,16 @@
#include <sys/simd.h>
#include <sys/types.h>
+#include <sys/asm_linkage.h>
/* These functions are used to execute AES-NI instructions: */
-extern int rijndael_key_setup_enc_intel(uint32_t rk[],
+extern ASMABI int rijndael_key_setup_enc_intel(uint32_t rk[],
const uint32_t cipherKey[], uint64_t keyBits);
-extern int rijndael_key_setup_dec_intel(uint32_t rk[],
+extern ASMABI int rijndael_key_setup_dec_intel(uint32_t rk[],
const uint32_t cipherKey[], uint64_t keyBits);
-extern void aes_encrypt_intel(const uint32_t rk[], int Nr,
+extern ASMABI void aes_encrypt_intel(const uint32_t rk[], int Nr,
const uint32_t pt[4], uint32_t ct[4]);
-extern void aes_decrypt_intel(const uint32_t rk[], int Nr,
+extern ASMABI void aes_decrypt_intel(const uint32_t rk[], int Nr,
const uint32_t ct[4], uint32_t pt[4]);
diff --git a/sys/contrib/openzfs/module/icp/algs/blake3/blake3_impl.h b/sys/contrib/openzfs/module/icp/algs/blake3/blake3_impl.h
index eef74eaa9098..ecb51e3a3010 100644
--- a/sys/contrib/openzfs/module/icp/algs/blake3/blake3_impl.h
+++ b/sys/contrib/openzfs/module/icp/algs/blake3/blake3_impl.h
@@ -35,6 +35,7 @@ extern "C" {
#include <sys/types.h>
#include <sys/blake3.h>
#include <sys/simd.h>
+#include <sys/asm_linkage.h>
/*
* Methods used to define BLAKE3 assembler implementations
diff --git a/sys/contrib/openzfs/module/icp/algs/blake3/blake3_x86-64.c b/sys/contrib/openzfs/module/icp/algs/blake3/blake3_x86-64.c
index 84f8331ab37c..03e557edff4a 100644
--- a/sys/contrib/openzfs/module/icp/algs/blake3/blake3_x86-64.c
+++ b/sys/contrib/openzfs/module/icp/algs/blake3/blake3_x86-64.c
@@ -29,15 +29,15 @@
(defined(__x86_64) && defined(HAVE_SSE2)) || \
(defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
-extern void zfs_blake3_compress_in_place_sse2(uint32_t cv[8],
+extern void ASMABI zfs_blake3_compress_in_place_sse2(uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags);
-extern void zfs_blake3_compress_xof_sse2(const uint32_t cv[8],
+extern void ASMABI zfs_blake3_compress_xof_sse2(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags, uint8_t out[64]);
-extern void zfs_blake3_hash_many_sse2(const uint8_t * const *inputs,
+extern void ASMABI zfs_blake3_hash_many_sse2(const uint8_t * const *inputs,
size_t num_inputs, size_t blocks, const uint32_t key[8],
uint64_t counter, boolean_t increment_counter, uint8_t flags,
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
@@ -95,15 +95,15 @@ const blake3_ops_t blake3_sse2_impl = {
(defined(__x86_64) && defined(HAVE_SSE2)) || \
(defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
-extern void zfs_blake3_compress_in_place_sse41(uint32_t cv[8],
+extern void ASMABI zfs_blake3_compress_in_place_sse41(uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags);
-extern void zfs_blake3_compress_xof_sse41(const uint32_t cv[8],
+extern void ASMABI zfs_blake3_compress_xof_sse41(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags, uint8_t out[64]);
-extern void zfs_blake3_hash_many_sse41(const uint8_t * const *inputs,
+extern void ASMABI zfs_blake3_hash_many_sse41(const uint8_t * const *inputs,
size_t num_inputs, size_t blocks, const uint32_t key[8],
uint64_t counter, boolean_t increment_counter, uint8_t flags,
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
@@ -162,7 +162,7 @@ const blake3_ops_t blake3_sse41_impl = {
#endif
#if defined(__x86_64) && defined(HAVE_SSE4_1) && defined(HAVE_AVX2)
-extern void zfs_blake3_hash_many_avx2(const uint8_t * const *inputs,
+extern void ASMABI zfs_blake3_hash_many_avx2(const uint8_t * const *inputs,
size_t num_inputs, size_t blocks, const uint32_t key[8],
uint64_t counter, boolean_t increment_counter, uint8_t flags,
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
@@ -194,15 +194,15 @@ const blake3_ops_t blake3_avx2_impl = {
#endif
#if defined(__x86_64) && defined(HAVE_AVX512F) && defined(HAVE_AVX512VL)
-extern void zfs_blake3_compress_in_place_avx512(uint32_t cv[8],
+extern void ASMABI zfs_blake3_compress_in_place_avx512(uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags);
-extern void zfs_blake3_compress_xof_avx512(const uint32_t cv[8],
+extern void ASMABI zfs_blake3_compress_xof_avx512(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags, uint8_t out[64]);
-extern void zfs_blake3_hash_many_avx512(const uint8_t * const *inputs,
+extern void ASMABI zfs_blake3_hash_many_avx512(const uint8_t * const *inputs,
size_t num_inputs, size_t blocks, const uint32_t key[8],
uint64_t counter, boolean_t increment_counter, uint8_t flags,
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
diff --git a/sys/contrib/openzfs/module/icp/algs/modes/ccm.c b/sys/contrib/openzfs/module/icp/algs/modes/ccm.c
index 4a8bb9bbc2c8..1371676d6e68 100644
--- a/sys/contrib/openzfs/module/icp/algs/modes/ccm.c
+++ b/sys/contrib/openzfs/module/icp/algs/modes/ccm.c
@@ -657,7 +657,7 @@ ccm_format_initial_blocks(uchar_t *nonce, ulong_t nonceSize,
memset(&(b0[1+nonceSize]), 0, q);
payloadSize = aes_ctx->ccm_data_len;
- limit = 8 < q ? 8 : q;
+ limit = MIN(8, q);
for (i = 0, j = 0, k = 15; i < limit; i++, j += 8, k--) {
b0[k] = (uint8_t)((payloadSize >> j) & 0xFF);
diff --git a/sys/contrib/openzfs/module/icp/algs/modes/gcm.c b/sys/contrib/openzfs/module/icp/algs/modes/gcm.c
index 558a578090b2..472ec4bc9e13 100644
--- a/sys/contrib/openzfs/module/icp/algs/modes/gcm.c
+++ b/sys/contrib/openzfs/module/icp/algs/modes/gcm.c
@@ -59,7 +59,7 @@ boolean_t gcm_avx_can_use_movbe = B_FALSE;
static boolean_t gcm_use_avx = B_FALSE;
#define GCM_IMPL_USE_AVX (*(volatile boolean_t *)&gcm_use_avx)
-extern boolean_t atomic_toggle_boolean_nv(volatile boolean_t *);
+extern boolean_t ASMABI atomic_toggle_boolean_nv(volatile boolean_t *);
static inline boolean_t gcm_avx_will_work(void);
static inline void gcm_set_avx(boolean_t);
@@ -653,7 +653,7 @@ gcm_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
}
gcm_ctx->gcm_htab_len = htab_len;
gcm_ctx->gcm_Htable =
- (uint64_t *)kmem_alloc(htab_len, KM_SLEEP);
+ kmem_alloc(htab_len, KM_SLEEP);
if (gcm_ctx->gcm_Htable == NULL) {
return (CRYPTO_HOST_MEMORY);
@@ -728,7 +728,7 @@ gmac_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
}
gcm_ctx->gcm_htab_len = htab_len;
gcm_ctx->gcm_Htable =
- (uint64_t *)kmem_alloc(htab_len, KM_SLEEP);
+ kmem_alloc(htab_len, KM_SLEEP);
if (gcm_ctx->gcm_Htable == NULL) {
return (CRYPTO_HOST_MEMORY);
@@ -1073,19 +1073,19 @@ MODULE_PARM_DESC(icp_gcm_impl, "Select gcm implementation.");
static uint32_t gcm_avx_chunk_size =
((32 * 1024) / GCM_AVX_MIN_DECRYPT_BYTES) * GCM_AVX_MIN_DECRYPT_BYTES;
-extern void clear_fpu_regs_avx(void);
-extern void gcm_xor_avx(const uint8_t *src, uint8_t *dst);
-extern void aes_encrypt_intel(const uint32_t rk[], int nr,
+extern void ASMABI clear_fpu_regs_avx(void);
+extern void ASMABI gcm_xor_avx(const uint8_t *src, uint8_t *dst);
+extern void ASMABI aes_encrypt_intel(const uint32_t rk[], int nr,
const uint32_t pt[4], uint32_t ct[4]);
-extern void gcm_init_htab_avx(uint64_t *Htable, const uint64_t H[2]);
-extern void gcm_ghash_avx(uint64_t ghash[2], const uint64_t *Htable,
+extern void ASMABI gcm_init_htab_avx(uint64_t *Htable, const uint64_t H[2]);
+extern void ASMABI gcm_ghash_avx(uint64_t ghash[2], const uint64_t *Htable,
const uint8_t *in, size_t len);
-extern size_t aesni_gcm_encrypt(const uint8_t *, uint8_t *, size_t,
+extern size_t ASMABI aesni_gcm_encrypt(const uint8_t *, uint8_t *, size_t,
const void *, uint64_t *, uint64_t *);
-extern size_t aesni_gcm_decrypt(const uint8_t *, uint8_t *, size_t,
+extern size_t ASMABI aesni_gcm_decrypt(const uint8_t *, uint8_t *, size_t,
const void *, uint64_t *, uint64_t *);
static inline boolean_t
diff --git a/sys/contrib/openzfs/module/icp/algs/modes/gcm_pclmulqdq.c b/sys/contrib/openzfs/module/icp/algs/modes/gcm_pclmulqdq.c
index c2c8bc221203..737d2e47ecb7 100644
--- a/sys/contrib/openzfs/module/icp/algs/modes/gcm_pclmulqdq.c
+++ b/sys/contrib/openzfs/module/icp/algs/modes/gcm_pclmulqdq.c
@@ -26,9 +26,10 @@
#include <sys/types.h>
#include <sys/simd.h>
+#include <sys/asm_linkage.h>
/* These functions are used to execute pclmulqdq based assembly methods */
-extern void gcm_mul_pclmulqdq(uint64_t *, uint64_t *, uint64_t *);
+extern void ASMABI gcm_mul_pclmulqdq(uint64_t *, uint64_t *, uint64_t *);
#include <modes/gcm_impl.h>
diff --git a/sys/contrib/openzfs/module/icp/algs/sha2/sha2.c b/sys/contrib/openzfs/module/icp/algs/sha2/sha2.c
index 151432f1a5df..e6bbe34eaa57 100644
--- a/sys/contrib/openzfs/module/icp/algs/sha2/sha2.c
+++ b/sys/contrib/openzfs/module/icp/algs/sha2/sha2.c
@@ -48,6 +48,7 @@
#define HAVE_HTONL
#endif
#include <sys/isa_defs.h> /* for _ILP32 */
+#include <sys/asm_linkage.h>
static void Encode(uint8_t *, uint32_t *, size_t);
static void Encode64(uint8_t *, uint64_t *, size_t);
@@ -57,8 +58,8 @@ static void Encode64(uint8_t *, uint64_t *, size_t);
#define SHA512Transform(ctx, in) SHA512TransformBlocks((ctx), (in), 1)
#define SHA256Transform(ctx, in) SHA256TransformBlocks((ctx), (in), 1)
-void SHA512TransformBlocks(SHA2_CTX *ctx, const void *in, size_t num);
-void SHA256TransformBlocks(SHA2_CTX *ctx, const void *in, size_t num);
+void ASMABI SHA512TransformBlocks(SHA2_CTX *ctx, const void *in, size_t num);
+void ASMABI SHA256TransformBlocks(SHA2_CTX *ctx, const void *in, size_t num);
#else
static void SHA256Transform(SHA2_CTX *, const uint8_t *);