Lines Matching +full:sec +full:- +full:era

1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright 2016-2019 NXP
14 * both of which are specified in req->src and req->dst
45 * cnstr_shdsc_aead_null_encap - IPSec ESP encapsulation shared descriptor
46 * (non-protocol) with no (null) encryption.
49 * A split key is required for SEC Era < 6; the size of the split key
50 * is specified in this case. Valid algorithm values - one of
54 * @era: SEC Era
57 unsigned int icvsize, int era) in cnstr_shdsc_aead_null_encap() argument
66 if (era < 6) { in cnstr_shdsc_aead_null_encap()
67 if (adata->key_inline) in cnstr_shdsc_aead_null_encap()
68 append_key_as_imm(desc, adata->key_virt, in cnstr_shdsc_aead_null_encap()
69 adata->keylen_pad, adata->keylen, in cnstr_shdsc_aead_null_encap()
73 append_key(desc, adata->key_dma, adata->keylen, in cnstr_shdsc_aead_null_encap()
88 * MOVE_LEN opcode is not available in all SEC HW revisions, in cnstr_shdsc_aead_null_encap()
89 * thus need to do some magic, i.e. self-patch the descriptor in cnstr_shdsc_aead_null_encap()
101 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_null_encap()
124 * cnstr_shdsc_aead_null_decap - IPSec ESP decapsulation shared descriptor
125 * (non-protocol) with no (null) decryption.
128 * A split key is required for SEC Era < 6; the size of the split key
129 * is specified in this case. Valid algorithm values - one of
133 * @era: SEC Era
136 unsigned int icvsize, int era) in cnstr_shdsc_aead_null_decap() argument
145 if (era < 6) { in cnstr_shdsc_aead_null_decap()
146 if (adata->key_inline) in cnstr_shdsc_aead_null_decap()
147 append_key_as_imm(desc, adata->key_virt, in cnstr_shdsc_aead_null_decap()
148 adata->keylen_pad, adata->keylen, in cnstr_shdsc_aead_null_decap()
152 append_key(desc, adata->key_dma, adata->keylen, in cnstr_shdsc_aead_null_decap()
160 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_null_decap()
171 * MOVE_LEN opcode is not available in all SEC HW revisions, in cnstr_shdsc_aead_null_decap()
172 * thus need to do some magic, i.e. self-patch the descriptor in cnstr_shdsc_aead_null_decap()
213 const bool is_rfc3686, u32 *nonce, int era) in init_sh_desc_key_aead() argument
216 unsigned int enckeylen = cdata->keylen; in init_sh_desc_key_aead()
231 enckeylen -= CTR_RFC3686_NONCE_SIZE; in init_sh_desc_key_aead()
233 if (era < 6) { in init_sh_desc_key_aead()
234 if (adata->key_inline) in init_sh_desc_key_aead()
235 append_key_as_imm(desc, adata->key_virt, in init_sh_desc_key_aead()
236 adata->keylen_pad, adata->keylen, in init_sh_desc_key_aead()
240 append_key(desc, adata->key_dma, adata->keylen, in init_sh_desc_key_aead()
246 if (cdata->key_inline) in init_sh_desc_key_aead()
247 append_key_as_imm(desc, cdata->key_virt, enckeylen, in init_sh_desc_key_aead()
250 append_key(desc, cdata->key_dma, enckeylen, CLASS_1 | in init_sh_desc_key_aead()
269 * cnstr_shdsc_aead_encap - IPSec ESP encapsulation shared descriptor
270 * (non-protocol).
273 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
276 * A split key is required for SEC Era < 6; the size of the split key
277 * is specified in this case. Valid algorithm values - one of
286 * @era: SEC Era
292 int era) in cnstr_shdsc_aead_encap() argument
295 init_sh_desc_key_aead(desc, cdata, adata, is_rfc3686, nonce, era); in cnstr_shdsc_aead_encap()
298 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_encap()
321 if (is_qi || era < 3) { in cnstr_shdsc_aead_encap()
344 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_encap()
363 * cnstr_shdsc_aead_decap - IPSec ESP decapsulation shared descriptor
364 * (non-protocol).
367 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
370 * A split key is required for SEC Era < 6; the size of the split key
371 * is specified in this case. Valid algorithm values - one of
381 * @era: SEC Era
387 const u32 ctx1_iv_off, const bool is_qi, int era) in cnstr_shdsc_aead_decap() argument
390 init_sh_desc_key_aead(desc, cdata, adata, is_rfc3686, nonce, era); in cnstr_shdsc_aead_decap()
393 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_decap()
417 if (is_qi || era < 3) { in cnstr_shdsc_aead_decap()
459 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_decap()
462 append_dec_op1(desc, cdata->algtype); in cnstr_shdsc_aead_decap()
480 * cnstr_shdsc_aead_givencap - IPSec ESP encapsulation shared descriptor
481 * (non-protocol) with HW-generated initialization
485 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
488 * A split key is required for SEC Era < 6; the size of the split key
489 * is specified in this case. Valid algorithm values - one of
498 * @era: SEC Era
504 const bool is_qi, int era) in cnstr_shdsc_aead_givencap() argument
510 init_sh_desc_key_aead(desc, cdata, adata, is_rfc3686, nonce, era); in cnstr_shdsc_aead_givencap()
556 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_givencap()
560 if (is_qi || era < 3) { in cnstr_shdsc_aead_givencap()
591 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_aead_givencap()
605 * Wait for IV transfer (ofifo -> class2) to finish before starting in cnstr_shdsc_aead_givencap()
606 * ciphertext transfer (ofifo -> external memory). in cnstr_shdsc_aead_givencap()
626 * cnstr_shdsc_gcm_encap - gcm encapsulation shared descriptor
629 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_GCM.
646 if (cdata->key_inline) in cnstr_shdsc_gcm_encap()
647 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_gcm_encap()
648 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_gcm_encap()
650 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_gcm_encap()
655 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_gcm_encap()
697 /* cryptlen = seqinlen - assoclen */ in cnstr_shdsc_gcm_encap()
700 /* if cryptlen is ZERO jump to zero-payload commands */ in cnstr_shdsc_gcm_encap()
724 /* zero-payload commands */ in cnstr_shdsc_gcm_encap()
753 * cnstr_shdsc_gcm_decap - gcm decapsulation shared descriptor
756 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_GCM.
772 if (cdata->key_inline) in cnstr_shdsc_gcm_decap()
773 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_gcm_decap()
774 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_gcm_decap()
776 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_gcm_decap()
781 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_gcm_decap()
818 /* cryptlen = seqoutlen - assoclen */ in cnstr_shdsc_gcm_decap()
821 /* jump to zero-payload command if cryptlen is zero */ in cnstr_shdsc_gcm_decap()
834 /* zero-payload command */ in cnstr_shdsc_gcm_decap()
848 * cnstr_shdsc_rfc4106_encap - IPSec ESP gcm encapsulation shared descriptor
849 * (non-protocol).
852 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_GCM.
871 if (cdata->key_inline) in cnstr_shdsc_rfc4106_encap()
872 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_rfc4106_encap()
873 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_rfc4106_encap()
875 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_rfc4106_encap()
880 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_rfc4106_encap()
898 append_fifo_load_as_imm(desc, (void *)(cdata->key_virt + in cnstr_shdsc_rfc4106_encap()
899 cdata->keylen), 4, FIFOLD_CLASS_CLASS1 | in cnstr_shdsc_rfc4106_encap()
922 /* Workaround for erratum A-005473 (simultaneous SEQ FIFO skips) */ in cnstr_shdsc_rfc4106_encap()
959 * cnstr_shdsc_rfc4106_decap - IPSec ESP gcm decapsulation shared descriptor
960 * (non-protocol).
963 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_GCM.
979 if (cdata->key_inline) in cnstr_shdsc_rfc4106_decap()
980 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_rfc4106_decap()
981 cdata->keylen, CLASS_1 | in cnstr_shdsc_rfc4106_decap()
984 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_rfc4106_decap()
989 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_rfc4106_decap()
1007 append_fifo_load_as_imm(desc, (void *)(cdata->key_virt + in cnstr_shdsc_rfc4106_decap()
1008 cdata->keylen), 4, FIFOLD_CLASS_CLASS1 | in cnstr_shdsc_rfc4106_decap()
1027 /* Workaround for erratum A-005473 (simultaneous SEQ FIFO skips) */ in cnstr_shdsc_rfc4106_decap()
1054 * cnstr_shdsc_rfc4543_encap - IPSec ESP gmac encapsulation shared descriptor
1055 * (non-protocol).
1058 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_GCM.
1074 if (cdata->key_inline) in cnstr_shdsc_rfc4543_encap()
1075 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_rfc4543_encap()
1076 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_rfc4543_encap()
1078 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_rfc4543_encap()
1083 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_rfc4543_encap()
1091 append_fifo_load_as_imm(desc, (void *)(cdata->key_virt + in cnstr_shdsc_rfc4543_encap()
1092 cdata->keylen), 4, FIFOLD_CLASS_CLASS1 | in cnstr_shdsc_rfc4543_encap()
1102 * MOVE_LEN opcode is not available in all SEC HW revisions, in cnstr_shdsc_rfc4543_encap()
1103 * thus need to do some magic, i.e. self-patch the descriptor in cnstr_shdsc_rfc4543_encap()
1137 * cnstr_shdsc_rfc4543_decap - IPSec ESP gmac decapsulation shared descriptor
1138 * (non-protocol).
1141 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_GCM.
1157 if (cdata->key_inline) in cnstr_shdsc_rfc4543_decap()
1158 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_rfc4543_decap()
1159 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_rfc4543_decap()
1161 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_rfc4543_decap()
1166 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_rfc4543_decap()
1174 append_fifo_load_as_imm(desc, (void *)(cdata->key_virt + in cnstr_shdsc_rfc4543_decap()
1175 cdata->keylen), 4, FIFOLD_CLASS_CLASS1 | in cnstr_shdsc_rfc4543_decap()
1185 * MOVE_LEN opcode is not available in all SEC HW revisions, in cnstr_shdsc_rfc4543_decap()
1186 * thus need to do some magic, i.e. self-patch the descriptor in cnstr_shdsc_rfc4543_decap()
1203 /* In-snoop assoclen + cryptlen data */ in cnstr_shdsc_rfc4543_decap()
1225 * cnstr_shdsc_chachapoly - Chacha20 + Poly1305 generic AEAD (rfc7539) and
1227 * descriptor (non-protocol).
1230 * Valid algorithm values - OP_ALG_ALGSEL_CHACHA20 ANDed with
1233 * Valid algorithm values - OP_ALG_ALGSEL_POLY1305 ANDed with
1256 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, in cnstr_shdsc_chachapoly()
1261 append_load_as_imm(desc, cdata->key_virt + cdata->keylen, 4, in cnstr_shdsc_chachapoly()
1269 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_chachapoly()
1271 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_chachapoly()
1274 append_operation(desc, adata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_chachapoly()
1276 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_chachapoly()
1319 /* IPsec - copy IV at the output */ in cnstr_shdsc_chachapoly()
1357 /* For skcipher encrypt and decrypt, read from req->src and write to req->dst */
1368 * cnstr_shdsc_skcipher_encap - skcipher encapsulation shared descriptor
1371 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
1373 * - OP_ALG_ALGSEL_CHACHA20
1383 u32 options = cdata->algtype | OP_ALG_AS_INIT | OP_ALG_ENCRYPT; in cnstr_shdsc_skcipher_encap()
1384 bool is_chacha20 = ((cdata->algtype & OP_ALG_ALGSEL_MASK) == in cnstr_shdsc_skcipher_encap()
1393 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_skcipher_encap()
1394 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_skcipher_encap()
1398 const u8 *nonce = cdata->key_virt + cdata->keylen; in cnstr_shdsc_skcipher_encap()
1444 * cnstr_shdsc_skcipher_decap - skcipher decapsulation shared descriptor
1447 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
1449 * - OP_ALG_ALGSEL_CHACHA20
1459 bool is_chacha20 = ((cdata->algtype & OP_ALG_ALGSEL_MASK) == in cnstr_shdsc_skcipher_decap()
1468 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_skcipher_decap()
1469 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_skcipher_decap()
1473 const u8 *nonce = cdata->key_virt + cdata->keylen; in cnstr_shdsc_skcipher_decap()
1500 append_operation(desc, cdata->algtype | OP_ALG_AS_INIT | in cnstr_shdsc_skcipher_decap()
1503 append_dec_op1(desc, cdata->algtype); in cnstr_shdsc_skcipher_decap()
1521 * cnstr_shdsc_xts_skcipher_encap - xts skcipher encapsulation shared descriptor
1524 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_XTS.
1532 * crypto API / dm-crypt SW architecture. in cnstr_shdsc_xts_skcipher_encap()
1543 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_xts_skcipher_encap()
1544 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_xts_skcipher_encap()
1555 * Lower 8B of IV - sector index / tweak lower half in cnstr_shdsc_xts_skcipher_encap()
1556 * Upper 8B of IV - upper half of 16B tweak in cnstr_shdsc_xts_skcipher_encap()
1564 append_operation(desc, cdata->algtype | OP_ALG_AS_INITFINAL | in cnstr_shdsc_xts_skcipher_encap()
1583 * cnstr_shdsc_xts_skcipher_decap - xts skcipher decapsulation shared descriptor
1586 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_XTS.
1594 * crypto API / dm-crypt SW architecture. in cnstr_shdsc_xts_skcipher_decap()
1605 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_xts_skcipher_decap()
1606 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_xts_skcipher_decap()
1617 * Lower 8B of IV - sector index / tweak lower half in cnstr_shdsc_xts_skcipher_decap()
1618 * Upper 8B of IV - upper half of 16B tweak in cnstr_shdsc_xts_skcipher_decap()
1625 append_dec_op1(desc, cdata->algtype); in cnstr_shdsc_xts_skcipher_decap()
1644 MODULE_AUTHOR("Freescale Semiconductor - NMG/STC");