Lines Matching refs:desc
251 static unsigned int xcbc_setkey(struct cc_hw_desc *desc, in xcbc_setkey() argument
255 hw_desc_init(&desc[0]); in xcbc_setkey()
260 set_din_type(&desc[0], DMA_DLLI, in xcbc_setkey()
263 set_cipher_mode(&desc[0], DRV_CIPHER_ECB); in xcbc_setkey()
264 set_cipher_config0(&desc[0], DRV_CRYPTO_DIRECTION_ENCRYPT); in xcbc_setkey()
265 set_key_size_aes(&desc[0], ctx->auth_keylen); in xcbc_setkey()
266 set_flow_mode(&desc[0], S_DIN_to_AES); in xcbc_setkey()
267 set_setup_mode(&desc[0], SETUP_LOAD_KEY0); in xcbc_setkey()
269 hw_desc_init(&desc[1]); in xcbc_setkey()
270 set_din_const(&desc[1], 0x01010101, CC_AES_128_BIT_KEY_SIZE); in xcbc_setkey()
271 set_flow_mode(&desc[1], DIN_AES_DOUT); in xcbc_setkey()
272 set_dout_dlli(&desc[1], ctx->auth_state.xcbc.xcbc_keys_dma_addr, in xcbc_setkey()
275 hw_desc_init(&desc[2]); in xcbc_setkey()
276 set_din_const(&desc[2], 0x02020202, CC_AES_128_BIT_KEY_SIZE); in xcbc_setkey()
277 set_flow_mode(&desc[2], DIN_AES_DOUT); in xcbc_setkey()
278 set_dout_dlli(&desc[2], (ctx->auth_state.xcbc.xcbc_keys_dma_addr in xcbc_setkey()
282 hw_desc_init(&desc[3]); in xcbc_setkey()
283 set_din_const(&desc[3], 0x03030303, CC_AES_128_BIT_KEY_SIZE); in xcbc_setkey()
284 set_flow_mode(&desc[3], DIN_AES_DOUT); in xcbc_setkey()
285 set_dout_dlli(&desc[3], (ctx->auth_state.xcbc.xcbc_keys_dma_addr in xcbc_setkey()
292 static unsigned int hmac_setkey(struct cc_hw_desc *desc, in hmac_setkey() argument
309 hw_desc_init(&desc[idx]); in hmac_setkey()
310 set_cipher_mode(&desc[idx], hash_mode); in hmac_setkey()
311 set_din_sram(&desc[idx], in hmac_setkey()
315 set_flow_mode(&desc[idx], S_DIN_to_HASH); in hmac_setkey()
316 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in hmac_setkey()
320 hw_desc_init(&desc[idx]); in hmac_setkey()
321 set_cipher_mode(&desc[idx], hash_mode); in hmac_setkey()
322 set_din_const(&desc[idx], 0, ctx->hash_len); in hmac_setkey()
323 set_flow_mode(&desc[idx], S_DIN_to_HASH); in hmac_setkey()
324 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in hmac_setkey()
328 hw_desc_init(&desc[idx]); in hmac_setkey()
329 set_xor_val(&desc[idx], hmac_pad_const[i]); in hmac_setkey()
330 set_cipher_mode(&desc[idx], hash_mode); in hmac_setkey()
331 set_flow_mode(&desc[idx], S_DIN_to_HASH); in hmac_setkey()
332 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in hmac_setkey()
336 hw_desc_init(&desc[idx]); in hmac_setkey()
337 set_din_type(&desc[idx], DMA_DLLI, in hmac_setkey()
340 set_cipher_mode(&desc[idx], hash_mode); in hmac_setkey()
341 set_xor_active(&desc[idx]); in hmac_setkey()
342 set_flow_mode(&desc[idx], DIN_HASH); in hmac_setkey()
346 hw_desc_init(&desc[idx]); in hmac_setkey()
347 set_cipher_mode(&desc[idx], hash_mode); in hmac_setkey()
348 set_dout_dlli(&desc[idx], in hmac_setkey()
351 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in hmac_setkey()
352 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in hmac_setkey()
353 set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); in hmac_setkey()
424 struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; in cc_get_plain_hmac_key() local
456 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
457 set_cipher_mode(&desc[idx], hashmode); in cc_get_plain_hmac_key()
460 set_din_sram(&desc[idx], larval_addr, digestsize); in cc_get_plain_hmac_key()
461 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_get_plain_hmac_key()
462 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_get_plain_hmac_key()
466 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
467 set_cipher_mode(&desc[idx], hashmode); in cc_get_plain_hmac_key()
468 set_din_const(&desc[idx], 0, ctx->hash_len); in cc_get_plain_hmac_key()
469 set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); in cc_get_plain_hmac_key()
470 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_get_plain_hmac_key()
471 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_get_plain_hmac_key()
474 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
475 set_din_type(&desc[idx], DMA_DLLI, in cc_get_plain_hmac_key()
477 set_flow_mode(&desc[idx], DIN_HASH); in cc_get_plain_hmac_key()
481 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
482 set_cipher_mode(&desc[idx], hashmode); in cc_get_plain_hmac_key()
483 set_dout_dlli(&desc[idx], padded_authkey_dma_addr, in cc_get_plain_hmac_key()
485 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_get_plain_hmac_key()
486 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in cc_get_plain_hmac_key()
487 set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); in cc_get_plain_hmac_key()
488 set_cipher_config0(&desc[idx], in cc_get_plain_hmac_key()
492 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
493 set_din_const(&desc[idx], 0, (blocksize - digestsize)); in cc_get_plain_hmac_key()
494 set_flow_mode(&desc[idx], BYPASS); in cc_get_plain_hmac_key()
495 set_dout_dlli(&desc[idx], (padded_authkey_dma_addr + in cc_get_plain_hmac_key()
500 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
501 set_din_type(&desc[idx], DMA_DLLI, key_dma_addr, in cc_get_plain_hmac_key()
503 set_flow_mode(&desc[idx], BYPASS); in cc_get_plain_hmac_key()
504 set_dout_dlli(&desc[idx], padded_authkey_dma_addr, in cc_get_plain_hmac_key()
509 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
510 set_din_const(&desc[idx], 0, in cc_get_plain_hmac_key()
512 set_flow_mode(&desc[idx], BYPASS); in cc_get_plain_hmac_key()
513 set_dout_dlli(&desc[idx], in cc_get_plain_hmac_key()
521 hw_desc_init(&desc[idx]); in cc_get_plain_hmac_key()
522 set_din_const(&desc[idx], 0, (blocksize - keylen)); in cc_get_plain_hmac_key()
523 set_flow_mode(&desc[idx], BYPASS); in cc_get_plain_hmac_key()
524 set_dout_dlli(&desc[idx], padded_authkey_dma_addr, in cc_get_plain_hmac_key()
529 rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, idx); in cc_get_plain_hmac_key()
546 struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; in cc_aead_setkey() local
612 seq_len = hmac_setkey(desc, ctx); in cc_aead_setkey()
615 seq_len = xcbc_setkey(desc, ctx); in cc_aead_setkey()
627 rc = cc_send_sync_request(ctx->drvdata, &cc_req, desc, seq_len); in cc_aead_setkey()
722 struct cc_hw_desc desc[], unsigned int *seq_size) in cc_set_assoc_desc() argument
734 hw_desc_init(&desc[idx]); in cc_set_assoc_desc()
735 set_din_type(&desc[idx], DMA_DLLI, sg_dma_address(areq->src), in cc_set_assoc_desc()
737 set_flow_mode(&desc[idx], flow_mode); in cc_set_assoc_desc()
740 set_din_not_last_indication(&desc[idx]); in cc_set_assoc_desc()
744 hw_desc_init(&desc[idx]); in cc_set_assoc_desc()
745 set_din_type(&desc[idx], DMA_MLLI, areq_ctx->assoc.sram_addr, in cc_set_assoc_desc()
747 set_flow_mode(&desc[idx], flow_mode); in cc_set_assoc_desc()
750 set_din_not_last_indication(&desc[idx]); in cc_set_assoc_desc()
762 struct cc_hw_desc desc[], in cc_proc_authen_desc() argument
783 hw_desc_init(&desc[idx]); in cc_proc_authen_desc()
784 set_din_type(&desc[idx], DMA_DLLI, in cc_proc_authen_desc()
787 set_flow_mode(&desc[idx], flow_mode); in cc_proc_authen_desc()
810 hw_desc_init(&desc[idx]); in cc_proc_authen_desc()
811 set_din_type(&desc[idx], DMA_MLLI, mlli_addr, mlli_nents, in cc_proc_authen_desc()
813 set_flow_mode(&desc[idx], flow_mode); in cc_proc_authen_desc()
826 struct cc_hw_desc desc[], in cc_proc_cipher_desc() argument
842 hw_desc_init(&desc[idx]); in cc_proc_cipher_desc()
843 set_din_type(&desc[idx], DMA_DLLI, in cc_proc_cipher_desc()
847 set_dout_dlli(&desc[idx], in cc_proc_cipher_desc()
851 set_flow_mode(&desc[idx], flow_mode); in cc_proc_cipher_desc()
855 hw_desc_init(&desc[idx]); in cc_proc_cipher_desc()
856 set_din_type(&desc[idx], DMA_MLLI, areq_ctx->src.sram_addr, in cc_proc_cipher_desc()
858 set_dout_mlli(&desc[idx], areq_ctx->dst.sram_addr, in cc_proc_cipher_desc()
860 set_flow_mode(&desc[idx], flow_mode); in cc_proc_cipher_desc()
871 struct cc_hw_desc desc[], in cc_proc_digest_desc() argument
884 hw_desc_init(&desc[idx]); in cc_proc_digest_desc()
885 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_proc_digest_desc()
886 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in cc_proc_digest_desc()
887 set_dout_dlli(&desc[idx], req_ctx->icv_dma_addr, ctx->authsize, in cc_proc_digest_desc()
889 set_queue_last_ind(ctx->drvdata, &desc[idx]); in cc_proc_digest_desc()
891 set_aes_not_hash_mode(&desc[idx]); in cc_proc_digest_desc()
892 set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); in cc_proc_digest_desc()
894 set_cipher_config0(&desc[idx], in cc_proc_digest_desc()
896 set_cipher_mode(&desc[idx], hash_mode); in cc_proc_digest_desc()
900 hw_desc_init(&desc[idx]); in cc_proc_digest_desc()
901 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in cc_proc_digest_desc()
902 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_proc_digest_desc()
903 set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr, in cc_proc_digest_desc()
905 set_queue_last_ind(ctx->drvdata, &desc[idx]); in cc_proc_digest_desc()
906 set_cipher_config0(&desc[idx], in cc_proc_digest_desc()
908 set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED); in cc_proc_digest_desc()
910 set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); in cc_proc_digest_desc()
911 set_aes_not_hash_mode(&desc[idx]); in cc_proc_digest_desc()
913 set_cipher_mode(&desc[idx], hash_mode); in cc_proc_digest_desc()
921 struct cc_hw_desc desc[], in cc_set_cipher_desc() argument
932 hw_desc_init(&desc[idx]); in cc_set_cipher_desc()
933 set_cipher_config0(&desc[idx], direct); in cc_set_cipher_desc()
934 set_flow_mode(&desc[idx], ctx->flow_mode); in cc_set_cipher_desc()
935 set_din_type(&desc[idx], DMA_DLLI, req_ctx->gen_ctx.iv_dma_addr, in cc_set_cipher_desc()
938 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in cc_set_cipher_desc()
940 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_set_cipher_desc()
941 set_cipher_mode(&desc[idx], ctx->cipher_mode); in cc_set_cipher_desc()
945 hw_desc_init(&desc[idx]); in cc_set_cipher_desc()
946 set_cipher_config0(&desc[idx], direct); in cc_set_cipher_desc()
947 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_cipher_desc()
948 set_flow_mode(&desc[idx], ctx->flow_mode); in cc_set_cipher_desc()
950 set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, in cc_set_cipher_desc()
953 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_set_cipher_desc()
955 set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, in cc_set_cipher_desc()
957 set_key_size_des(&desc[idx], ctx->enc_keylen); in cc_set_cipher_desc()
959 set_cipher_mode(&desc[idx], ctx->cipher_mode); in cc_set_cipher_desc()
965 static void cc_proc_cipher(struct aead_request *req, struct cc_hw_desc desc[], in cc_proc_cipher() argument
975 cc_set_cipher_desc(req, desc, &idx); in cc_proc_cipher()
976 cc_proc_cipher_desc(req, data_flow_mode, desc, &idx); in cc_proc_cipher()
979 hw_desc_init(&desc[idx]); in cc_proc_cipher()
980 set_din_no_dma(&desc[idx], 0, 0xfffff0); in cc_proc_cipher()
981 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_proc_cipher()
988 static void cc_set_hmac_desc(struct aead_request *req, struct cc_hw_desc desc[], in cc_set_hmac_desc() argument
1000 hw_desc_init(&desc[idx]); in cc_set_hmac_desc()
1001 set_cipher_mode(&desc[idx], hash_mode); in cc_set_hmac_desc()
1002 set_din_type(&desc[idx], DMA_DLLI, in cc_set_hmac_desc()
1005 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_hmac_desc()
1006 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_set_hmac_desc()
1010 hw_desc_init(&desc[idx]); in cc_set_hmac_desc()
1011 set_cipher_mode(&desc[idx], hash_mode); in cc_set_hmac_desc()
1012 set_din_sram(&desc[idx], cc_digest_len_addr(ctx->drvdata, hash_mode), in cc_set_hmac_desc()
1014 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_hmac_desc()
1015 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_hmac_desc()
1021 static void cc_set_xcbc_desc(struct aead_request *req, struct cc_hw_desc desc[], in cc_set_xcbc_desc() argument
1029 hw_desc_init(&desc[idx]); in cc_set_xcbc_desc()
1030 set_din_const(&desc[idx], 0, CC_AES_BLOCK_SIZE); in cc_set_xcbc_desc()
1031 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_set_xcbc_desc()
1032 set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); in cc_set_xcbc_desc()
1033 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_set_xcbc_desc()
1034 set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); in cc_set_xcbc_desc()
1035 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_xcbc_desc()
1036 set_aes_not_hash_mode(&desc[idx]); in cc_set_xcbc_desc()
1040 hw_desc_init(&desc[idx]); in cc_set_xcbc_desc()
1041 set_din_type(&desc[idx], DMA_DLLI, in cc_set_xcbc_desc()
1044 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_xcbc_desc()
1045 set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); in cc_set_xcbc_desc()
1046 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_set_xcbc_desc()
1047 set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); in cc_set_xcbc_desc()
1048 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_xcbc_desc()
1049 set_aes_not_hash_mode(&desc[idx]); in cc_set_xcbc_desc()
1053 hw_desc_init(&desc[idx]); in cc_set_xcbc_desc()
1054 set_din_type(&desc[idx], DMA_DLLI, in cc_set_xcbc_desc()
1057 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in cc_set_xcbc_desc()
1058 set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); in cc_set_xcbc_desc()
1059 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_set_xcbc_desc()
1060 set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); in cc_set_xcbc_desc()
1061 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_xcbc_desc()
1062 set_aes_not_hash_mode(&desc[idx]); in cc_set_xcbc_desc()
1066 hw_desc_init(&desc[idx]); in cc_set_xcbc_desc()
1067 set_din_type(&desc[idx], DMA_DLLI, in cc_set_xcbc_desc()
1070 set_setup_mode(&desc[idx], SETUP_LOAD_STATE2); in cc_set_xcbc_desc()
1071 set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC); in cc_set_xcbc_desc()
1072 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_set_xcbc_desc()
1073 set_key_size_aes(&desc[idx], CC_AES_128_BIT_KEY_SIZE); in cc_set_xcbc_desc()
1074 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_xcbc_desc()
1075 set_aes_not_hash_mode(&desc[idx]); in cc_set_xcbc_desc()
1082 struct cc_hw_desc desc[], in cc_proc_header_desc() argument
1090 cc_set_assoc_desc(req, DIN_HASH, desc, &idx); in cc_proc_header_desc()
1097 struct cc_hw_desc desc[], in cc_proc_scheme_desc() argument
1109 hw_desc_init(&desc[idx]); in cc_proc_scheme_desc()
1110 set_cipher_mode(&desc[idx], hash_mode); in cc_proc_scheme_desc()
1111 set_dout_sram(&desc[idx], aead_handle->sram_workspace_addr, in cc_proc_scheme_desc()
1113 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_proc_scheme_desc()
1114 set_setup_mode(&desc[idx], SETUP_WRITE_STATE1); in cc_proc_scheme_desc()
1115 set_cipher_do(&desc[idx], DO_PAD); in cc_proc_scheme_desc()
1119 hw_desc_init(&desc[idx]); in cc_proc_scheme_desc()
1120 set_dout_sram(&desc[idx], aead_handle->sram_workspace_addr, in cc_proc_scheme_desc()
1122 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_proc_scheme_desc()
1123 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in cc_proc_scheme_desc()
1124 set_cipher_config0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); in cc_proc_scheme_desc()
1125 set_cipher_mode(&desc[idx], hash_mode); in cc_proc_scheme_desc()
1129 hw_desc_init(&desc[idx]); in cc_proc_scheme_desc()
1130 set_cipher_mode(&desc[idx], hash_mode); in cc_proc_scheme_desc()
1131 set_din_type(&desc[idx], DMA_DLLI, in cc_proc_scheme_desc()
1134 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_proc_scheme_desc()
1135 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_proc_scheme_desc()
1139 hw_desc_init(&desc[idx]); in cc_proc_scheme_desc()
1140 set_cipher_mode(&desc[idx], hash_mode); in cc_proc_scheme_desc()
1141 set_din_sram(&desc[idx], cc_digest_len_addr(ctx->drvdata, hash_mode), in cc_proc_scheme_desc()
1143 set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); in cc_proc_scheme_desc()
1144 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_proc_scheme_desc()
1145 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_proc_scheme_desc()
1149 hw_desc_init(&desc[idx]); in cc_proc_scheme_desc()
1150 set_din_sram(&desc[idx], aead_handle->sram_workspace_addr, in cc_proc_scheme_desc()
1152 set_flow_mode(&desc[idx], DIN_HASH); in cc_proc_scheme_desc()
1159 struct cc_hw_desc desc[], unsigned int *seq_size) in cc_mlli_to_sram() argument
1173 hw_desc_init(&desc[*seq_size]); in cc_mlli_to_sram()
1174 set_din_type(&desc[*seq_size], DMA_DLLI, in cc_mlli_to_sram()
1177 set_dout_sram(&desc[*seq_size], in cc_mlli_to_sram()
1180 set_flow_mode(&desc[*seq_size], BYPASS); in cc_mlli_to_sram()
1210 static void cc_hmac_authenc(struct aead_request *req, struct cc_hw_desc desc[], in cc_hmac_authenc() argument
1225 cc_set_hmac_desc(req, desc, seq_size); in cc_hmac_authenc()
1226 cc_set_cipher_desc(req, desc, seq_size); in cc_hmac_authenc()
1227 cc_proc_header_desc(req, desc, seq_size); in cc_hmac_authenc()
1228 cc_proc_cipher_desc(req, data_flow_mode, desc, seq_size); in cc_hmac_authenc()
1229 cc_proc_scheme_desc(req, desc, seq_size); in cc_hmac_authenc()
1230 cc_proc_digest_desc(req, desc, seq_size); in cc_hmac_authenc()
1241 cc_proc_cipher(req, desc, seq_size, data_flow_mode); in cc_hmac_authenc()
1243 cc_set_hmac_desc(req, desc, seq_size); in cc_hmac_authenc()
1244 cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); in cc_hmac_authenc()
1245 cc_proc_scheme_desc(req, desc, seq_size); in cc_hmac_authenc()
1246 cc_proc_digest_desc(req, desc, seq_size); in cc_hmac_authenc()
1250 cc_set_hmac_desc(req, desc, seq_size); in cc_hmac_authenc()
1251 cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); in cc_hmac_authenc()
1252 cc_proc_scheme_desc(req, desc, seq_size); in cc_hmac_authenc()
1254 cc_proc_cipher(req, desc, seq_size, data_flow_mode); in cc_hmac_authenc()
1258 cc_proc_digest_desc(req, desc, seq_size); in cc_hmac_authenc()
1263 cc_xcbc_authenc(struct aead_request *req, struct cc_hw_desc desc[], in cc_xcbc_authenc() argument
1278 cc_set_xcbc_desc(req, desc, seq_size); in cc_xcbc_authenc()
1279 cc_set_cipher_desc(req, desc, seq_size); in cc_xcbc_authenc()
1280 cc_proc_header_desc(req, desc, seq_size); in cc_xcbc_authenc()
1281 cc_proc_cipher_desc(req, data_flow_mode, desc, seq_size); in cc_xcbc_authenc()
1282 cc_proc_digest_desc(req, desc, seq_size); in cc_xcbc_authenc()
1293 cc_proc_cipher(req, desc, seq_size, data_flow_mode); in cc_xcbc_authenc()
1295 cc_set_xcbc_desc(req, desc, seq_size); in cc_xcbc_authenc()
1296 cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); in cc_xcbc_authenc()
1297 cc_proc_digest_desc(req, desc, seq_size); in cc_xcbc_authenc()
1300 cc_set_xcbc_desc(req, desc, seq_size); in cc_xcbc_authenc()
1301 cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); in cc_xcbc_authenc()
1303 cc_proc_cipher(req, desc, seq_size, data_flow_mode); in cc_xcbc_authenc()
1307 cc_proc_digest_desc(req, desc, seq_size); in cc_xcbc_authenc()
1409 static int cc_ccm(struct aead_request *req, struct cc_hw_desc desc[], in cc_ccm() argument
1428 hw_desc_init(&desc[idx]); in cc_ccm()
1429 set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); in cc_ccm()
1430 set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, in cc_ccm()
1433 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_ccm()
1434 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_ccm()
1435 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_ccm()
1436 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_ccm()
1440 hw_desc_init(&desc[idx]); in cc_ccm()
1441 set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); in cc_ccm()
1442 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_ccm()
1443 set_din_type(&desc[idx], DMA_DLLI, in cc_ccm()
1445 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_ccm()
1446 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in cc_ccm()
1447 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_ccm()
1451 hw_desc_init(&desc[idx]); in cc_ccm()
1452 set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); in cc_ccm()
1453 set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, in cc_ccm()
1456 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_ccm()
1457 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_ccm()
1458 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_ccm()
1459 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_ccm()
1460 set_aes_not_hash_mode(&desc[idx]); in cc_ccm()
1464 hw_desc_init(&desc[idx]); in cc_ccm()
1465 set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); in cc_ccm()
1466 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_ccm()
1467 set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr, in cc_ccm()
1469 set_cipher_config0(&desc[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); in cc_ccm()
1470 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_ccm()
1471 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_ccm()
1472 set_aes_not_hash_mode(&desc[idx]); in cc_ccm()
1477 cc_set_assoc_desc(req, DIN_HASH, desc, &idx); in cc_ccm()
1479 hw_desc_init(&desc[idx]); in cc_ccm()
1480 set_din_type(&desc[idx], DMA_DLLI, in cc_ccm()
1483 set_flow_mode(&desc[idx], DIN_HASH); in cc_ccm()
1489 cc_proc_cipher_desc(req, cipher_flow_mode, desc, &idx); in cc_ccm()
1492 hw_desc_init(&desc[idx]); in cc_ccm()
1493 set_cipher_mode(&desc[idx], DRV_CIPHER_CBC_MAC); in cc_ccm()
1494 set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr, ctx->authsize, in cc_ccm()
1496 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in cc_ccm()
1497 set_cipher_config0(&desc[idx], HASH_DIGEST_RESULT_LITTLE_ENDIAN); in cc_ccm()
1498 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_ccm()
1499 set_aes_not_hash_mode(&desc[idx]); in cc_ccm()
1503 hw_desc_init(&desc[idx]); in cc_ccm()
1504 set_cipher_mode(&desc[idx], DRV_CIPHER_CTR); in cc_ccm()
1505 set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); in cc_ccm()
1506 set_din_type(&desc[idx], DMA_DLLI, req_ctx->ccm_iv0_dma_addr, in cc_ccm()
1508 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_ccm()
1509 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in cc_ccm()
1510 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_ccm()
1513 hw_desc_init(&desc[idx]); in cc_ccm()
1514 set_din_no_dma(&desc[idx], 0, 0xfffff0); in cc_ccm()
1515 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_ccm()
1519 hw_desc_init(&desc[idx]); in cc_ccm()
1520 set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr, in cc_ccm()
1522 set_dout_dlli(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1); in cc_ccm()
1523 set_queue_last_ind(ctx->drvdata, &desc[idx]); in cc_ccm()
1524 set_flow_mode(&desc[idx], DIN_AES_DOUT); in cc_ccm()
1614 struct cc_hw_desc desc[], unsigned int *seq_size) in cc_set_ghash_desc() argument
1622 hw_desc_init(&desc[idx]); in cc_set_ghash_desc()
1623 set_cipher_mode(&desc[idx], DRV_CIPHER_ECB); in cc_set_ghash_desc()
1624 set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); in cc_set_ghash_desc()
1625 set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, in cc_set_ghash_desc()
1627 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_set_ghash_desc()
1628 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_ghash_desc()
1629 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_set_ghash_desc()
1633 hw_desc_init(&desc[idx]); in cc_set_ghash_desc()
1634 set_din_const(&desc[idx], 0x0, AES_BLOCK_SIZE); in cc_set_ghash_desc()
1635 set_dout_dlli(&desc[idx], req_ctx->hkey_dma_addr, AES_BLOCK_SIZE, in cc_set_ghash_desc()
1637 set_flow_mode(&desc[idx], DIN_AES_DOUT); in cc_set_ghash_desc()
1641 hw_desc_init(&desc[idx]); in cc_set_ghash_desc()
1642 set_din_no_dma(&desc[idx], 0, 0xfffff0); in cc_set_ghash_desc()
1643 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_set_ghash_desc()
1647 hw_desc_init(&desc[idx]); in cc_set_ghash_desc()
1648 set_din_type(&desc[idx], DMA_DLLI, req_ctx->hkey_dma_addr, in cc_set_ghash_desc()
1650 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_set_ghash_desc()
1651 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_ghash_desc()
1652 set_aes_not_hash_mode(&desc[idx]); in cc_set_ghash_desc()
1653 set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); in cc_set_ghash_desc()
1654 set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); in cc_set_ghash_desc()
1655 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_ghash_desc()
1663 hw_desc_init(&desc[idx]); in cc_set_ghash_desc()
1664 set_din_no_dma(&desc[idx], 0, 0xfffff0); in cc_set_ghash_desc()
1665 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_set_ghash_desc()
1666 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_ghash_desc()
1667 set_aes_not_hash_mode(&desc[idx]); in cc_set_ghash_desc()
1668 set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); in cc_set_ghash_desc()
1669 set_cipher_do(&desc[idx], 1); //1=AES_SK RKEK in cc_set_ghash_desc()
1670 set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); in cc_set_ghash_desc()
1671 set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); in cc_set_ghash_desc()
1672 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_ghash_desc()
1678 hw_desc_init(&desc[idx]); in cc_set_ghash_desc()
1679 set_din_const(&desc[idx], 0x0, AES_BLOCK_SIZE); in cc_set_ghash_desc()
1680 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_set_ghash_desc()
1681 set_flow_mode(&desc[idx], S_DIN_to_HASH); in cc_set_ghash_desc()
1682 set_aes_not_hash_mode(&desc[idx]); in cc_set_ghash_desc()
1683 set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); in cc_set_ghash_desc()
1684 set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED); in cc_set_ghash_desc()
1685 set_setup_mode(&desc[idx], SETUP_LOAD_STATE0); in cc_set_ghash_desc()
1691 static void cc_set_gctr_desc(struct aead_request *req, struct cc_hw_desc desc[], in cc_set_gctr_desc() argument
1700 hw_desc_init(&desc[idx]); in cc_set_gctr_desc()
1701 set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); in cc_set_gctr_desc()
1702 set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); in cc_set_gctr_desc()
1703 set_din_type(&desc[idx], DMA_DLLI, ctx->enckey_dma_addr, in cc_set_gctr_desc()
1705 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_set_gctr_desc()
1706 set_setup_mode(&desc[idx], SETUP_LOAD_KEY0); in cc_set_gctr_desc()
1707 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_set_gctr_desc()
1712 hw_desc_init(&desc[idx]); in cc_set_gctr_desc()
1713 set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); in cc_set_gctr_desc()
1714 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_set_gctr_desc()
1715 set_din_type(&desc[idx], DMA_DLLI, in cc_set_gctr_desc()
1718 set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); in cc_set_gctr_desc()
1719 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in cc_set_gctr_desc()
1720 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_set_gctr_desc()
1728 struct cc_hw_desc desc[], in cc_proc_gcm_result() argument
1744 hw_desc_init(&desc[idx]); in cc_proc_gcm_result()
1745 set_din_type(&desc[idx], DMA_DLLI, req_ctx->gcm_block_len_dma_addr, in cc_proc_gcm_result()
1747 set_flow_mode(&desc[idx], DIN_HASH); in cc_proc_gcm_result()
1751 hw_desc_init(&desc[idx]); in cc_proc_gcm_result()
1752 set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); in cc_proc_gcm_result()
1753 set_din_no_dma(&desc[idx], 0, 0xfffff0); in cc_proc_gcm_result()
1754 set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr, AES_BLOCK_SIZE, in cc_proc_gcm_result()
1756 set_setup_mode(&desc[idx], SETUP_WRITE_STATE0); in cc_proc_gcm_result()
1757 set_flow_mode(&desc[idx], S_HASH_to_DOUT); in cc_proc_gcm_result()
1758 set_aes_not_hash_mode(&desc[idx]); in cc_proc_gcm_result()
1763 hw_desc_init(&desc[idx]); in cc_proc_gcm_result()
1764 set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); in cc_proc_gcm_result()
1765 set_key_size_aes(&desc[idx], ctx->enc_keylen); in cc_proc_gcm_result()
1766 set_din_type(&desc[idx], DMA_DLLI, req_ctx->gcm_iv_inc1_dma_addr, in cc_proc_gcm_result()
1768 set_cipher_config0(&desc[idx], DRV_CRYPTO_DIRECTION_ENCRYPT); in cc_proc_gcm_result()
1769 set_setup_mode(&desc[idx], SETUP_LOAD_STATE1); in cc_proc_gcm_result()
1770 set_flow_mode(&desc[idx], S_DIN_to_AES); in cc_proc_gcm_result()
1774 hw_desc_init(&desc[idx]); in cc_proc_gcm_result()
1775 set_din_no_dma(&desc[idx], 0, 0xfffff0); in cc_proc_gcm_result()
1776 set_dout_no_dma(&desc[idx], 0, 0, 1); in cc_proc_gcm_result()
1780 hw_desc_init(&desc[idx]); in cc_proc_gcm_result()
1781 set_cipher_mode(&desc[idx], DRV_CIPHER_GCTR); in cc_proc_gcm_result()
1782 set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr, in cc_proc_gcm_result()
1784 set_dout_dlli(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1); in cc_proc_gcm_result()
1785 set_queue_last_ind(ctx->drvdata, &desc[idx]); in cc_proc_gcm_result()
1786 set_flow_mode(&desc[idx], DIN_AES_DOUT); in cc_proc_gcm_result()
1792 static int cc_gcm(struct aead_request *req, struct cc_hw_desc desc[], in cc_gcm() argument
1800 cc_proc_cipher_desc(req, BYPASS, desc, seq_size); in cc_gcm()
1801 cc_set_ghash_desc(req, desc, seq_size); in cc_gcm()
1803 cc_set_assoc_desc(req, DIN_HASH, desc, seq_size); in cc_gcm()
1804 cc_set_gctr_desc(req, desc, seq_size); in cc_gcm()
1805 cc_proc_gcm_result(req, desc, seq_size); in cc_gcm()
1816 cc_set_ghash_desc(req, desc, seq_size); in cc_gcm()
1819 cc_set_assoc_desc(req, DIN_HASH, desc, seq_size); in cc_gcm()
1820 cc_set_gctr_desc(req, desc, seq_size); in cc_gcm()
1823 cc_proc_cipher_desc(req, cipher_flow_mode, desc, seq_size); in cc_gcm()
1824 cc_proc_gcm_result(req, desc, seq_size); in cc_gcm()
1896 struct cc_hw_desc desc[MAX_AEAD_PROCESS_SEQ]; in cc_proc_aead() local
1984 cc_mlli_to_sram(req, desc, &seq_len); in cc_proc_aead()
1989 cc_hmac_authenc(req, desc, &seq_len); in cc_proc_aead()
1992 cc_xcbc_authenc(req, desc, &seq_len); in cc_proc_aead()
1996 cc_ccm(req, desc, &seq_len); in cc_proc_aead()
1998 cc_gcm(req, desc, &seq_len); in cc_proc_aead()
2009 rc = cc_send_request(ctx->drvdata, &cc_req, desc, seq_len, &req->base); in cc_proc_aead()