Lines Matching refs:aes
478 struct ccp_aes_engine *aes = &cmd->u.aes;
485 if (!((aes->key_len == AES_KEYSIZE_128) ||
486 (aes->key_len == AES_KEYSIZE_192) ||
487 (aes->key_len == AES_KEYSIZE_256)))
490 if (aes->src_len & (AES_BLOCK_SIZE - 1))
493 if (aes->iv_len != AES_BLOCK_SIZE)
496 if (!aes->key || !aes->iv || !aes->src)
499 if (aes->cmac_final) {
500 if (aes->cmac_key_len != AES_BLOCK_SIZE)
503 if (!aes->cmac_key)
517 op.u.aes.type = aes->type;
518 op.u.aes.mode = aes->mode;
519 op.u.aes.action = aes->action;
532 dm_offset = CCP_SB_BYTES - aes->key_len;
533 ret = ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len);
554 ret = ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
565 ret = ccp_init_data(&src, cmd_q, aes->src, aes->src_len,
572 if (aes->cmac_final && !src.sg_wa.bytes_left) {
584 ret = ccp_set_dm_area(&ctx, 0, aes->cmac_key, 0,
585 aes->cmac_key_len);
596 ret = cmd_q->ccp->vdata->perform->aes(&op);
617 ccp_get_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
634 struct ccp_aes_engine *aes = &cmd->u.aes;
652 if (!aes->iv)
655 if (!((aes->key_len == AES_KEYSIZE_128) ||
656 (aes->key_len == AES_KEYSIZE_192) ||
657 (aes->key_len == AES_KEYSIZE_256)))
660 if (!aes->key) /* Gotta have a key SGL */
664 authsize = aes->authsize ? aes->authsize : AES_BLOCK_SIZE;
684 p_aad = aes->src;
685 p_inp = scatterwalk_ffwd(sg_inp, aes->src, aes->aad_len);
686 p_outp = scatterwalk_ffwd(sg_outp, aes->dst, aes->aad_len);
687 if (aes->action == CCP_AES_ACTION_ENCRYPT) {
688 ilen = aes->src_len;
692 ilen = aes->src_len - authsize;
704 op.u.aes.type = aes->type;
713 dm_offset = CCP_SB_BYTES - aes->key_len;
714 ret = ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len);
734 dm_offset = CCP_AES_CTX_SB_COUNT * CCP_SB_BYTES - aes->iv_len;
735 ret = ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
747 if (aes->aad_len > 0) {
749 ret = ccp_init_data(&aad, cmd_q, p_aad, aes->aad_len,
755 op.u.aes.mode = CCP_AES_MODE_GHASH;
756 op.u.aes.action = CCP_AES_GHASHAAD;
761 ret = cmd_q->ccp->vdata->perform->aes(&op);
772 op.u.aes.mode = CCP_AES_MODE_GCTR;
773 op.u.aes.action = aes->action;
805 op.u.aes.size = (nbytes * 8) - 1;
809 ret = cmd_q->ccp->vdata->perform->aes(&op);
828 ret = ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
847 final[0] = cpu_to_be64(aes->aad_len * 8);
856 op.u.aes.type = aes->type;
857 op.u.aes.mode = CCP_AES_MODE_GHASH;
858 op.u.aes.action = CCP_AES_GHASHFINAL;
866 op.u.aes.size = 0;
867 ret = cmd_q->ccp->vdata->perform->aes(&op);
871 if (aes->action == CCP_AES_ACTION_ENCRYPT) {
903 if (aes->aad_len)
918 struct ccp_aes_engine *aes = &cmd->u.aes;
926 if (!((aes->key_len == AES_KEYSIZE_128) ||
927 (aes->key_len == AES_KEYSIZE_192) ||
928 (aes->key_len == AES_KEYSIZE_256)))
931 if (((aes->mode == CCP_AES_MODE_ECB) ||
932 (aes->mode == CCP_AES_MODE_CBC)) &&
933 (aes->src_len & (AES_BLOCK_SIZE - 1)))
936 if (!aes->key || !aes->src || !aes->dst)
939 if (aes->mode != CCP_AES_MODE_ECB) {
940 if (aes->iv_len != AES_BLOCK_SIZE)
943 if (!aes->iv)
956 op.init = (aes->mode == CCP_AES_MODE_ECB) ? 0 : 1;
957 op.u.aes.type = aes->type;
958 op.u.aes.mode = aes->mode;
959 op.u.aes.action = aes->action;
972 dm_offset = CCP_SB_BYTES - aes->key_len;
973 ret = ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len);
993 if (aes->mode != CCP_AES_MODE_ECB) {
996 ret = ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
1006 switch (aes->mode) {
1009 op.u.aes.size = AES_BLOCK_SIZE * BITS_PER_BYTE - 1;
1012 op.u.aes.size = 0;
1019 if (sg_virt(aes->src) == sg_virt(aes->dst))
1022 ret = ccp_init_data(&src, cmd_q, aes->src, aes->src_len,
1031 ret = ccp_init_data(&dst, cmd_q, aes->dst, aes->src_len,
1047 if (aes->mode == CCP_AES_MODE_ECB)
1051 ret = cmd_q->ccp->vdata->perform->aes(&op);
1060 if (aes->mode != CCP_AES_MODE_ECB) {
1073 ccp_get_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
2478 switch (cmd->u.aes.mode) {