diff options
3 files changed, 105 insertions, 45 deletions
diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch index 96e949c..aa2f890 100644 --- a/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch +++ b/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch | |||
@@ -1,6 +1,6 @@ | |||
1 | From b19449e3c11ffd477a3db60f21e14930ed07f251 Mon Sep 17 00:00:00 2001 | 1 | From d12ae3d48d429e24ad4b0f219a16e09af8da3b1a Mon Sep 17 00:00:00 2001 |
2 | From: Yongxin Liu <yongxin.liu@windriver.com> | 2 | From: Yongxin Liu <yongxin.liu@windriver.com> |
3 | Date: Wed, 15 Jan 2020 13:50:38 +0000 | 3 | Date: Thu, 28 Jan 2021 10:02:22 +0000 |
4 | Subject: [PATCH] qat: Switch to skcipher API | 4 | Subject: [PATCH] qat: Switch to skcipher API |
5 | 5 | ||
6 | The patch is derived from mainline kernel commit 7fe948a52287 | 6 | The patch is derived from mainline kernel commit 7fe948a52287 |
@@ -10,32 +10,31 @@ Upstream-Status: Inappropriate [Code released in tarball form only] | |||
10 | 10 | ||
11 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> | 11 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> |
12 | --- | 12 | --- |
13 | .../drivers/crypto/qat/qat_common/qat_algs.c | 676 ++++++++++-------- | 13 | .../drivers/crypto/qat/qat_common/qat_algs.c | 674 ++++++++++-------- |
14 | .../crypto/qat/qat_common/qat_crypto.h | 6 +- | 14 | .../crypto/qat/qat_common/qat_crypto.h | 6 +- |
15 | 2 files changed, 394 insertions(+), 288 deletions(-) | 15 | 2 files changed, 394 insertions(+), 286 deletions(-) |
16 | 16 | ||
17 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | 17 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c |
18 | index c4edb3c..35bca76 100644 | 18 | index a7961a4..f600ad3 100644 |
19 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | 19 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c |
20 | +++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | 20 | +++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c |
21 | @@ -44,14 +44,15 @@ | 21 | @@ -49,6 +49,7 @@ |
22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | */ | ||
25 | -#ifndef QAT_AEAD_OLD_SUPPORTED | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
28 | #include <linux/crypto.h> | 23 | #include <linux/crypto.h> |
29 | #include <crypto/internal/aead.h> | 24 | #include <crypto/internal/aead.h> |
30 | +#include <crypto/internal/skcipher.h> | 25 | +#include <crypto/internal/skcipher.h> |
31 | #include <crypto/aes.h> | 26 | #include <crypto/aes.h> |
27 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) | ||
28 | #include <crypto/sha1.h> | ||
29 | @@ -57,6 +58,7 @@ | ||
32 | #include <crypto/sha.h> | 30 | #include <crypto/sha.h> |
31 | #endif | ||
33 | #include <crypto/hash.h> | 32 | #include <crypto/hash.h> |
34 | +#include <crypto/hmac.h> | 33 | +#include <crypto/hmac.h> |
35 | #include <crypto/algapi.h> | 34 | #include <crypto/algapi.h> |
36 | #include <crypto/authenc.h> | 35 | #include <crypto/authenc.h> |
37 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
38 | @@ -113,11 +114,16 @@ struct qat_alg_aead_ctx { | 37 | @@ -118,11 +120,16 @@ struct qat_alg_aead_ctx { |
39 | struct crypto_shash *hash_tfm; | 38 | struct crypto_shash *hash_tfm; |
40 | enum icp_qat_hw_auth_algo qat_hash_alg; | 39 | enum icp_qat_hw_auth_algo qat_hash_alg; |
41 | struct qat_crypto_instance *inst; | 40 | struct qat_crypto_instance *inst; |
@@ -54,7 +53,7 @@ index c4edb3c..35bca76 100644 | |||
54 | struct icp_qat_hw_cipher_algo_blk *enc_cd; | 53 | struct icp_qat_hw_cipher_algo_blk *enc_cd; |
55 | struct icp_qat_hw_cipher_algo_blk *dec_cd; | 54 | struct icp_qat_hw_cipher_algo_blk *dec_cd; |
56 | dma_addr_t enc_cd_paddr; | 55 | dma_addr_t enc_cd_paddr; |
57 | @@ -125,7 +131,7 @@ struct qat_alg_ablkcipher_ctx { | 56 | @@ -130,7 +137,7 @@ struct qat_alg_ablkcipher_ctx { |
58 | struct icp_qat_fw_la_bulk_req enc_fw_req; | 57 | struct icp_qat_fw_la_bulk_req enc_fw_req; |
59 | struct icp_qat_fw_la_bulk_req dec_fw_req; | 58 | struct icp_qat_fw_la_bulk_req dec_fw_req; |
60 | struct qat_crypto_instance *inst; | 59 | struct qat_crypto_instance *inst; |
@@ -63,7 +62,7 @@ index c4edb3c..35bca76 100644 | |||
63 | }; | 62 | }; |
64 | 63 | ||
65 | static int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg) | 64 | static int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg) |
66 | @@ -149,9 +155,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | 65 | @@ -154,9 +161,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, |
67 | unsigned int auth_keylen) | 66 | unsigned int auth_keylen) |
68 | { | 67 | { |
69 | SHASH_DESC_ON_STACK(shash, ctx->hash_tfm); | 68 | SHASH_DESC_ON_STACK(shash, ctx->hash_tfm); |
@@ -73,7 +72,7 @@ index c4edb3c..35bca76 100644 | |||
73 | int block_size = crypto_shash_blocksize(ctx->hash_tfm); | 72 | int block_size = crypto_shash_blocksize(ctx->hash_tfm); |
74 | int digest_size = crypto_shash_digestsize(ctx->hash_tfm); | 73 | int digest_size = crypto_shash_digestsize(ctx->hash_tfm); |
75 | __be32 *hash_state_out; | 74 | __be32 *hash_state_out; |
76 | @@ -160,7 +163,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | 75 | @@ -165,7 +169,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, |
77 | 76 | ||
78 | memset(ctx->ipad, 0, block_size); | 77 | memset(ctx->ipad, 0, block_size); |
79 | memset(ctx->opad, 0, block_size); | 78 | memset(ctx->opad, 0, block_size); |
@@ -81,7 +80,7 @@ index c4edb3c..35bca76 100644 | |||
81 | shash->tfm = ctx->hash_tfm; | 80 | shash->tfm = ctx->hash_tfm; |
82 | 81 | ||
83 | if (auth_keylen > block_size) { | 82 | if (auth_keylen > block_size) { |
84 | @@ -178,8 +180,8 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | 83 | @@ -183,8 +186,8 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, |
85 | for (i = 0; i < block_size; i++) { | 84 | for (i = 0; i < block_size; i++) { |
86 | char *ipad_ptr = ctx->ipad + i; | 85 | char *ipad_ptr = ctx->ipad + i; |
87 | char *opad_ptr = ctx->opad + i; | 86 | char *opad_ptr = ctx->opad + i; |
@@ -92,7 +91,7 @@ index c4edb3c..35bca76 100644 | |||
92 | } | 91 | } |
93 | 92 | ||
94 | if (crypto_shash_init(shash)) | 93 | if (crypto_shash_init(shash)) |
95 | @@ -193,22 +195,22 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | 94 | @@ -198,22 +201,22 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, |
96 | 95 | ||
97 | switch (ctx->qat_hash_alg) { | 96 | switch (ctx->qat_hash_alg) { |
98 | case ICP_QAT_HW_AUTH_ALGO_SHA1: | 97 | case ICP_QAT_HW_AUTH_ALGO_SHA1: |
@@ -121,7 +120,7 @@ index c4edb3c..35bca76 100644 | |||
121 | break; | 120 | break; |
122 | default: | 121 | default: |
123 | return -EFAULT; | 122 | return -EFAULT; |
124 | @@ -229,22 +231,22 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | 123 | @@ -234,22 +237,22 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, |
125 | 124 | ||
126 | switch (ctx->qat_hash_alg) { | 125 | switch (ctx->qat_hash_alg) { |
127 | case ICP_QAT_HW_AUTH_ALGO_SHA1: | 126 | case ICP_QAT_HW_AUTH_ALGO_SHA1: |
@@ -150,7 +149,7 @@ index c4edb3c..35bca76 100644 | |||
150 | break; | 149 | break; |
151 | default: | 150 | default: |
152 | return -EFAULT; | 151 | return -EFAULT; |
153 | @@ -254,7 +256,24 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | 152 | @@ -259,7 +262,24 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, |
154 | return 0; | 153 | return 0; |
155 | } | 154 | } |
156 | 155 | ||
@@ -176,7 +175,7 @@ index c4edb3c..35bca76 100644 | |||
176 | { | 175 | { |
177 | header->hdr_flags = | 176 | header->hdr_flags = |
178 | ICP_QAT_FW_COMN_HDR_FLAGS_BUILD(ICP_QAT_FW_COMN_REQ_FLAG_SET); | 177 | ICP_QAT_FW_COMN_HDR_FLAGS_BUILD(ICP_QAT_FW_COMN_REQ_FLAG_SET); |
179 | @@ -264,12 +283,12 @@ static void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header) | 178 | @@ -269,12 +289,12 @@ static void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header) |
180 | QAT_COMN_PTR_TYPE_SGL); | 179 | QAT_COMN_PTR_TYPE_SGL); |
181 | ICP_QAT_FW_LA_PARTIAL_SET(header->serv_specif_flags, | 180 | ICP_QAT_FW_LA_PARTIAL_SET(header->serv_specif_flags, |
182 | ICP_QAT_FW_LA_PARTIAL_NONE); | 181 | ICP_QAT_FW_LA_PARTIAL_NONE); |
@@ -193,7 +192,7 @@ index c4edb3c..35bca76 100644 | |||
193 | } | 192 | } |
194 | 193 | ||
195 | static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm, | 194 | static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm, |
196 | @@ -304,7 +323,7 @@ static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm, | 195 | @@ -309,7 +329,7 @@ static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm, |
197 | return -EFAULT; | 196 | return -EFAULT; |
198 | 197 | ||
199 | /* Request setup */ | 198 | /* Request setup */ |
@@ -202,7 +201,7 @@ index c4edb3c..35bca76 100644 | |||
202 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER_HASH; | 201 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER_HASH; |
203 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, | 202 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, |
204 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER); | 203 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER); |
205 | @@ -391,7 +410,7 @@ static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm, | 204 | @@ -396,7 +416,7 @@ static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm, |
206 | return -EFAULT; | 205 | return -EFAULT; |
207 | 206 | ||
208 | /* Request setup */ | 207 | /* Request setup */ |
@@ -211,7 +210,7 @@ index c4edb3c..35bca76 100644 | |||
211 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_HASH_CIPHER; | 210 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_HASH_CIPHER; |
212 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, | 211 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, |
213 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER); | 212 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER); |
214 | @@ -445,17 +464,17 @@ static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm, | 213 | @@ -450,17 +470,17 @@ static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm, |
215 | return 0; | 214 | return 0; |
216 | } | 215 | } |
217 | 216 | ||
@@ -234,7 +233,7 @@ index c4edb3c..35bca76 100644 | |||
234 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER; | 233 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER; |
235 | cd_pars->u.s.content_desc_params_sz = | 234 | cd_pars->u.s.content_desc_params_sz = |
236 | sizeof(struct icp_qat_hw_cipher_algo_blk) >> 3; | 235 | sizeof(struct icp_qat_hw_cipher_algo_blk) >> 3; |
237 | @@ -467,28 +486,28 @@ static void qat_alg_ablkcipher_init_com(struct qat_alg_ablkcipher_ctx *ctx, | 236 | @@ -472,28 +492,28 @@ static void qat_alg_ablkcipher_init_com(struct qat_alg_ablkcipher_ctx *ctx, |
238 | ICP_QAT_FW_COMN_NEXT_ID_SET(cd_ctrl, ICP_QAT_FW_SLICE_DRAM_WR); | 237 | ICP_QAT_FW_COMN_NEXT_ID_SET(cd_ctrl, ICP_QAT_FW_SLICE_DRAM_WR); |
239 | } | 238 | } |
240 | 239 | ||
@@ -271,7 +270,7 @@ index c4edb3c..35bca76 100644 | |||
271 | cd_pars->u.s.content_desc_addr = ctx->dec_cd_paddr; | 270 | cd_pars->u.s.content_desc_addr = ctx->dec_cd_paddr; |
272 | 271 | ||
273 | if (mode != ICP_QAT_HW_CIPHER_CTR_MODE) | 272 | if (mode != ICP_QAT_HW_CIPHER_CTR_MODE) |
274 | @@ -548,86 +567,110 @@ static int qat_alg_aead_init_sessions(struct crypto_aead *tfm, const u8 *key, | 273 | @@ -553,86 +573,110 @@ static int qat_alg_aead_init_sessions(struct crypto_aead *tfm, const u8 *key, |
275 | if (qat_alg_aead_init_dec_session(tfm, alg, &keys, mode)) | 274 | if (qat_alg_aead_init_dec_session(tfm, alg, &keys, mode)) |
276 | goto error; | 275 | goto error; |
277 | 276 | ||
@@ -425,7 +424,7 @@ index c4edb3c..35bca76 100644 | |||
425 | } | 424 | } |
426 | 425 | ||
427 | static void qat_alg_free_bufl(struct qat_crypto_instance *inst, | 426 | static void qat_alg_free_bufl(struct qat_crypto_instance *inst, |
428 | @@ -675,8 +718,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | 427 | @@ -680,8 +724,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, |
429 | dma_addr_t blp; | 428 | dma_addr_t blp; |
430 | dma_addr_t bloutp = 0; | 429 | dma_addr_t bloutp = 0; |
431 | struct scatterlist *sg; | 430 | struct scatterlist *sg; |
@@ -435,7 +434,7 @@ index c4edb3c..35bca76 100644 | |||
435 | 434 | ||
436 | if (unlikely(!n)) | 435 | if (unlikely(!n)) |
437 | return -EINVAL; | 436 | return -EINVAL; |
438 | @@ -688,7 +730,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | 437 | @@ -693,7 +736,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, |
439 | 438 | ||
440 | blp = dma_map_single(dev, bufl, sz, DMA_TO_DEVICE); | 439 | blp = dma_map_single(dev, bufl, sz, DMA_TO_DEVICE); |
441 | if (unlikely(dma_mapping_error(dev, blp))) | 440 | if (unlikely(dma_mapping_error(dev, blp))) |
@@ -444,7 +443,7 @@ index c4edb3c..35bca76 100644 | |||
444 | 443 | ||
445 | for_each_sg(sgl, sg, n, i) { | 444 | for_each_sg(sgl, sg, n, i) { |
446 | int y = sg_nctr; | 445 | int y = sg_nctr; |
447 | @@ -701,7 +743,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | 446 | @@ -706,7 +749,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, |
448 | DMA_BIDIRECTIONAL); | 447 | DMA_BIDIRECTIONAL); |
449 | bufl->bufers[y].len = sg->length; | 448 | bufl->bufers[y].len = sg->length; |
450 | if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) | 449 | if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) |
@@ -453,7 +452,7 @@ index c4edb3c..35bca76 100644 | |||
453 | sg_nctr++; | 452 | sg_nctr++; |
454 | } | 453 | } |
455 | bufl->num_bufs = sg_nctr; | 454 | bufl->num_bufs = sg_nctr; |
456 | @@ -713,16 +755,15 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | 455 | @@ -718,16 +761,15 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, |
457 | struct qat_alg_buf *bufers; | 456 | struct qat_alg_buf *bufers; |
458 | 457 | ||
459 | n = sg_nents(sglout); | 458 | n = sg_nents(sglout); |
@@ -473,7 +472,7 @@ index c4edb3c..35bca76 100644 | |||
473 | bufers = buflout->bufers; | 472 | bufers = buflout->bufers; |
474 | for_each_sg(sglout, sg, n, i) { | 473 | for_each_sg(sglout, sg, n, i) { |
475 | int y = sg_nctr; | 474 | int y = sg_nctr; |
476 | @@ -734,7 +775,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | 475 | @@ -739,7 +781,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, |
477 | sg->length, | 476 | sg->length, |
478 | DMA_BIDIRECTIONAL); | 477 | DMA_BIDIRECTIONAL); |
479 | if (unlikely(dma_mapping_error(dev, bufers[y].addr))) | 478 | if (unlikely(dma_mapping_error(dev, bufers[y].addr))) |
@@ -482,7 +481,7 @@ index c4edb3c..35bca76 100644 | |||
482 | bufers[y].len = sg->length; | 481 | bufers[y].len = sg->length; |
483 | sg_nctr++; | 482 | sg_nctr++; |
484 | } | 483 | } |
485 | @@ -749,8 +790,20 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | 484 | @@ -754,8 +796,20 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, |
486 | qat_req->buf.sz_out = 0; | 485 | qat_req->buf.sz_out = 0; |
487 | } | 486 | } |
488 | return 0; | 487 | return 0; |
@@ -505,7 +504,7 @@ index c4edb3c..35bca76 100644 | |||
505 | for (i = 0; i < n; i++) | 504 | for (i = 0; i < n; i++) |
506 | if (!dma_mapping_error(dev, bufl->bufers[i].addr)) | 505 | if (!dma_mapping_error(dev, bufl->bufers[i].addr)) |
507 | dma_unmap_single(dev, bufl->bufers[i].addr, | 506 | dma_unmap_single(dev, bufl->bufers[i].addr, |
508 | @@ -760,17 +813,8 @@ err: | 507 | @@ -765,17 +819,8 @@ err: |
509 | if (!dma_mapping_error(dev, blp)) | 508 | if (!dma_mapping_error(dev, blp)) |
510 | dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); | 509 | dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); |
511 | kfree(bufl); | 510 | kfree(bufl); |
@@ -525,7 +524,7 @@ index c4edb3c..35bca76 100644 | |||
525 | return -ENOMEM; | 524 | return -ENOMEM; |
526 | } | 525 | } |
527 | 526 | ||
528 | @@ -789,19 +833,25 @@ static void qat_aead_alg_callback(struct icp_qat_fw_la_resp *qat_resp, | 527 | @@ -794,19 +839,25 @@ static void qat_aead_alg_callback(struct icp_qat_fw_la_resp *qat_resp, |
529 | areq->base.complete(&areq->base, res); | 528 | areq->base.complete(&areq->base, res); |
530 | } | 529 | } |
531 | 530 | ||
@@ -556,7 +555,7 @@ index c4edb3c..35bca76 100644 | |||
556 | } | 555 | } |
557 | 556 | ||
558 | void qat_alg_callback(void *resp) | 557 | void qat_alg_callback(void *resp) |
559 | @@ -823,7 +873,7 @@ static int qat_alg_aead_dec(struct aead_request *areq) | 558 | @@ -828,7 +879,7 @@ static int qat_alg_aead_dec(struct aead_request *areq) |
560 | struct icp_qat_fw_la_auth_req_params *auth_param; | 559 | struct icp_qat_fw_la_auth_req_params *auth_param; |
561 | struct icp_qat_fw_la_bulk_req *msg; | 560 | struct icp_qat_fw_la_bulk_req *msg; |
562 | int digst_size = crypto_aead_authsize(aead_tfm); | 561 | int digst_size = crypto_aead_authsize(aead_tfm); |
@@ -565,7 +564,7 @@ index c4edb3c..35bca76 100644 | |||
565 | 564 | ||
566 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); | 565 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); |
567 | if (unlikely(ret)) | 566 | if (unlikely(ret)) |
568 | @@ -844,13 +894,14 @@ static int qat_alg_aead_dec(struct aead_request *areq) | 567 | @@ -849,13 +900,14 @@ static int qat_alg_aead_dec(struct aead_request *areq) |
569 | auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); | 568 | auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); |
570 | auth_param->auth_off = 0; | 569 | auth_param->auth_off = 0; |
571 | auth_param->auth_len = areq->assoclen + cipher_param->cipher_length; | 570 | auth_param->auth_len = areq->assoclen + cipher_param->cipher_length; |
@@ -584,7 +583,7 @@ index c4edb3c..35bca76 100644 | |||
584 | return -EINPROGRESS; | 583 | return -EINPROGRESS; |
585 | } | 584 | } |
586 | 585 | ||
587 | @@ -864,7 +915,7 @@ static int qat_alg_aead_enc(struct aead_request *areq) | 586 | @@ -869,7 +921,7 @@ static int qat_alg_aead_enc(struct aead_request *areq) |
588 | struct icp_qat_fw_la_auth_req_params *auth_param; | 587 | struct icp_qat_fw_la_auth_req_params *auth_param; |
589 | struct icp_qat_fw_la_bulk_req *msg; | 588 | struct icp_qat_fw_la_bulk_req *msg; |
590 | uint8_t *iv = areq->iv; | 589 | uint8_t *iv = areq->iv; |
@@ -593,7 +592,7 @@ index c4edb3c..35bca76 100644 | |||
593 | 592 | ||
594 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); | 593 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); |
595 | if (unlikely(ret)) | 594 | if (unlikely(ret)) |
596 | @@ -890,159 +941,230 @@ static int qat_alg_aead_enc(struct aead_request *areq) | 595 | @@ -895,159 +947,230 @@ static int qat_alg_aead_enc(struct aead_request *areq) |
597 | 596 | ||
598 | do { | 597 | do { |
599 | ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); | 598 | ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); |
@@ -906,7 +905,7 @@ index c4edb3c..35bca76 100644 | |||
906 | static int qat_alg_aead_init(struct crypto_aead *tfm, | 905 | static int qat_alg_aead_init(struct crypto_aead *tfm, |
907 | enum icp_qat_hw_auth_algo hash, | 906 | enum icp_qat_hw_auth_algo hash, |
908 | const char *hash_name) | 907 | const char *hash_name) |
909 | @@ -1085,30 +1207,30 @@ static void qat_alg_aead_exit(struct crypto_aead *tfm) | 908 | @@ -1090,30 +1213,30 @@ static void qat_alg_aead_exit(struct crypto_aead *tfm) |
910 | 909 | ||
911 | dev = &GET_DEV(inst->accel_dev); | 910 | dev = &GET_DEV(inst->accel_dev); |
912 | if (ctx->enc_cd) { | 911 | if (ctx->enc_cd) { |
@@ -944,7 +943,7 @@ index c4edb3c..35bca76 100644 | |||
944 | struct qat_crypto_instance *inst = ctx->inst; | 943 | struct qat_crypto_instance *inst = ctx->inst; |
945 | struct device *dev; | 944 | struct device *dev; |
946 | 945 | ||
947 | @@ -1117,15 +1239,15 @@ static void qat_alg_ablkcipher_exit(struct crypto_tfm *tfm) | 946 | @@ -1122,15 +1245,15 @@ static void qat_alg_ablkcipher_exit(struct crypto_tfm *tfm) |
948 | 947 | ||
949 | dev = &GET_DEV(inst->accel_dev); | 948 | dev = &GET_DEV(inst->accel_dev); |
950 | if (ctx->enc_cd) { | 949 | if (ctx->enc_cd) { |
@@ -964,7 +963,7 @@ index c4edb3c..35bca76 100644 | |||
964 | dma_free_coherent(dev, | 963 | dma_free_coherent(dev, |
965 | sizeof(struct icp_qat_hw_cipher_algo_blk), | 964 | sizeof(struct icp_qat_hw_cipher_algo_blk), |
966 | ctx->dec_cd, ctx->dec_cd_paddr); | 965 | ctx->dec_cd, ctx->dec_cd_paddr); |
967 | @@ -1187,92 +1309,75 @@ static struct aead_alg qat_aeads[] = { { | 966 | @@ -1192,92 +1315,75 @@ static struct aead_alg qat_aeads[] = { { |
968 | .maxauthsize = SHA512_DIGEST_SIZE, | 967 | .maxauthsize = SHA512_DIGEST_SIZE, |
969 | } }; | 968 | } }; |
970 | 969 | ||
@@ -1112,7 +1111,7 @@ index c4edb3c..35bca76 100644 | |||
1112 | ret = crypto_register_aeads(qat_aeads, ARRAY_SIZE(qat_aeads)); | 1111 | ret = crypto_register_aeads(qat_aeads, ARRAY_SIZE(qat_aeads)); |
1113 | if (ret) | 1112 | if (ret) |
1114 | goto unreg_algs; | 1113 | goto unreg_algs; |
1115 | @@ -1282,7 +1387,7 @@ unlock: | 1114 | @@ -1287,7 +1393,7 @@ unlock: |
1116 | return ret; | 1115 | return ret; |
1117 | 1116 | ||
1118 | unreg_algs: | 1117 | unreg_algs: |
@@ -1121,7 +1120,7 @@ index c4edb3c..35bca76 100644 | |||
1121 | goto unlock; | 1120 | goto unlock; |
1122 | } | 1121 | } |
1123 | 1122 | ||
1124 | @@ -1293,9 +1398,8 @@ void qat_algs_unregister(void) | 1123 | @@ -1298,7 +1404,7 @@ void qat_algs_unregister(void) |
1125 | goto unlock; | 1124 | goto unlock; |
1126 | 1125 | ||
1127 | crypto_unregister_aeads(qat_aeads, ARRAY_SIZE(qat_aeads)); | 1126 | crypto_unregister_aeads(qat_aeads, ARRAY_SIZE(qat_aeads)); |
@@ -1130,8 +1129,6 @@ index c4edb3c..35bca76 100644 | |||
1130 | 1129 | ||
1131 | unlock: | 1130 | unlock: |
1132 | mutex_unlock(&algs_lock); | 1131 | mutex_unlock(&algs_lock); |
1133 | } | ||
1134 | -#endif | ||
1135 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h b/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h | 1132 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h b/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h |
1136 | index dc0273f..300bb91 100644 | 1133 | index dc0273f..300bb91 100644 |
1137 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h | 1134 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h |
@@ -1157,5 +1154,5 @@ index dc0273f..300bb91 100644 | |||
1157 | 1154 | ||
1158 | #endif | 1155 | #endif |
1159 | -- | 1156 | -- |
1160 | 2.24.1 | 1157 | 2.29.2 |
1161 | 1158 | ||
diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-qat-include-sha1.h-and-sha2.h-instead-of-sha.h-in-ke.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-qat-include-sha1.h-and-sha2.h-instead-of-sha.h-in-ke.patch new file mode 100644 index 0000000..cf22fa1 --- /dev/null +++ b/recipes-extended/qat/files/qat17_4.7.0-00006-qat-include-sha1.h-and-sha2.h-instead-of-sha.h-in-ke.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From f27fe17a282206b6d4e8c3ad8d5aac8757f38ab5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yongxin Liu <yongxin.liu@windriver.com> | ||
3 | Date: Thu, 28 Jan 2021 13:07:59 +0800 | ||
4 | Subject: [PATCH] qat: include sha1.h and sha2.h instead of sha.h in kernel | ||
5 | v5.11 | ||
6 | |||
7 | In kernel commit a24d22b225ce ("crypto: sha - split sha.h into sha1.h and sha2.h"), | ||
8 | <crypto/sha.h> was split into two headers <crypto/sha1.h> and <crypto/sha2.h>. | ||
9 | |||
10 | Upstream-Status: Inappropriate [Code released in tarball form only] | ||
11 | |||
12 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> | ||
13 | --- | ||
14 | quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | 5 +++++ | ||
15 | .../utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c | 7 +++++-- | ||
16 | 2 files changed, 10 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | ||
19 | index c4edb3c..a7961a4 100644 | ||
20 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | ||
21 | +++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | ||
22 | @@ -50,7 +50,12 @@ | ||
23 | #include <linux/crypto.h> | ||
24 | #include <crypto/internal/aead.h> | ||
25 | #include <crypto/aes.h> | ||
26 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) | ||
27 | +#include <crypto/sha1.h> | ||
28 | +#include <crypto/sha2.h> | ||
29 | +#else | ||
30 | #include <crypto/sha.h> | ||
31 | +#endif | ||
32 | #include <crypto/hash.h> | ||
33 | #include <crypto/algapi.h> | ||
34 | #include <crypto/authenc.h> | ||
35 | diff --git a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c | ||
36 | index 92ee35b..483aef2 100644 | ||
37 | --- a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c | ||
38 | +++ b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c | ||
39 | @@ -66,15 +66,18 @@ | ||
40 | |||
41 | #include "Osal.h" | ||
42 | #include <linux/crypto.h> | ||
43 | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) | ||
44 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) | ||
45 | +#include <crypto/sha1.h> | ||
46 | +#include <crypto/sha2.h> | ||
47 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) | ||
48 | #include <crypto/sha.h> | ||
49 | #else | ||
50 | #include <linux/cryptohash.h> | ||
51 | +#include <crypto/sha.h> | ||
52 | #endif | ||
53 | #include <linux/version.h> | ||
54 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) | ||
55 | #include <crypto/internal/hash.h> | ||
56 | -#include <crypto/sha.h> | ||
57 | |||
58 | #define OSAL_MAX_SHASH_DECSIZE 512 | ||
59 | |||
60 | -- | ||
61 | 2.14.5 | ||
62 | |||
diff --git a/recipes-extended/qat/qat17_4.7.0-00006.bb b/recipes-extended/qat/qat17_4.7.0-00006.bb index e1c619d..11082f9 100644 --- a/recipes-extended/qat/qat17_4.7.0-00006.bb +++ b/recipes-extended/qat/qat17_4.7.0-00006.bb | |||
@@ -27,6 +27,7 @@ SRC_URI = "https://01.org/sites/default/files/downloads/qat1.7.l.4.7.0-00006.tar | |||
27 | file://qat17_4.7.0-00006-qat-replace-linux-cryptohash.h-with-crypto-sha.h-for.patch \ | 27 | file://qat17_4.7.0-00006-qat-replace-linux-cryptohash.h-with-crypto-sha.h-for.patch \ |
28 | file://qat17_4.7.0-00006-overwrite-KBUILD_BUILTIN-in-kernel-s-Makefile.patch \ | 28 | file://qat17_4.7.0-00006-overwrite-KBUILD_BUILTIN-in-kernel-s-Makefile.patch \ |
29 | file://qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch \ | 29 | file://qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch \ |
30 | file://qat17_4.7.0-00006-qat-include-sha1.h-and-sha2.h-instead-of-sha.h-in-ke.patch \ | ||
30 | " | 31 | " |
31 | 32 | ||
32 | do_fetch[depends] += "virtual/kernel:do_shared_workdir" | 33 | do_fetch[depends] += "virtual/kernel:do_shared_workdir" |