aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam/caamhash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/caam/caamhash.c')
-rw-r--r--drivers/crypto/caam/caamhash.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index 84573b4d6f92..e732bd962e98 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -72,8 +72,6 @@
72#define CAAM_MAX_HASH_DIGEST_SIZE SHA512_DIGEST_SIZE 72#define CAAM_MAX_HASH_DIGEST_SIZE SHA512_DIGEST_SIZE
73 73
74/* length of descriptors text */ 74/* length of descriptors text */
75#define DESC_JOB_IO_LEN (CAAM_CMD_SZ * 5 + CAAM_PTR_SZ * 3)
76
77#define DESC_AHASH_BASE (4 * CAAM_CMD_SZ) 75#define DESC_AHASH_BASE (4 * CAAM_CMD_SZ)
78#define DESC_AHASH_UPDATE_LEN (6 * CAAM_CMD_SZ) 76#define DESC_AHASH_UPDATE_LEN (6 * CAAM_CMD_SZ)
79#define DESC_AHASH_UPDATE_FIRST_LEN (DESC_AHASH_BASE + 4 * CAAM_CMD_SZ) 77#define DESC_AHASH_UPDATE_FIRST_LEN (DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
@@ -91,8 +89,6 @@
91 89
92#ifdef DEBUG 90#ifdef DEBUG
93/* for print_hex_dumps with line references */ 91/* for print_hex_dumps with line references */
94#define xstr(s) str(s)
95#define str(s) #s
96#define debug(format, arg...) printk(format, arg) 92#define debug(format, arg...) printk(format, arg)
97#else 93#else
98#define debug(format, arg...) 94#define debug(format, arg...)
@@ -331,7 +327,8 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash)
331 return -ENOMEM; 327 return -ENOMEM;
332 } 328 }
333#ifdef DEBUG 329#ifdef DEBUG
334 print_hex_dump(KERN_ERR, "ahash update shdesc@"xstr(__LINE__)": ", 330 print_hex_dump(KERN_ERR,
331 "ahash update shdesc@"__stringify(__LINE__)": ",
335 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 332 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
336#endif 333#endif
337 334
@@ -349,7 +346,8 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash)
349 return -ENOMEM; 346 return -ENOMEM;
350 } 347 }
351#ifdef DEBUG 348#ifdef DEBUG
352 print_hex_dump(KERN_ERR, "ahash update first shdesc@"xstr(__LINE__)": ", 349 print_hex_dump(KERN_ERR,
350 "ahash update first shdesc@"__stringify(__LINE__)": ",
353 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 351 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
354#endif 352#endif
355 353
@@ -366,7 +364,7 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash)
366 return -ENOMEM; 364 return -ENOMEM;
367 } 365 }
368#ifdef DEBUG 366#ifdef DEBUG
369 print_hex_dump(KERN_ERR, "ahash final shdesc@"xstr(__LINE__)": ", 367 print_hex_dump(KERN_ERR, "ahash final shdesc@"__stringify(__LINE__)": ",
370 DUMP_PREFIX_ADDRESS, 16, 4, desc, 368 DUMP_PREFIX_ADDRESS, 16, 4, desc,
371 desc_bytes(desc), 1); 369 desc_bytes(desc), 1);
372#endif 370#endif
@@ -384,7 +382,7 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash)
384 return -ENOMEM; 382 return -ENOMEM;
385 } 383 }
386#ifdef DEBUG 384#ifdef DEBUG
387 print_hex_dump(KERN_ERR, "ahash finup shdesc@"xstr(__LINE__)": ", 385 print_hex_dump(KERN_ERR, "ahash finup shdesc@"__stringify(__LINE__)": ",
388 DUMP_PREFIX_ADDRESS, 16, 4, desc, 386 DUMP_PREFIX_ADDRESS, 16, 4, desc,
389 desc_bytes(desc), 1); 387 desc_bytes(desc), 1);
390#endif 388#endif
@@ -403,7 +401,8 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash)
403 return -ENOMEM; 401 return -ENOMEM;
404 } 402 }
405#ifdef DEBUG 403#ifdef DEBUG
406 print_hex_dump(KERN_ERR, "ahash digest shdesc@"xstr(__LINE__)": ", 404 print_hex_dump(KERN_ERR,
405 "ahash digest shdesc@"__stringify(__LINE__)": ",
407 DUMP_PREFIX_ADDRESS, 16, 4, desc, 406 DUMP_PREFIX_ADDRESS, 16, 4, desc,
408 desc_bytes(desc), 1); 407 desc_bytes(desc), 1);
409#endif 408#endif
@@ -464,9 +463,9 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in,
464 LDST_SRCDST_BYTE_CONTEXT); 463 LDST_SRCDST_BYTE_CONTEXT);
465 464
466#ifdef DEBUG 465#ifdef DEBUG
467 print_hex_dump(KERN_ERR, "key_in@"xstr(__LINE__)": ", 466 print_hex_dump(KERN_ERR, "key_in@"__stringify(__LINE__)": ",
468 DUMP_PREFIX_ADDRESS, 16, 4, key_in, *keylen, 1); 467 DUMP_PREFIX_ADDRESS, 16, 4, key_in, *keylen, 1);
469 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 468 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
470 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 469 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
471#endif 470#endif
472 471
@@ -479,7 +478,8 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in,
479 wait_for_completion_interruptible(&result.completion); 478 wait_for_completion_interruptible(&result.completion);
480 ret = result.err; 479 ret = result.err;
481#ifdef DEBUG 480#ifdef DEBUG
482 print_hex_dump(KERN_ERR, "digested key@"xstr(__LINE__)": ", 481 print_hex_dump(KERN_ERR,
482 "digested key@"__stringify(__LINE__)": ",
483 DUMP_PREFIX_ADDRESS, 16, 4, key_in, 483 DUMP_PREFIX_ADDRESS, 16, 4, key_in,
484 digestsize, 1); 484 digestsize, 1);
485#endif 485#endif
@@ -530,7 +530,7 @@ static int ahash_setkey(struct crypto_ahash *ahash,
530#ifdef DEBUG 530#ifdef DEBUG
531 printk(KERN_ERR "split_key_len %d split_key_pad_len %d\n", 531 printk(KERN_ERR "split_key_len %d split_key_pad_len %d\n",
532 ctx->split_key_len, ctx->split_key_pad_len); 532 ctx->split_key_len, ctx->split_key_pad_len);
533 print_hex_dump(KERN_ERR, "key in @"xstr(__LINE__)": ", 533 print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
534 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1); 534 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
535#endif 535#endif
536 536
@@ -545,7 +545,7 @@ static int ahash_setkey(struct crypto_ahash *ahash,
545 return -ENOMEM; 545 return -ENOMEM;
546 } 546 }
547#ifdef DEBUG 547#ifdef DEBUG
548 print_hex_dump(KERN_ERR, "ctx.key@"xstr(__LINE__)": ", 548 print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ",
549 DUMP_PREFIX_ADDRESS, 16, 4, ctx->key, 549 DUMP_PREFIX_ADDRESS, 16, 4, ctx->key,
550 ctx->split_key_pad_len, 1); 550 ctx->split_key_pad_len, 1);
551#endif 551#endif
@@ -638,11 +638,11 @@ static void ahash_done(struct device *jrdev, u32 *desc, u32 err,
638 kfree(edesc); 638 kfree(edesc);
639 639
640#ifdef DEBUG 640#ifdef DEBUG
641 print_hex_dump(KERN_ERR, "ctx@"xstr(__LINE__)": ", 641 print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
642 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx, 642 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
643 ctx->ctx_len, 1); 643 ctx->ctx_len, 1);
644 if (req->result) 644 if (req->result)
645 print_hex_dump(KERN_ERR, "result@"xstr(__LINE__)": ", 645 print_hex_dump(KERN_ERR, "result@"__stringify(__LINE__)": ",
646 DUMP_PREFIX_ADDRESS, 16, 4, req->result, 646 DUMP_PREFIX_ADDRESS, 16, 4, req->result,
647 digestsize, 1); 647 digestsize, 1);
648#endif 648#endif
@@ -676,11 +676,11 @@ static void ahash_done_bi(struct device *jrdev, u32 *desc, u32 err,
676 kfree(edesc); 676 kfree(edesc);
677 677
678#ifdef DEBUG 678#ifdef DEBUG
679 print_hex_dump(KERN_ERR, "ctx@"xstr(__LINE__)": ", 679 print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
680 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx, 680 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
681 ctx->ctx_len, 1); 681 ctx->ctx_len, 1);
682 if (req->result) 682 if (req->result)
683 print_hex_dump(KERN_ERR, "result@"xstr(__LINE__)": ", 683 print_hex_dump(KERN_ERR, "result@"__stringify(__LINE__)": ",
684 DUMP_PREFIX_ADDRESS, 16, 4, req->result, 684 DUMP_PREFIX_ADDRESS, 16, 4, req->result,
685 digestsize, 1); 685 digestsize, 1);
686#endif 686#endif
@@ -714,11 +714,11 @@ static void ahash_done_ctx_src(struct device *jrdev, u32 *desc, u32 err,
714 kfree(edesc); 714 kfree(edesc);
715 715
716#ifdef DEBUG 716#ifdef DEBUG
717 print_hex_dump(KERN_ERR, "ctx@"xstr(__LINE__)": ", 717 print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
718 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx, 718 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
719 ctx->ctx_len, 1); 719 ctx->ctx_len, 1);
720 if (req->result) 720 if (req->result)
721 print_hex_dump(KERN_ERR, "result@"xstr(__LINE__)": ", 721 print_hex_dump(KERN_ERR, "result@"__stringify(__LINE__)": ",
722 DUMP_PREFIX_ADDRESS, 16, 4, req->result, 722 DUMP_PREFIX_ADDRESS, 16, 4, req->result,
723 digestsize, 1); 723 digestsize, 1);
724#endif 724#endif
@@ -752,11 +752,11 @@ static void ahash_done_ctx_dst(struct device *jrdev, u32 *desc, u32 err,
752 kfree(edesc); 752 kfree(edesc);
753 753
754#ifdef DEBUG 754#ifdef DEBUG
755 print_hex_dump(KERN_ERR, "ctx@"xstr(__LINE__)": ", 755 print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
756 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx, 756 DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
757 ctx->ctx_len, 1); 757 ctx->ctx_len, 1);
758 if (req->result) 758 if (req->result)
759 print_hex_dump(KERN_ERR, "result@"xstr(__LINE__)": ", 759 print_hex_dump(KERN_ERR, "result@"__stringify(__LINE__)": ",
760 DUMP_PREFIX_ADDRESS, 16, 4, req->result, 760 DUMP_PREFIX_ADDRESS, 16, 4, req->result,
761 digestsize, 1); 761 digestsize, 1);
762#endif 762#endif
@@ -852,7 +852,7 @@ static int ahash_update_ctx(struct ahash_request *req)
852 append_seq_out_ptr(desc, state->ctx_dma, ctx->ctx_len, 0); 852 append_seq_out_ptr(desc, state->ctx_dma, ctx->ctx_len, 0);
853 853
854#ifdef DEBUG 854#ifdef DEBUG
855 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 855 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
856 DUMP_PREFIX_ADDRESS, 16, 4, desc, 856 DUMP_PREFIX_ADDRESS, 16, 4, desc,
857 desc_bytes(desc), 1); 857 desc_bytes(desc), 1);
858#endif 858#endif
@@ -871,9 +871,9 @@ static int ahash_update_ctx(struct ahash_request *req)
871 *next_buflen = last_buflen; 871 *next_buflen = last_buflen;
872 } 872 }
873#ifdef DEBUG 873#ifdef DEBUG
874 print_hex_dump(KERN_ERR, "buf@"xstr(__LINE__)": ", 874 print_hex_dump(KERN_ERR, "buf@"__stringify(__LINE__)": ",
875 DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1); 875 DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1);
876 print_hex_dump(KERN_ERR, "next buf@"xstr(__LINE__)": ", 876 print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ",
877 DUMP_PREFIX_ADDRESS, 16, 4, next_buf, 877 DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
878 *next_buflen, 1); 878 *next_buflen, 1);
879#endif 879#endif
@@ -937,7 +937,7 @@ static int ahash_final_ctx(struct ahash_request *req)
937 digestsize); 937 digestsize);
938 938
939#ifdef DEBUG 939#ifdef DEBUG
940 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 940 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
941 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 941 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
942#endif 942#endif
943 943
@@ -1016,7 +1016,7 @@ static int ahash_finup_ctx(struct ahash_request *req)
1016 digestsize); 1016 digestsize);
1017 1017
1018#ifdef DEBUG 1018#ifdef DEBUG
1019 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 1019 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
1020 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1020 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
1021#endif 1021#endif
1022 1022
@@ -1086,7 +1086,7 @@ static int ahash_digest(struct ahash_request *req)
1086 digestsize); 1086 digestsize);
1087 1087
1088#ifdef DEBUG 1088#ifdef DEBUG
1089 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 1089 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
1090 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1090 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
1091#endif 1091#endif
1092 1092
@@ -1140,7 +1140,7 @@ static int ahash_final_no_ctx(struct ahash_request *req)
1140 edesc->src_nents = 0; 1140 edesc->src_nents = 0;
1141 1141
1142#ifdef DEBUG 1142#ifdef DEBUG
1143 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 1143 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
1144 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1144 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
1145#endif 1145#endif
1146 1146
@@ -1228,7 +1228,7 @@ static int ahash_update_no_ctx(struct ahash_request *req)
1228 map_seq_out_ptr_ctx(desc, jrdev, state, ctx->ctx_len); 1228 map_seq_out_ptr_ctx(desc, jrdev, state, ctx->ctx_len);
1229 1229
1230#ifdef DEBUG 1230#ifdef DEBUG
1231 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 1231 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
1232 DUMP_PREFIX_ADDRESS, 16, 4, desc, 1232 DUMP_PREFIX_ADDRESS, 16, 4, desc,
1233 desc_bytes(desc), 1); 1233 desc_bytes(desc), 1);
1234#endif 1234#endif
@@ -1250,9 +1250,9 @@ static int ahash_update_no_ctx(struct ahash_request *req)
1250 *next_buflen = 0; 1250 *next_buflen = 0;
1251 } 1251 }
1252#ifdef DEBUG 1252#ifdef DEBUG
1253 print_hex_dump(KERN_ERR, "buf@"xstr(__LINE__)": ", 1253 print_hex_dump(KERN_ERR, "buf@"__stringify(__LINE__)": ",
1254 DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1); 1254 DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1);
1255 print_hex_dump(KERN_ERR, "next buf@"xstr(__LINE__)": ", 1255 print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ",
1256 DUMP_PREFIX_ADDRESS, 16, 4, next_buf, 1256 DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
1257 *next_buflen, 1); 1257 *next_buflen, 1);
1258#endif 1258#endif
@@ -1321,7 +1321,7 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
1321 digestsize); 1321 digestsize);
1322 1322
1323#ifdef DEBUG 1323#ifdef DEBUG
1324 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 1324 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
1325 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1); 1325 DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
1326#endif 1326#endif
1327 1327
@@ -1414,7 +1414,7 @@ static int ahash_update_first(struct ahash_request *req)
1414 map_seq_out_ptr_ctx(desc, jrdev, state, ctx->ctx_len); 1414 map_seq_out_ptr_ctx(desc, jrdev, state, ctx->ctx_len);
1415 1415
1416#ifdef DEBUG 1416#ifdef DEBUG
1417 print_hex_dump(KERN_ERR, "jobdesc@"xstr(__LINE__)": ", 1417 print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
1418 DUMP_PREFIX_ADDRESS, 16, 4, desc, 1418 DUMP_PREFIX_ADDRESS, 16, 4, desc,
1419 desc_bytes(desc), 1); 1419 desc_bytes(desc), 1);
1420#endif 1420#endif
@@ -1438,7 +1438,7 @@ static int ahash_update_first(struct ahash_request *req)
1438 sg_copy(next_buf, req->src, req->nbytes); 1438 sg_copy(next_buf, req->src, req->nbytes);
1439 } 1439 }
1440#ifdef DEBUG 1440#ifdef DEBUG
1441 print_hex_dump(KERN_ERR, "next buf@"xstr(__LINE__)": ", 1441 print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ",
1442 DUMP_PREFIX_ADDRESS, 16, 4, next_buf, 1442 DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
1443 *next_buflen, 1); 1443 *next_buflen, 1);
1444#endif 1444#endif