Apply Crypto API wrappers to the exported crypto symbol in
CONFIG_ASYNC_XOR-related crypto to convert them into pluggable
interface.

Signed-off-by: Jay Wang <[email protected]>
---
 crypto/async_tx/Makefile     |  2 +-
 crypto/fips140/fips140-api.c | 12 ++++++++++++
 include/linux/async_tx.h     | 21 +++++++++------------
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/crypto/async_tx/Makefile b/crypto/async_tx/Makefile
index 9de69630d930..3ceb7c8d7598 100644
--- a/crypto/async_tx/Makefile
+++ b/crypto/async_tx/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 crypto-objs-$(CONFIG_ASYNC_CORE) += async_tx.o
 crypto-objs-$(CONFIG_ASYNC_MEMCPY) += async_memcpy.o
-obj-$(CONFIG_ASYNC_XOR) += async_xor.o
+crypto-objs-$(CONFIG_ASYNC_XOR) += async_xor.o
 obj-$(CONFIG_ASYNC_PQ) += async_pq.o
 obj-$(CONFIG_ASYNC_RAID6_RECOV) += async_raid6_recov.o
 obj-$(CONFIG_ASYNC_RAID6_TEST) += raid6test.o
diff --git a/crypto/fips140/fips140-api.c b/crypto/fips140/fips140-api.c
index 6644fce6555a..67e7b03e4dc4 100644
--- a/crypto/fips140/fips140-api.c
+++ b/crypto/fips140/fips140-api.c
@@ -819,6 +819,18 @@ DEFINE_CRYPTO_API_STUB(async_tx_quiesce);
 
 DEFINE_CRYPTO_API_STUB(async_memcpy);
 
+#endif
+/*
+ * crypto/async_tx/async_xor.c
+ */
+#if IS_BUILTIN(CONFIG_ASYNC_XOR)
+
+#include <linux/async_tx.h>
+
+DEFINE_CRYPTO_API_STUB(async_xor);
+DEFINE_CRYPTO_API_STUB(async_xor_offs);
+DEFINE_CRYPTO_API_STUB(async_xor_val_offs);
+
 #endif
 /*
  * crypto/ecdh_helper.c
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 194228a8d1c4..36bcc93c6944 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -161,20 +161,17 @@ DECLARE_CRYPTO_API(CONFIG_ASYNC_CORE, async_tx_submit, 
void,
        (struct dma_chan *chan, struct dma_async_tx_descriptor *tx, struct 
async_submit_ctl *submit),
        (chan, tx, submit));
 
-struct dma_async_tx_descriptor *
-async_xor(struct page *dest, struct page **src_list, unsigned int offset,
-         int src_cnt, size_t len, struct async_submit_ctl *submit);
+DECLARE_CRYPTO_API(CONFIG_ASYNC_XOR, async_xor, struct dma_async_tx_descriptor 
*,
+       (struct page *dest, struct page **src_list, unsigned int offset, int 
src_cnt, size_t len, struct async_submit_ctl *submit),
+       (dest, src_list, offset, src_cnt, len, submit));
 
-struct dma_async_tx_descriptor *
-async_xor_offs(struct page *dest, unsigned int offset,
-               struct page **src_list, unsigned int *src_offset,
-               int src_cnt, size_t len, struct async_submit_ctl *submit);
+DECLARE_CRYPTO_API(CONFIG_ASYNC_XOR, async_xor_offs, struct 
dma_async_tx_descriptor *,
+       (struct page *dest, unsigned int offset, struct page **src_list, 
unsigned int *src_offset, int src_cnt, size_t len, struct async_submit_ctl 
*submit),
+       (dest, offset, src_list, src_offset, src_cnt, len, submit));
 
-struct dma_async_tx_descriptor *
-async_xor_val_offs(struct page *dest, unsigned int offset,
-               struct page **src_list, unsigned int *src_offset,
-               int src_cnt, size_t len, enum sum_check_flags *result,
-               struct async_submit_ctl *submit);
+DECLARE_CRYPTO_API(CONFIG_ASYNC_XOR, async_xor_val_offs, struct 
dma_async_tx_descriptor *,
+       (struct page *dest, unsigned int offset, struct page **src_list, 
unsigned int *src_offset, int src_cnt, size_t len, enum sum_check_flags 
*result, struct async_submit_ctl *submit),
+       (dest, offset, src_list, src_offset, src_cnt, len, result, submit));
 
 DECLARE_CRYPTO_API(CONFIG_ASYNC_MEMCPY, async_memcpy, struct 
dma_async_tx_descriptor *,
        (struct page *dest, struct page *src, unsigned int dest_offset, 
unsigned int src_offset, size_t len, struct async_submit_ctl *submit),
-- 
2.47.3


Reply via email to