36 #include <linux/module.h>
40 #include <linux/kdev_t.h>
42 #include <linux/sched.h>
44 #include <linux/poll.h>
45 #include <linux/wait.h>
46 #include <linux/pci.h>
49 #include <linux/device.h>
50 #include <linux/errno.h>
52 #include <linux/kernel.h>
57 #include <linux/list.h>
65 #include <crypto/sha.h>
67 #include <crypto/aes.h>
76 #if defined(CONFIG_CRYPTO) || defined(CONFIG_CRYPTO_MODULE)
83 static void sep_dequeuer(
void *
data);
97 if (sep_work !=
NULL) {
101 pr_debug(
"sep crypto: do callback - NULL container\n");
116 void(*funct)(
void *),
124 if (sep_work ==
NULL) {
125 pr_debug(
"sep crypto: cant allocate work structure\n");
134 pr_debug(
"sep_crypto: queue_work failed\n");
158 size_t real_page_size;
176 while (current_size < size) {
177 current_size += real_page_size;
183 dev_warn(&sep->
pdev->dev,
"Cannot allocate page for new sg\n");
191 for (ct1 = 0; ct1 < nbr_pages; ct1 += 1) {
195 "Cannot allocate page for new buffer\n");
200 sg_set_buf(sg_temp, buf, real_page_size);
201 if ((size - current_size) > real_page_size) {
202 sg_temp->
length = real_page_size;
203 current_size += real_page_size;
205 sg_temp->
length = (size - current_size);
217 static void sep_free_sg_buf(
struct scatterlist *sg)
221 free_page((
unsigned long)sg_virt(sg_temp));
237 static void sep_copy_sg(
244 u32 in_offset, out_offset;
254 if ((sg_src ==
NULL) || (sg_dst ==
NULL) || (size == 0))
257 dev_dbg(&sep->
pdev->dev,
"sep copy sg not null\n");
259 while (count < size) {
260 if ((sg_src_tmp->
length - in_offset) >
261 (sg_dst_tmp->
length - out_offset))
262 seg_size = sg_dst_tmp->
length - out_offset;
264 seg_size = sg_src_tmp->
length - in_offset;
266 if (seg_size > (size - count))
267 seg_size = (size =
count);
269 memcpy(sg_virt(sg_dst_tmp) + out_offset,
270 sg_virt(sg_src_tmp) + in_offset,
273 in_offset += seg_size;
274 out_offset += seg_size;
277 if (in_offset >= sg_src_tmp->
length) {
278 sg_src_tmp =
sg_next(sg_src_tmp);
282 if (out_offset >= sg_dst_tmp->
length) {
283 sg_dst_tmp =
sg_next(sg_dst_tmp);
311 static int sep_oddball_pages(
321 u32 nbr_pages, page_count;
324 if ((sg ==
NULL) || (data_size == 0) || (data_size < block_size))
327 dev_dbg(&sep->
pdev->dev,
"sep oddball not null\n");
339 while ((sg_temp) && (flag == 0)) {
341 if (sg_temp->
length % block_size)
348 if (nbr_pages == page_count)
352 dev_dbg(&sep->
pdev->dev,
"sep oddball processing\n");
353 *new_sg = sep_alloc_sg_buf(sep, data_size, block_size);
354 if (*new_sg ==
NULL) {
360 sep_copy_sg(sep, sg, *new_sg, data_size);
381 static size_t sep_copy_offset_sg(
390 size_t offset_within_page;
391 size_t length_within_page;
392 size_t length_remaining;
393 size_t current_offset;
398 while ((sg) && (offset > page_end)) {
408 offset_within_page = offset - page_start;
409 if ((sg->
length - offset_within_page) >= len) {
411 memcpy(dst, sg_virt(sg) + offset_within_page, len);
416 length_remaining = len;
417 while ((sg) && (current_offset < len)) {
418 length_within_page = sg->
length - offset_within_page;
419 if (length_within_page >= length_remaining) {
420 memcpy(dst+current_offset,
421 sg_virt(sg) + offset_within_page,
423 length_remaining = 0;
424 current_offset = len;
426 memcpy(dst+current_offset,
427 sg_virt(sg) + offset_within_page,
429 length_remaining -= length_within_page;
430 current_offset += length_within_page;
431 offset_within_page = 0;
451 static int partial_overlap(
void *src_ptr,
void *dst_ptr,
u32 nbytes)
454 if (src_ptr != dst_ptr) {
455 if (src_ptr < dst_ptr) {
456 if ((src_ptr + nbytes) > dst_ptr)
459 if ((dst_ptr + nbytes) > src_ptr)
480 ta_ctx = ablkcipher_request_ctx(req);
481 tfm = crypto_ablkcipher_reqtfm(req);
482 sctx = crypto_ablkcipher_ctx(tfm);
492 "sep - vendor iv for DES\n");
493 cptr = (
unsigned char *)des_internal->
iv_context;
494 for (ct1 = 0; ct1 < crypto_ablkcipher_ivsize(tfm); ct1 += 1)
496 "%02x\n", *(cptr + ct1));
500 "sep - walk from kernel crypto iv for DES\n");
501 cptr = (
unsigned char *)ta_ctx->
walk.iv;
502 for (ct1 = 0; ct1 < crypto_ablkcipher_ivsize(tfm); ct1 += 1)
504 "%02x\n", *(cptr + ct1));
512 "sep - vendor iv for AES\n");
513 cptr = (
unsigned char *)aes_internal->
aes_ctx_iv;
514 for (ct1 = 0; ct1 < crypto_ablkcipher_ivsize(tfm); ct1 += 1)
516 "%02x\n", *(cptr + ct1));
520 "sep - walk from kernel crypto iv for AES\n");
521 cptr = (
unsigned char *)ta_ctx->
walk.iv;
522 for (ct1 = 0; ct1 < crypto_ablkcipher_ivsize(tfm); ct1 += 1)
524 "%02x\n", *(cptr + ct1));
532 static int sep_weak_key(
const u8 *
key,
unsigned int keylen)
535 8, 1, 0, 8, 0, 8, 8, 0, 0, 8, 8, 0, 8, 0, 2, 8,
536 0, 8, 8, 0, 8, 0, 0, 8, 8,
538 0, 8, 8, 0, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8, 8, 0,
539 8, 0, 0, 8, 0, 8, 8, 0, 0,
541 0, 8, 8, 0, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8, 8, 0,
542 8, 0, 0, 8, 0, 8, 8, 0, 0,
544 8, 0, 0, 8, 0, 8, 8, 0, 0, 8, 8, 0, 8, 0, 0, 8,
545 0, 8, 8, 0, 8, 0, 0, 8, 8,
547 0, 8, 8, 0, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8, 8, 0,
548 8, 0, 0, 8, 0, 8, 8, 0, 0,
550 8, 0, 0, 8, 0, 8, 8, 0, 0, 8, 8, 0, 8, 0, 0, 8,
551 0, 8, 8, 0, 8, 0, 0, 8, 8,
553 8, 0, 0, 8, 0, 8, 8, 0, 0, 8, 8, 0, 8, 0, 0, 8,
554 0, 8, 8, 0, 8, 0, 0, 8, 8,
556 4, 8, 8, 0, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8, 8, 0,
557 8, 5, 0, 8, 0, 8, 8, 0, 0,
563 n = parity[key[0]]; n <<= 4;
564 n |= parity[key[1]]; n <<= 4;
565 n |= parity[key[2]]; n <<= 4;
566 n |= parity[key[3]]; n <<= 4;
567 n |= parity[key[4]]; n <<= 4;
568 n |= parity[key[5]]; n <<= 4;
569 n |= parity[key[6]]; n <<= 4;
574 if (!((n - (w >> 3)) & w)) {
575 if (n < 0x41415151) {
576 if (n < 0x31312121) {
577 if (n < 0x14141515) {
593 if (n < 0x34342525) {
610 if (n < 0x61616161) {
611 if (n < 0x44445555) {
627 if (n < 0x64646565) {
678 return sizeof(
u32) * 2;
699 word_ptr = (
u32 *)(ta_ctx->
msgptr + msg_offset);
716 *msg_offset =
sizeof(
u32) * 2;
746 void_ptr = ta_ctx->
msgptr + *msg_offset;
747 word_ptr = (
u32 *)void_ptr;
748 memcpy(void_ptr, in_addr, size);
754 for (i = 0; i < ((size + 3) / 4); i += 1)
755 *(word_ptr + i) =
CHG_ENDIAN(*(word_ptr + i));
771 *msg_offset = sep_start_msg(ta_ctx);
772 word_ptr = (
u32 *)(ta_ctx->
msgptr + *msg_offset);
774 *msg_offset +=
sizeof(
u32);
789 static void sep_read_msg(
struct this_task_ctx *ta_ctx,
void *in_addr,
790 u32 size,
u32 max_size,
u32 *msg_offset,
u32 byte_array)
794 void_ptr = ta_ctx->
msgptr + *msg_offset;
795 word_ptr = (
u32 *)void_ptr;
800 for (i = 0; i < ((size + 3) / 4); i += 1)
801 *(word_ptr + i) =
CHG_ENDIAN(*(word_ptr + i));
804 memcpy(in_addr, void_ptr, size);
823 dev_dbg(&sep->
pdev->dev,
"dumping return message\n");
824 error = sep_start_inbound_msg(ta_ctx, msg_offset);
827 "sep_start_inbound_msg error\n");
831 sep_read_msg(ta_ctx, in_ary,
sizeof(
u32) * 2,
sizeof(
u32) * 2,
834 if (in_ary[0] != op_code) {
836 "sep got back wrong opcode\n");
838 "got back %x; expected %x\n",
843 if (in_ary[1] !=
SEP_OK) {
845 "sep execution error\n");
847 "got back %x; expected %x\n",
870 u32 max_length = ((len + 3) /
sizeof(
u32)) *
sizeof(
u32);
871 sep_read_msg(ta_ctx, dst, len, max_length, msg_offset, 0);
886 static void sep_write_context(
struct this_task_ctx *ta_ctx,
u32 *msg_offset,
889 u32 max_length = ((len + 3) /
sizeof(
u32)) *
sizeof(
u32);
890 sep_write_msg(ta_ctx, src, len, max_length, msg_offset, 0);
925 ta_ctx->
sep_used->current_request = 0;
926 ta_ctx->
sep_used->current_hash_stage = 0;
938 #ifdef SEP_ENABLE_RUNTIME_PM
940 pm_runtime_mark_last_busy(&ta_ctx->
sep_used->pdev->dev);
941 pm_runtime_put_autosuspend(&ta_ctx->
sep_used->pdev->dev);
946 ta_ctx->
sep_used->pid_doing_transaction = 0;
949 "[PID%d] waking up next transaction\n",
972 sep_clear_out(ta_ctx);
982 if (cypher_req !=
NULL) {
985 if (cypher_req->
base.complete ==
NULL) {
987 "release is null for cypher!");
989 cypher_req->
base.complete(
990 &cypher_req->
base, error);
995 if (hash_req !=
NULL) {
996 if (hash_req->
base.complete ==
NULL) {
998 "release is null for hash!");
1000 hash_req->
base.complete(
1001 &hash_req->
base, error);
1012 static int sep_crypto_take_sep(
struct this_task_ctx *ta_ctx)
1027 "[PID%d] updating queue status error\n",
current->pid);
1036 if (
sep_dev->power_save_setup == 1)
1037 pm_runtime_get_sync(&
sep_dev->pdev->dev);
1069 dev_dbg(&sep->
pdev->dev,
"[PID%d]: sending command to the sep\n",
1073 dev_dbg(&sep->
pdev->dev,
"[PID%d]: command sent okay\n",
1076 dev_dbg(&sep->
pdev->dev,
"[PID%d]: cant send command\n",
1101 static char small_buf[100];
1113 ta_ctx = ablkcipher_request_ctx(req);
1114 tfm = crypto_ablkcipher_reqtfm(req);
1115 sctx = crypto_ablkcipher_ctx(tfm);
1119 dev_dbg(&ta_ctx->
sep_used->pdev->dev,
"sep crypto block data size of %x\n",
1130 "crypto block: src is %lx dst is %lx\n",
1131 (
unsigned long)req->
src, (
unsigned long)req->
dst);
1134 int_error = sep_oddball_pages(ta_ctx->
sep_used, req->
src,
1135 req->
nbytes, ta_ctx->
walk.blocksize, &new_sg, 1);
1137 if (int_error < 0) {
1140 }
else if (int_error == 1) {
1148 int_error = sep_oddball_pages(ta_ctx->
sep_used, req->
dst,
1149 req->
nbytes, ta_ctx->
walk.blocksize, &new_sg, 0);
1151 if (int_error < 0) {
1155 }
else if (int_error == 1) {
1170 src_ptr = sg_virt(ta_ctx->
src_sg);
1171 dst_ptr = sg_virt(ta_ctx->
dst_sg);
1173 if (!src_ptr || !dst_ptr ||
1175 crypto_ablkcipher_blocksize(tfm))) {
1178 "cipher block size odd\n");
1180 "cipher block size is %x\n",
1181 crypto_ablkcipher_blocksize(tfm));
1183 "cipher data size is %x\n",
1188 if (partial_overlap(src_ptr, dst_ptr,
1191 "block partial overlap\n");
1196 sep_make_header(ta_ctx, &msg_offset, ta_ctx->
block_opcode);
1200 (req->
nbytes == crypto_ablkcipher_blocksize(tfm))) {
1203 "writing out one block des\n");
1207 small_buf, crypto_ablkcipher_blocksize(tfm));
1209 if (copy_result != crypto_ablkcipher_blocksize(tfm)) {
1211 "des block copy faild\n");
1216 sep_write_msg(ta_ctx, small_buf,
1217 crypto_ablkcipher_blocksize(tfm),
1218 crypto_ablkcipher_blocksize(tfm) * 2,
1222 sep_write_msg(ta_ctx, &req->
nbytes,
1223 sizeof(
u32),
sizeof(
u32), &msg_offset, 0);
1230 crypto_ablkcipher_blocksize(tfm);
1245 "crypto dma table create failed\n");
1255 sep_write_msg(ta_ctx, (
void *)msg,
sizeof(
u32) * 5,
1256 sizeof(
u32) * 5, &msg_offset, 0);
1264 sep_dump_ivs(req,
"sending data block to sep\n");
1269 "overwrite vendor iv on DES\n");
1273 ta_ctx->
walk.iv, crypto_ablkcipher_ivsize(tfm));
1278 "overwrite vendor iv on AES\n");
1282 ta_ctx->
walk.iv, crypto_ablkcipher_ivsize(tfm));
1287 sep_write_context(ta_ctx, &msg_offset,
1291 sep_write_context(ta_ctx, &msg_offset,
1297 sep_end_msg(ta_ctx, msg_offset);
1323 ta_ctx = ablkcipher_request_ctx(req);
1324 tfm = crypto_ablkcipher_reqtfm(req);
1325 sctx = crypto_ablkcipher_ctx(tfm);
1332 "sep crypto block data size of %x\n", req->
nbytes);
1344 if (!ta_ctx->
walk.iv) {
1354 if (!ta_ctx->
walk.iv) {
1364 sep_make_header(ta_ctx, &msg_offset, ta_ctx->
init_opcode);
1369 sep_write_msg(ta_ctx, ta_ctx->
iv,
1374 msg_offset += 4 *
sizeof(
u32);
1378 sizeof(
u32)) *
sizeof(
u32);
1380 sep_write_msg(ta_ctx, ta_ctx->
iv,
1385 msg_offset += max_length;
1391 sep_write_msg(ta_ctx, (
void *)&sctx->
key.
des.key1,
1392 sizeof(
u32) * 8,
sizeof(
u32) * 8,
1399 sep_write_msg(ta_ctx, (
void *)
msg,
1400 sizeof(
u32) * 3,
sizeof(
u32) * 3,
1403 sep_write_msg(ta_ctx, (
void *)&sctx->
key.
aes,
1412 sep_write_msg(ta_ctx, (
void *)msg,
1413 sizeof(
u32) * 4,
sizeof(
u32) * 4,
1418 sep_end_msg(ta_ctx, msg_offset);
1426 static void sep_crypto_block(
void *data)
1436 int are_we_done_yet;
1439 ta_ctx = ablkcipher_request_ctx(req);
1440 tfm = crypto_ablkcipher_reqtfm(req);
1441 sctx = crypto_ablkcipher_ctx(tfm);
1446 pr_debug(
"tfm is %p sctx is %p ta_ctx is %p\n",
1452 are_we_done_yet = 0;
1453 result = sep_crypto_send_key(req);
1456 "could not prep key %x\n", result);
1457 sep_crypto_release(sctx, ta_ctx, result);
1461 result = sep_crypto_take_sep(ta_ctx);
1464 "sep_crypto_take_sep for key send failed\n");
1465 sep_crypto_release(sctx, ta_ctx, result);
1472 (are_we_done_yet == 0))
1476 if (are_we_done_yet == 0) {
1478 "Send key job never got done\n");
1479 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
1488 are_we_done_yet = 0;
1490 result = sep_crypto_block_data(req);
1494 "could prep not send block %x\n", result);
1495 sep_crypto_release(sctx, ta_ctx, result);
1499 result = sep_crypto_take_sep(ta_ctx);
1502 "sep_crypto_take_sep for block send failed\n");
1503 sep_crypto_release(sctx, ta_ctx, result);
1509 while ((
time_before(jiffies, end_time)) && (are_we_done_yet == 0))
1513 if (are_we_done_yet == 0) {
1515 "Send block job never got done\n");
1516 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
1522 pr_debug(
"crypto_block leaving\n");
1523 pr_debug(
"tfm is %p sctx is %p ta_ctx is %p\n", tfm, sctx, ta_ctx);
1536 static char small_buf[100];
1554 sctx = crypto_ablkcipher_ctx(tfm);
1557 pr_debug(
"key_sent is %d tfm is %p sctx is %p ta_ctx is %p\n",
1558 sctx->
key_sent, tfm, sctx, ta_ctx);
1561 dev_dbg(&ta_ctx->
sep_used->pdev->dev,
"crypto post_op message dump\n");
1571 u32_error = sep_verify_op(ta_ctx, ta_ctx->
init_opcode,
1575 "aes init error %x\n", u32_error);
1576 sep_crypto_release(sctx, ta_ctx, u32_error);
1582 sep_read_context(ta_ctx, &msg_offset,
1586 sep_read_context(ta_ctx, &msg_offset,
1591 sep_dump_ivs(req,
"after sending key to sep\n");
1603 "crypto_post_op block response\n");
1605 u32_error = sep_verify_op(ta_ctx, ta_ctx->
block_opcode,
1610 "sep block error %x\n", u32_error);
1611 sep_crypto_release(sctx, ta_ctx, u32_error);
1618 "post op for DES\n");
1622 crypto_ablkcipher_blocksize(tfm)) {
1624 sep_read_msg(ta_ctx, small_buf,
1625 crypto_ablkcipher_blocksize(tfm),
1626 crypto_ablkcipher_blocksize(tfm) * 2,
1630 "reading in block des\n");
1634 sep_sg_nents(ta_ctx->
dst_sg),
1636 crypto_ablkcipher_blocksize(tfm));
1639 crypto_ablkcipher_blocksize(tfm)) {
1642 "des block copy faild\n");
1643 sep_crypto_release(sctx, ta_ctx,
1650 sep_read_context(ta_ctx, &msg_offset,
1656 "post op for AES\n");
1659 msg_offset += (
sizeof(
u32) * 4);
1662 sep_read_context(ta_ctx, &msg_offset,
1678 sep_dump_ivs(req,
"got data block from sep\n");
1683 "returning result iv to walk on DES\n");
1688 crypto_ablkcipher_ivsize(tfm));
1693 "returning result iv to walk on AES\n");
1698 crypto_ablkcipher_ivsize(tfm));
1702 sep_crypto_release(sctx, ta_ctx, 0);
1705 pr_debug(
"key_sent is %d tfm is %p sctx is %p ta_ctx is %p\n",
1706 sctx->
key_sent, tfm, sctx, ta_ctx);
1719 "hash init post op\n");
1731 sep_crypto_release(sctx, ta_ctx, u32_error);
1736 sep_read_context(ta_ctx, &msg_offset,
1742 sep_crypto_release(sctx, ta_ctx, 0);
1754 "hash update post op\n");
1766 sep_crypto_release(sctx, ta_ctx, u32_error);
1771 sep_read_context(ta_ctx, &msg_offset,
1787 spin_lock_irq(&queue_lock);
1789 &ta_ctx->
sep_used->current_hash_req->base);
1790 spin_unlock_irq(&queue_lock);
1792 if ((u32_error != 0) && (u32_error != -
EINPROGRESS)) {
1794 "spe cypher post op cant queue\n");
1795 sep_crypto_release(sctx, ta_ctx, u32_error);
1800 u32_error = sep_submit_work(ta_ctx->
sep_used->workqueue,
1801 sep_dequeuer, (
void *)&sep_queue);
1805 "cant submit work sep_crypto_block\n");
1806 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
1813 sep_crypto_release(sctx, ta_ctx, 0);
1826 "hash final post op\n");
1838 sep_crypto_release(sctx, ta_ctx, u32_error);
1846 "hash finish null buffer\n");
1847 sep_crypto_release(sctx, ta_ctx, (
u32)-
ENOMEM);
1852 sizeof(
u32)) *
sizeof(
u32);
1854 sep_read_msg(ta_ctx,
1856 crypto_ahash_digestsize(tfm), max_length,
1861 sep_crypto_release(sctx, ta_ctx, 0);
1874 "hash digest post op\n");
1885 "hash digest finish error %x\n", u32_error);
1887 sep_crypto_release(sctx, ta_ctx, u32_error);
1895 "hash digest finish null buffer\n");
1896 sep_crypto_release(sctx, ta_ctx, (
u32)-
ENOMEM);
1901 sizeof(
u32)) *
sizeof(
u32);
1903 sep_read_msg(ta_ctx,
1905 crypto_ahash_digestsize(tfm), max_length,
1910 "hash digest finish post op done\n");
1912 sep_crypto_release(sctx, ta_ctx, 0);
1921 static void sep_finish(
unsigned long data)
1929 pr_debug(
"sep_finish called with null data\n");
1934 if (sep_dev ==
NULL) {
1935 pr_debug(
"sep_finish; sep_dev is NULL\n");
1941 "sep_finish; not in kernel operation\n");
1947 &sep_dev->
ta_ctx->call_status.status)) {
1949 dev_warn(&sep_dev->
pdev->dev,
"[PID%d] sendmsg not called\n",
1956 "[PID%d] poll; no message came back\n",
1962 if ((res != 0x0) && (res != 0x8)) {
1964 "[PID%d] poll; poll error GPR3 is %x\n",
1972 dev_dbg(&sep_dev->
pdev->dev,
"[PID%d] GPR2 at crypto finish is %x\n",
1976 if ((res >> 30) & 0x1) {
1977 dev_dbg(&sep_dev->
pdev->dev,
"[PID%d] sep print req\n",
1979 dev_dbg(&sep_dev->
pdev->dev,
"[PID%d] contents: %s\n",
1989 "[PID%d] sep request; ignoring\n",
1997 "[PID%d] sep reply to command; processing request: %x\n",
2005 res = crypto_post_op(sep_dev);
2013 res = hash_init_post_op(sep_dev);
2017 res = hash_update_post_op(sep_dev);
2021 res = hash_final_post_op(sep_dev);
2024 res = hash_digest_post_op(sep_dev);
2027 pr_debug(
"sep - invalid stage for hash finish\n");
2031 pr_debug(
"sep - invalid request for finish\n");
2035 pr_debug(
"sep - finish returned error %x\n", res);
2038 static int sep_hash_cra_init(
struct crypto_tfm *tfm)
2040 const char *alg_name = crypto_tfm_alg_name(tfm);
2042 pr_debug(
"sep_hash_cra_init name is %s\n", alg_name);
2044 crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
2049 static void sep_hash_cra_exit(
struct crypto_tfm *tfm)
2054 static void sep_hash_init(
void *data)
2063 int are_we_done_yet;
2066 tfm = crypto_ahash_reqtfm(req);
2067 sctx = crypto_ahash_ctx(tfm);
2068 ta_ctx = ahash_request_ctx(req);
2079 sizeof(
u32),
sizeof(
u32), &msg_offset, 0);
2080 sep_end_msg(ta_ctx, msg_offset);
2082 are_we_done_yet = 0;
2083 result = sep_crypto_take_sep(ta_ctx);
2086 "sep_hash_init take sep failed\n");
2087 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2092 while ((
time_before(jiffies, end_time)) && (are_we_done_yet == 0))
2096 if (are_we_done_yet == 0) {
2098 "hash init never got done\n");
2099 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2105 static void sep_hash_update(
void *data)
2114 int are_we_done_yet;
2117 static char small_buf[100];
2128 tfm = crypto_ahash_reqtfm(req);
2129 sctx = crypto_ahash_ctx(tfm);
2130 ta_ctx = ahash_request_ctx(req);
2139 "sep_hash_update\n");
2143 block_size = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
2146 dev_dbg(&ta_ctx->
sep_used->pdev->dev,
"block_size is %x\n", block_size);
2151 hash_private_ctx.internal_context;
2153 tail_len = (req->
nbytes - head_len) % block_size;
2156 int_error = sep_oddball_pages(ta_ctx->
sep_used, req->
src,
2158 block_size, &new_sg, 1);
2160 if (int_error < 0) {
2162 "oddball pages error in crash update\n");
2163 sep_crypto_release(sctx, ta_ctx, -
ENOMEM);
2165 }
else if (int_error == 1) {
2173 src_ptr = sg_virt(ta_ctx->
src_sg);
2182 req->
nbytes - (head_len + tail_len);
2199 "hash update dma table create failed\n");
2200 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2211 sep_write_msg(ta_ctx, msg,
sizeof(
u32) * 3,
sizeof(
u32) * 3,
2217 sep_write_msg(ta_ctx, &head_len,
sizeof(
u32),
2218 sizeof(
u32), &msg_offset, 0);
2223 sep_sg_nents(ta_ctx->
src_sg),
2224 small_buf, head_len);
2226 if (copy_result != head_len) {
2228 "sg head copy failure in hash block\n");
2229 sep_crypto_release(sctx, ta_ctx, -
ENOMEM);
2233 sep_write_msg(ta_ctx, small_buf, head_len,
2234 sizeof(
u32) * 32, &msg_offset, 1);
2236 msg_offset +=
sizeof(
u32) * 32;
2240 sep_write_msg(ta_ctx, &tail_len,
sizeof(
u32),
2241 sizeof(
u32), &msg_offset, 0);
2244 copy_result = sep_copy_offset_sg(
2248 small_buf, tail_len);
2250 if (copy_result != tail_len) {
2252 "sg tail copy failure in hash block\n");
2253 sep_crypto_release(sctx, ta_ctx, -
ENOMEM);
2257 sep_write_msg(ta_ctx, small_buf, tail_len,
2258 sizeof(
u32) * 32, &msg_offset, 1);
2260 msg_offset +=
sizeof(
u32) * 32;
2267 sep_end_msg(ta_ctx, msg_offset);
2268 are_we_done_yet = 0;
2269 int_error = sep_crypto_take_sep(ta_ctx);
2272 "sep_hash_update take sep failed\n");
2273 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2278 while ((
time_before(jiffies, end_time)) && (are_we_done_yet == 0))
2282 if (are_we_done_yet == 0) {
2284 "hash update never got done\n");
2285 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2291 static void sep_hash_final(
void *data)
2300 int are_we_done_yet;
2303 tfm = crypto_ahash_reqtfm(req);
2304 sctx = crypto_ahash_ctx(tfm);
2305 ta_ctx = ahash_request_ctx(req);
2309 "sep_hash_final\n");
2321 sep_end_msg(ta_ctx, msg_offset);
2322 are_we_done_yet = 0;
2323 result = sep_crypto_take_sep(ta_ctx);
2326 "sep_hash_final take sep failed\n");
2327 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2332 while ((
time_before(jiffies, end_time)) && (are_we_done_yet == 0))
2336 if (are_we_done_yet == 0) {
2338 "hash final job never got done\n");
2339 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2345 static void sep_hash_digest(
void *data)
2353 int are_we_done_yet;
2355 static char small_buf[100];
2366 tfm = crypto_ahash_reqtfm(req);
2367 sctx = crypto_ahash_ctx(tfm);
2368 ta_ctx = ahash_request_ctx(req);
2372 "sep_hash_digest\n");
2380 block_size = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
2383 dev_dbg(&ta_ctx->
sep_used->pdev->dev,
"block_size is %x\n", block_size);
2387 int_error = sep_oddball_pages(ta_ctx->
sep_used, req->
src,
2389 block_size, &new_sg, 1);
2391 if (int_error < 0) {
2393 "oddball pages error in crash update\n");
2394 sep_crypto_release(sctx, ta_ctx, -
ENOMEM);
2396 }
else if (int_error == 1) {
2404 src_ptr = sg_virt(ta_ctx->
src_sg);
2429 "hash update dma table create failed\n");
2430 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2437 sizeof(
u32),
sizeof(
u32), &msg_offset, 0);
2443 sep_write_msg(ta_ctx, msg,
sizeof(
u32) * 3,
sizeof(
u32) * 3,
2447 sep_write_msg(ta_ctx, &tail_len,
sizeof(
u32),
2448 sizeof(
u32), &msg_offset, 0);
2451 copy_result = sep_copy_offset_sg(
2455 small_buf, tail_len);
2457 if (copy_result != tail_len) {
2459 "sg tail copy failure in hash block\n");
2460 sep_crypto_release(sctx, ta_ctx, -
ENOMEM);
2464 sep_write_msg(ta_ctx, small_buf, tail_len,
2465 sizeof(
u32) * 32, &msg_offset, 1);
2467 msg_offset +=
sizeof(
u32) * 32;
2470 sep_end_msg(ta_ctx, msg_offset);
2472 are_we_done_yet = 0;
2473 result = sep_crypto_take_sep(ta_ctx);
2476 "sep_hash_digest take sep failed\n");
2477 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2482 while ((
time_before(jiffies, end_time)) && (are_we_done_yet == 0))
2486 if (are_we_done_yet == 0) {
2488 "hash digest job never got done\n");
2489 sep_crypto_release(sctx, ta_ctx, -
EINVAL);
2501 static void sep_dequeuer(
void *data)
2515 spin_lock_irq(&queue_lock);
2516 backlog = crypto_get_backlog(this_queue);
2518 spin_unlock_irq(&queue_lock);
2521 pr_debug(
"sep crypto queue is empty\n");
2526 pr_debug(
"sep crypto backlog set\n");
2532 if (!async_req->
tfm) {
2533 pr_debug(
"sep crypto queue null tfm\n");
2537 if (!async_req->
tfm->__crt_alg) {
2538 pr_debug(
"sep crypto queue null __crt_alg\n");
2542 if (!async_req->
tfm->__crt_alg->cra_type) {
2543 pr_debug(
"sep crypto queue null cra_type\n");
2548 if (async_req->
tfm->__crt_alg->cra_type !=
2551 pr_debug(
"sep crypto queue doing cipher\n");
2556 pr_debug(
"sep crypto queue null cypher_req\n");
2560 sep_crypto_block((
void *)cypher_req);
2564 pr_debug(
"sep crypto queue doing hash\n");
2569 hash_req = ahash_request_cast(async_req);
2571 pr_debug(
"sep crypto queue null hash_req\n");
2575 hash_tfm = crypto_ahash_reqtfm(hash_req);
2577 pr_debug(
"sep crypto queue null hash_tfm\n");
2582 sctx = crypto_ahash_ctx(hash_tfm);
2584 pr_debug(
"sep crypto queue null sctx\n");
2588 ta_ctx = ahash_request_ctx(hash_req);
2591 pr_debug(
"sep crypto queue hash init\n");
2592 sep_hash_init((
void *)hash_req);
2595 pr_debug(
"sep crypto queue hash update\n");
2596 sep_hash_update((
void *)hash_req);
2599 pr_debug(
"sep crypto queue hash final\n");
2600 sep_hash_final((
void *)hash_req);
2603 pr_debug(
"sep crypto queue hash digest\n");
2604 sep_hash_digest((
void *)hash_req);
2607 pr_debug(
"sep crypto queue hash digest\n");
2608 sep_hash_update((
void *)hash_req);
2611 pr_debug(
"sep crypto queue hash digest\n");
2612 sep_hash_final((
void *)hash_req);
2615 pr_debug(
"sep crypto queue hash oops nothing\n");
2627 pr_debug(
"sep - doing sha1 init\n");
2640 spin_lock_irq(&queue_lock);
2644 pr_debug(
" sep - crypto enqueue failed: %x\n",
2646 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2647 sep_dequeuer, (
void *)&sep_queue);
2649 pr_debug(
" sep - workqueue submit failed: %x\n",
2651 spin_unlock_irq(&queue_lock);
2662 pr_debug(
"sep - doing sha1 update\n");
2672 spin_lock_irq(&queue_lock);
2676 pr_debug(
" sep - crypto enqueue failed: %x\n",
2678 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2679 sep_dequeuer, (
void *)&sep_queue);
2681 pr_debug(
" sep - workqueue submit failed: %x\n",
2683 spin_unlock_irq(&queue_lock);
2693 pr_debug(
"sep - doing sha1 final\n");
2703 spin_lock_irq(&queue_lock);
2707 pr_debug(
" sep - crypto enqueue failed: %x\n",
2709 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2710 sep_dequeuer, (
void *)&sep_queue);
2712 pr_debug(
" sep - workqueue submit failed: %x\n",
2714 spin_unlock_irq(&queue_lock);
2724 pr_debug(
"sep - doing sha1 digest\n");
2737 spin_lock_irq(&queue_lock);
2741 pr_debug(
" sep - crypto enqueue failed: %x\n",
2743 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2744 sep_dequeuer, (
void *)&sep_queue);
2746 pr_debug(
" sep - workqueue submit failed: %x\n",
2748 spin_unlock_irq(&queue_lock);
2758 pr_debug(
"sep - doing sha1 finup\n");
2768 spin_lock_irq(&queue_lock);
2772 pr_debug(
" sep - crypto enqueue failed: %x\n",
2774 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2775 sep_dequeuer, (
void *)&sep_queue);
2777 pr_debug(
" sep - workqueue submit failed: %x\n",
2779 spin_unlock_irq(&queue_lock);
2789 pr_debug(
"sep - doing md5 init\n");
2802 spin_lock_irq(&queue_lock);
2806 pr_debug(
" sep - crypto enqueue failed: %x\n",
2808 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2809 sep_dequeuer, (
void *)&sep_queue);
2811 pr_debug(
" sep - workqueue submit failed: %x\n",
2813 spin_unlock_irq(&queue_lock);
2823 pr_debug(
"sep - doing md5 update\n");
2833 spin_lock_irq(&queue_lock);
2837 pr_debug(
" sep - crypto enqueue failed: %x\n",
2839 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2840 sep_dequeuer, (
void *)&sep_queue);
2842 pr_debug(
" sep - workqueue submit failed: %x\n",
2844 spin_unlock_irq(&queue_lock);
2854 pr_debug(
"sep - doing md5 final\n");
2864 spin_lock_irq(&queue_lock);
2868 pr_debug(
" sep - crypto enqueue failed: %x\n",
2870 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2871 sep_dequeuer, (
void *)&sep_queue);
2873 pr_debug(
" sep - workqueue submit failed: %x\n",
2875 spin_unlock_irq(&queue_lock);
2886 pr_debug(
"sep - doing md5 digest\n");
2899 spin_lock_irq(&queue_lock);
2903 pr_debug(
" sep - crypto enqueue failed: %x\n",
2905 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2906 sep_dequeuer, (
void *)&sep_queue);
2908 pr_debug(
" sep - workqueue submit failed: %x\n",
2910 spin_unlock_irq(&queue_lock);
2921 pr_debug(
"sep - doing md5 finup\n");
2931 spin_lock_irq(&queue_lock);
2935 pr_debug(
" sep - crypto enqueue failed: %x\n",
2937 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2938 sep_dequeuer, (
void *)&sep_queue);
2940 pr_debug(
" sep - workqueue submit failed: %x\n",
2942 spin_unlock_irq(&queue_lock);
2952 pr_debug(
"sep - doing sha224 init\n");
2965 spin_lock_irq(&queue_lock);
2969 pr_debug(
" sep - crypto enqueue failed: %x\n",
2971 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
2972 sep_dequeuer, (
void *)&sep_queue);
2974 pr_debug(
" sep - workqueue submit failed: %x\n",
2976 spin_unlock_irq(&queue_lock);
2986 pr_debug(
"sep - doing sha224 update\n");
2996 spin_lock_irq(&queue_lock);
3000 pr_debug(
" sep - crypto enqueue failed: %x\n",
3002 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3003 sep_dequeuer, (
void *)&sep_queue);
3005 pr_debug(
" sep - workqueue submit failed: %x\n",
3007 spin_unlock_irq(&queue_lock);
3017 pr_debug(
"sep - doing sha224 final\n");
3027 spin_lock_irq(&queue_lock);
3031 pr_debug(
" sep - crypto enqueue failed: %x\n",
3033 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3034 sep_dequeuer, (
void *)&sep_queue);
3036 pr_debug(
" sep - workqueue submit failed: %x\n",
3038 spin_unlock_irq(&queue_lock);
3049 pr_debug(
"sep - doing sha224 digest\n");
3062 spin_lock_irq(&queue_lock);
3066 pr_debug(
" sep - crypto enqueue failed: %x\n",
3068 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3069 sep_dequeuer, (
void *)&sep_queue);
3071 pr_debug(
" sep - workqueue submit failed: %x\n",
3073 spin_unlock_irq(&queue_lock);
3084 pr_debug(
"sep - doing sha224 finup\n");
3094 spin_lock_irq(&queue_lock);
3098 pr_debug(
" sep - crypto enqueue failed: %x\n",
3100 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3101 sep_dequeuer, (
void *)&sep_queue);
3103 pr_debug(
" sep - workqueue submit failed: %x\n",
3105 spin_unlock_irq(&queue_lock);
3115 pr_debug(
"sep - doing sha256 init\n");
3128 spin_lock_irq(&queue_lock);
3132 pr_debug(
" sep - crypto enqueue failed: %x\n",
3134 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3135 sep_dequeuer, (
void *)&sep_queue);
3137 pr_debug(
" sep - workqueue submit failed: %x\n",
3139 spin_unlock_irq(&queue_lock);
3149 pr_debug(
"sep - doing sha256 update\n");
3159 spin_lock_irq(&queue_lock);
3163 pr_debug(
" sep - crypto enqueue failed: %x\n",
3165 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3166 sep_dequeuer, (
void *)&sep_queue);
3168 pr_debug(
" sep - workqueue submit failed: %x\n",
3170 spin_unlock_irq(&queue_lock);
3180 pr_debug(
"sep - doing sha256 final\n");
3190 spin_lock_irq(&queue_lock);
3194 pr_debug(
" sep - crypto enqueue failed: %x\n",
3196 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3197 sep_dequeuer, (
void *)&sep_queue);
3199 pr_debug(
" sep - workqueue submit failed: %x\n",
3201 spin_unlock_irq(&queue_lock);
3212 pr_debug(
"sep - doing sha256 digest\n");
3225 spin_lock_irq(&queue_lock);
3229 pr_debug(
" sep - crypto enqueue failed: %x\n",
3231 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3232 sep_dequeuer, (
void *)&sep_queue);
3234 pr_debug(
" sep - workqueue submit failed: %x\n",
3236 spin_unlock_irq(&queue_lock);
3247 pr_debug(
"sep - doing sha256 finup\n");
3257 spin_lock_irq(&queue_lock);
3261 pr_debug(
" sep - crypto enqueue failed: %x\n",
3263 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3264 sep_dequeuer, (
void *)&sep_queue);
3266 pr_debug(
" sep - workqueue submit failed: %x\n",
3268 spin_unlock_irq(&queue_lock);
3273 static int sep_crypto_init(
struct crypto_tfm *tfm)
3275 const char *alg_name = crypto_tfm_alg_name(tfm);
3277 if (alg_name ==
NULL)
3278 pr_debug(
"sep_crypto_init alg is NULL\n");
3280 pr_debug(
"sep_crypto_init alg is %s\n", alg_name);
3286 static void sep_crypto_exit(
struct crypto_tfm *tfm)
3292 unsigned int keylen)
3298 pr_debug(
"tfm is %p sctx is %p\n", tfm, sctx);
3313 pr_debug(
"invalid sep aes key size %x\n",
3334 pr_debug(
"sep - doing aes ecb encrypt\n");
3349 spin_lock_irq(&queue_lock);
3353 pr_debug(
" sep - crypto enqueue failed: %x\n",
3355 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3356 sep_dequeuer, (
void *)&sep_queue);
3358 pr_debug(
" sep - workqueue submit failed: %x\n",
3360 spin_unlock_irq(&queue_lock);
3371 pr_debug(
"sep - doing aes ecb decrypt\n");
3386 spin_lock_irq(&queue_lock);
3390 pr_debug(
" sep - crypto enqueue failed: %x\n",
3392 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3393 sep_dequeuer, (
void *)&sep_queue);
3395 pr_debug(
" sep - workqueue submit failed: %x\n",
3397 spin_unlock_irq(&queue_lock);
3408 crypto_ablkcipher_reqtfm(req));
3410 pr_debug(
"sep - doing aes cbc encrypt\n");
3415 pr_debug(
"tfm is %p sctx is %p and ta_ctx is %p\n",
3416 crypto_ablkcipher_reqtfm(req), sctx, ta_ctx);
3428 spin_lock_irq(&queue_lock);
3432 pr_debug(
" sep - crypto enqueue failed: %x\n",
3434 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3435 sep_dequeuer, (
void *)&sep_queue);
3437 pr_debug(
" sep - workqueue submit failed: %x\n",
3439 spin_unlock_irq(&queue_lock);
3450 crypto_ablkcipher_reqtfm(req));
3452 pr_debug(
"sep - doing aes cbc decrypt\n");
3454 pr_debug(
"tfm is %p sctx is %p and ta_ctx is %p\n",
3455 crypto_ablkcipher_reqtfm(req), sctx, ta_ctx);
3470 spin_lock_irq(&queue_lock);
3474 pr_debug(
" sep - crypto enqueue failed: %x\n",
3476 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3477 sep_dequeuer, (
void *)&sep_queue);
3479 pr_debug(
" sep - workqueue submit failed: %x\n",
3481 spin_unlock_irq(&queue_lock);
3487 unsigned int keylen)
3490 struct crypto_tfm *ctfm = crypto_ablkcipher_tfm(tfm);
3512 (sep_weak_key(key, keylen))) {
3534 pr_debug(
"sep - doing des ecb encrypt\n");
3549 spin_lock_irq(&queue_lock);
3553 pr_debug(
" sep - crypto enqueue failed: %x\n",
3555 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3556 sep_dequeuer, (
void *)&sep_queue);
3558 pr_debug(
" sep - workqueue submit failed: %x\n",
3560 spin_unlock_irq(&queue_lock);
3571 pr_debug(
"sep - doing des ecb decrypt\n");
3586 spin_lock_irq(&queue_lock);
3590 pr_debug(
" sep - crypto enqueue failed: %x\n",
3592 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3593 sep_dequeuer, (
void *)&sep_queue);
3595 pr_debug(
" sep - workqueue submit failed: %x\n",
3597 spin_unlock_irq(&queue_lock);
3608 pr_debug(
"sep - doing des cbc encrypt\n");
3623 spin_lock_irq(&queue_lock);
3627 pr_debug(
" sep - crypto enqueue failed: %x\n",
3629 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3630 sep_dequeuer, (
void *)&sep_queue);
3632 pr_debug(
" sep - workqueue submit failed: %x\n",
3634 spin_unlock_irq(&queue_lock);
3645 pr_debug(
"sep - doing des ecb decrypt\n");
3660 spin_lock_irq(&queue_lock);
3664 pr_debug(
" sep - crypto enqueue failed: %x\n",
3666 error1 = sep_submit_work(ta_ctx->
sep_used->workqueue,
3667 sep_dequeuer, (
void *)&sep_queue);
3669 pr_debug(
" sep - workqueue submit failed: %x\n",
3671 spin_unlock_irq(&queue_lock);
3678 .
init = sep_sha1_init,
3679 .update = sep_sha1_update,
3680 .final = sep_sha1_final,
3681 .digest = sep_sha1_digest,
3682 .finup = sep_sha1_finup,
3687 .cra_driver_name =
"sha1-sep",
3688 .cra_priority = 100,
3695 .cra_init = sep_hash_cra_init,
3696 .cra_exit = sep_hash_cra_exit,
3701 .init = sep_md5_init,
3702 .update = sep_md5_update,
3703 .final = sep_md5_final,
3704 .digest = sep_md5_digest,
3705 .finup = sep_md5_finup,
3710 .cra_driver_name =
"md5-sep",
3711 .cra_priority = 100,
3718 .cra_init = sep_hash_cra_init,
3719 .cra_exit = sep_hash_cra_exit,
3724 .init = sep_sha224_init,
3725 .update = sep_sha224_update,
3726 .final = sep_sha224_final,
3727 .digest = sep_sha224_digest,
3728 .finup = sep_sha224_finup,
3732 .cra_name =
"sha224",
3733 .cra_driver_name =
"sha224-sep",
3734 .cra_priority = 100,
3741 .cra_init = sep_hash_cra_init,
3742 .cra_exit = sep_hash_cra_exit,
3747 .init = sep_sha256_init,
3748 .update = sep_sha256_update,
3749 .final = sep_sha256_final,
3750 .digest = sep_sha256_digest,
3751 .finup = sep_sha256_finup,
3755 .cra_name =
"sha256",
3756 .cra_driver_name =
"sha256-sep",
3757 .cra_priority = 100,
3764 .cra_init = sep_hash_cra_init,
3765 .cra_exit = sep_hash_cra_exit,
3774 .cra_driver_name =
"ecb-aes-sep",
3775 .cra_priority = 100,
3782 .cra_init = sep_crypto_init,
3783 .cra_exit = sep_crypto_exit,
3784 .cra_u.ablkcipher = {
3787 .setkey = sep_aes_setkey,
3788 .encrypt = sep_aes_ecb_encrypt,
3789 .decrypt = sep_aes_ecb_decrypt,
3793 .cra_name =
"cbc(aes)",
3794 .cra_driver_name =
"cbc-aes-sep",
3795 .cra_priority = 100,
3802 .cra_init = sep_crypto_init,
3803 .cra_exit = sep_crypto_exit,
3804 .cra_u.ablkcipher = {
3807 .setkey = sep_aes_setkey,
3808 .encrypt = sep_aes_cbc_encrypt,
3810 .decrypt = sep_aes_cbc_decrypt,
3814 .cra_name =
"ebc(des)",
3815 .cra_driver_name =
"ebc-des-sep",
3816 .cra_priority = 100,
3823 .cra_init = sep_crypto_init,
3824 .cra_exit = sep_crypto_exit,
3825 .cra_u.ablkcipher = {
3828 .setkey = sep_des_setkey,
3829 .encrypt = sep_des_ebc_encrypt,
3830 .decrypt = sep_des_ebc_decrypt,
3834 .cra_name =
"cbc(des)",
3835 .cra_driver_name =
"cbc-des-sep",
3836 .cra_priority = 100,
3843 .cra_init = sep_crypto_init,
3844 .cra_exit = sep_crypto_exit,
3845 .cra_u.ablkcipher = {
3848 .setkey = sep_des_setkey,
3849 .encrypt = sep_des_cbc_encrypt,
3851 .decrypt = sep_des_cbc_decrypt,
3855 .cra_name =
"ebc(des3-ede)",
3856 .cra_driver_name =
"ebc-des3-ede-sep",
3857 .cra_priority = 100,
3864 .cra_init = sep_crypto_init,
3865 .cra_exit = sep_crypto_exit,
3866 .cra_u.ablkcipher = {
3869 .setkey = sep_des_setkey,
3870 .encrypt = sep_des_ebc_encrypt,
3871 .decrypt = sep_des_ebc_decrypt,
3875 .cra_name =
"cbc(des3-ede)",
3876 .cra_driver_name =
"cbc-des3--ede-sep",
3877 .cra_priority = 100,
3884 .cra_init = sep_crypto_init,
3885 .cra_exit = sep_crypto_exit,
3886 .cra_u.ablkcipher = {
3889 .setkey = sep_des_setkey,
3890 .encrypt = sep_des_cbc_encrypt,
3891 .decrypt = sep_des_cbc_decrypt,
3900 (
unsigned long)sep_dev);
3905 "sep_crypto_workqueue");
3907 dev_warn(&sep_dev->
pdev->dev,
"cant create workqueue\n");
3918 for (i = 0; i <
ARRAY_SIZE(hash_algs); i++) {
3925 for (j = 0; j <
ARRAY_SIZE(crypto_algs); j++) {
3928 goto err_crypto_algs;
3934 for (k = 0; k <
i; k++)
3939 for (k = 0; k <
j; k++)
3951 for (i = 0; i <
ARRAY_SIZE(crypto_algs); i++)