Lines Matching full:aes

479 	struct ccp_aes_engine *aes = &cmd->u.aes;  in ccp_run_aes_cmac_cmd()  local
486 if (!((aes->key_len == AES_KEYSIZE_128) || in ccp_run_aes_cmac_cmd()
487 (aes->key_len == AES_KEYSIZE_192) || in ccp_run_aes_cmac_cmd()
488 (aes->key_len == AES_KEYSIZE_256))) in ccp_run_aes_cmac_cmd()
491 if (aes->src_len & (AES_BLOCK_SIZE - 1)) in ccp_run_aes_cmac_cmd()
494 if (aes->iv_len != AES_BLOCK_SIZE) in ccp_run_aes_cmac_cmd()
497 if (!aes->key || !aes->iv || !aes->src) in ccp_run_aes_cmac_cmd()
500 if (aes->cmac_final) { in ccp_run_aes_cmac_cmd()
501 if (aes->cmac_key_len != AES_BLOCK_SIZE) in ccp_run_aes_cmac_cmd()
504 if (!aes->cmac_key) in ccp_run_aes_cmac_cmd()
518 op.u.aes.type = aes->type; in ccp_run_aes_cmac_cmd()
519 op.u.aes.mode = aes->mode; in ccp_run_aes_cmac_cmd()
520 op.u.aes.action = aes->action; in ccp_run_aes_cmac_cmd()
533 dm_offset = CCP_SB_BYTES - aes->key_len; in ccp_run_aes_cmac_cmd()
534 ret = ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len); in ccp_run_aes_cmac_cmd()
544 /* The AES context fits in a single (32-byte) SB entry and in ccp_run_aes_cmac_cmd()
555 ret = ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len); in ccp_run_aes_cmac_cmd()
565 /* Send data to the CCP AES engine */ in ccp_run_aes_cmac_cmd()
566 ret = ccp_init_data(&src, cmd_q, aes->src, aes->src_len, in ccp_run_aes_cmac_cmd()
573 if (aes->cmac_final && !src.sg_wa.bytes_left) { in ccp_run_aes_cmac_cmd()
585 ret = ccp_set_dm_area(&ctx, 0, aes->cmac_key, 0, in ccp_run_aes_cmac_cmd()
586 aes->cmac_key_len); in ccp_run_aes_cmac_cmd()
597 ret = cmd_q->ccp->vdata->perform->aes(&op); in ccp_run_aes_cmac_cmd()
606 /* Retrieve the AES context - convert from LE to BE using in ccp_run_aes_cmac_cmd()
618 ccp_get_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len); in ccp_run_aes_cmac_cmd()
635 struct ccp_aes_engine *aes = &cmd->u.aes; in ccp_run_aes_gcm_cmd() local
662 if (!aes->iv) in ccp_run_aes_gcm_cmd()
665 if (!((aes->key_len == AES_KEYSIZE_128) || in ccp_run_aes_gcm_cmd()
666 (aes->key_len == AES_KEYSIZE_192) || in ccp_run_aes_gcm_cmd()
667 (aes->key_len == AES_KEYSIZE_256))) in ccp_run_aes_gcm_cmd()
670 if (!aes->key) /* Gotta have a key SGL */ in ccp_run_aes_gcm_cmd()
674 authsize = aes->authsize ? aes->authsize : AES_BLOCK_SIZE; in ccp_run_aes_gcm_cmd()
694 p_aad = aes->src; in ccp_run_aes_gcm_cmd()
695 p_inp = scatterwalk_ffwd(sg_inp, aes->src, aes->aad_len); in ccp_run_aes_gcm_cmd()
696 p_outp = scatterwalk_ffwd(sg_outp, aes->dst, aes->aad_len); in ccp_run_aes_gcm_cmd()
697 if (aes->action == CCP_AES_ACTION_ENCRYPT) { in ccp_run_aes_gcm_cmd()
698 ilen = aes->src_len; in ccp_run_aes_gcm_cmd()
702 ilen = aes->src_len - authsize; in ccp_run_aes_gcm_cmd()
714 wa->op.u.aes.type = aes->type; in ccp_run_aes_gcm_cmd()
723 dm_offset = CCP_SB_BYTES - aes->key_len; in ccp_run_aes_gcm_cmd()
724 ret = ccp_set_dm_area(&wa->key, dm_offset, aes->key, 0, aes->key_len); in ccp_run_aes_gcm_cmd()
744 dm_offset = CCP_AES_CTX_SB_COUNT * CCP_SB_BYTES - aes->iv_len; in ccp_run_aes_gcm_cmd()
745 ret = ccp_set_dm_area(&wa->ctx, dm_offset, aes->iv, 0, aes->iv_len); in ccp_run_aes_gcm_cmd()
757 if (aes->aad_len > 0) { in ccp_run_aes_gcm_cmd()
759 ret = ccp_init_data(&wa->aad, cmd_q, p_aad, aes->aad_len, in ccp_run_aes_gcm_cmd()
765 wa->op.u.aes.mode = CCP_AES_MODE_GHASH; in ccp_run_aes_gcm_cmd()
766 wa->op.u.aes.action = CCP_AES_GHASHAAD; in ccp_run_aes_gcm_cmd()
771 ret = cmd_q->ccp->vdata->perform->aes(&wa->op); in ccp_run_aes_gcm_cmd()
782 wa->op.u.aes.mode = CCP_AES_MODE_GCTR; in ccp_run_aes_gcm_cmd()
783 wa->op.u.aes.action = aes->action; in ccp_run_aes_gcm_cmd()
815 wa->op.u.aes.size = (nbytes * 8) - 1; in ccp_run_aes_gcm_cmd()
819 ret = cmd_q->ccp->vdata->perform->aes(&wa->op); in ccp_run_aes_gcm_cmd()
838 ret = ccp_set_dm_area(&wa->ctx, dm_offset, aes->iv, 0, aes->iv_len); in ccp_run_aes_gcm_cmd()
857 final[0] = cpu_to_be64(aes->aad_len * 8); in ccp_run_aes_gcm_cmd()
866 wa->op.u.aes.type = aes->type; in ccp_run_aes_gcm_cmd()
867 wa->op.u.aes.mode = CCP_AES_MODE_GHASH; in ccp_run_aes_gcm_cmd()
868 wa->op.u.aes.action = CCP_AES_GHASHFINAL; in ccp_run_aes_gcm_cmd()
876 wa->op.u.aes.size = 0; in ccp_run_aes_gcm_cmd()
877 ret = cmd_q->ccp->vdata->perform->aes(&wa->op); in ccp_run_aes_gcm_cmd()
881 if (aes->action == CCP_AES_ACTION_ENCRYPT) { in ccp_run_aes_gcm_cmd()
913 if (aes->aad_len) in ccp_run_aes_gcm_cmd()
928 struct ccp_aes_engine *aes = &cmd->u.aes; in ccp_run_aes_cmd() local
936 if (!((aes->key_len == AES_KEYSIZE_128) || in ccp_run_aes_cmd()
937 (aes->key_len == AES_KEYSIZE_192) || in ccp_run_aes_cmd()
938 (aes->key_len == AES_KEYSIZE_256))) in ccp_run_aes_cmd()
941 if (((aes->mode == CCP_AES_MODE_ECB) || in ccp_run_aes_cmd()
942 (aes->mode == CCP_AES_MODE_CBC)) && in ccp_run_aes_cmd()
943 (aes->src_len & (AES_BLOCK_SIZE - 1))) in ccp_run_aes_cmd()
946 if (!aes->key || !aes->src || !aes->dst) in ccp_run_aes_cmd()
949 if (aes->mode != CCP_AES_MODE_ECB) { in ccp_run_aes_cmd()
950 if (aes->iv_len != AES_BLOCK_SIZE) in ccp_run_aes_cmd()
953 if (!aes->iv) in ccp_run_aes_cmd()
966 op.init = (aes->mode == CCP_AES_MODE_ECB) ? 0 : 1; in ccp_run_aes_cmd()
967 op.u.aes.type = aes->type; in ccp_run_aes_cmd()
968 op.u.aes.mode = aes->mode; in ccp_run_aes_cmd()
969 op.u.aes.action = aes->action; in ccp_run_aes_cmd()
982 dm_offset = CCP_SB_BYTES - aes->key_len; in ccp_run_aes_cmd()
983 ret = ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len); in ccp_run_aes_cmd()
993 /* The AES context fits in a single (32-byte) SB entry and in ccp_run_aes_cmd()
1003 if (aes->mode != CCP_AES_MODE_ECB) { in ccp_run_aes_cmd()
1004 /* Load the AES context - convert to LE */ in ccp_run_aes_cmd()
1006 ret = ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len); in ccp_run_aes_cmd()
1016 switch (aes->mode) { in ccp_run_aes_cmd()
1019 op.u.aes.size = AES_BLOCK_SIZE * BITS_PER_BYTE - 1; in ccp_run_aes_cmd()
1022 op.u.aes.size = 0; in ccp_run_aes_cmd()
1029 if (sg_virt(aes->src) == sg_virt(aes->dst)) in ccp_run_aes_cmd()
1032 ret = ccp_init_data(&src, cmd_q, aes->src, aes->src_len, in ccp_run_aes_cmd()
1041 ret = ccp_init_data(&dst, cmd_q, aes->dst, aes->src_len, in ccp_run_aes_cmd()
1047 /* Send data to the CCP AES engine */ in ccp_run_aes_cmd()
1053 /* Since we don't retrieve the AES context in ECB in ccp_run_aes_cmd()
1057 if (aes->mode == CCP_AES_MODE_ECB) in ccp_run_aes_cmd()
1061 ret = cmd_q->ccp->vdata->perform->aes(&op); in ccp_run_aes_cmd()
1070 if (aes->mode != CCP_AES_MODE_ECB) { in ccp_run_aes_cmd()
1071 /* Retrieve the AES context - convert from LE to BE using in ccp_run_aes_cmd()
1083 ccp_get_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len); in ccp_run_aes_cmd()
1215 /* The AES context fits in a single (32-byte) SB entry and in ccp_run_xts_aes_cmd()
1257 /* Send data to the CCP AES engine */ in ccp_run_xts_aes_cmd()
1272 /* Retrieve the AES context - convert from LE to BE using in ccp_run_xts_aes_cmd()
1356 * (like AES) must be in little endian format. Use the 256-bit byte in ccp_run_des3_cmd()
2487 switch (cmd->u.aes.mode) { in ccp_run_cmd()