Lines Matching full:sa
30 static void set_dynamic_sa_command_0(struct dynamic_sa_ctl *sa, u32 save_h, in set_dynamic_sa_command_0() argument
35 sa->sa_command_0.w = 0; in set_dynamic_sa_command_0()
36 sa->sa_command_0.bf.save_hash_state = save_h; in set_dynamic_sa_command_0()
37 sa->sa_command_0.bf.save_iv = save_iv; in set_dynamic_sa_command_0()
38 sa->sa_command_0.bf.load_hash_state = ld_h; in set_dynamic_sa_command_0()
39 sa->sa_command_0.bf.load_iv = ld_iv; in set_dynamic_sa_command_0()
40 sa->sa_command_0.bf.hdr_proc = hdr_proc; in set_dynamic_sa_command_0()
41 sa->sa_command_0.bf.hash_alg = h; in set_dynamic_sa_command_0()
42 sa->sa_command_0.bf.cipher_alg = c; in set_dynamic_sa_command_0()
43 sa->sa_command_0.bf.pad_type = pad_type & 3; in set_dynamic_sa_command_0()
44 sa->sa_command_0.bf.extend_pad = pad_type >> 2; in set_dynamic_sa_command_0()
45 sa->sa_command_0.bf.op_group = op_grp; in set_dynamic_sa_command_0()
46 sa->sa_command_0.bf.opcode = op; in set_dynamic_sa_command_0()
47 sa->sa_command_0.bf.dir = dir; in set_dynamic_sa_command_0()
50 static void set_dynamic_sa_command_1(struct dynamic_sa_ctl *sa, u32 cm, in set_dynamic_sa_command_1() argument
55 sa->sa_command_1.w = 0; in set_dynamic_sa_command_1()
56 sa->sa_command_1.bf.crypto_mode31 = (cm & 4) >> 2; in set_dynamic_sa_command_1()
57 sa->sa_command_1.bf.crypto_mode9_8 = cm & 3; in set_dynamic_sa_command_1()
58 sa->sa_command_1.bf.feedback_mode = cfb; in set_dynamic_sa_command_1()
59 sa->sa_command_1.bf.sa_rev = 1; in set_dynamic_sa_command_1()
60 sa->sa_command_1.bf.hmac_muting = hmac_mc; in set_dynamic_sa_command_1()
61 sa->sa_command_1.bf.extended_seq_num = esn; in set_dynamic_sa_command_1()
62 sa->sa_command_1.bf.seq_num_mask = sn_mask; in set_dynamic_sa_command_1()
63 sa->sa_command_1.bf.mutable_bit_proc = mute; in set_dynamic_sa_command_1()
64 sa->sa_command_1.bf.copy_pad = cp_pad; in set_dynamic_sa_command_1()
65 sa->sa_command_1.bf.copy_payload = cp_pay; in set_dynamic_sa_command_1()
66 sa->sa_command_1.bf.copy_hdr = cp_hdr; in set_dynamic_sa_command_1()
128 struct dynamic_sa_ctl *sa; in crypto4xx_setkey_aes() local
135 /* Create SA */ in crypto4xx_setkey_aes()
143 /* Setup SA */ in crypto4xx_setkey_aes()
144 sa = ctx->sa_in; in crypto4xx_setkey_aes()
146 set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_ECB ? in crypto4xx_setkey_aes()
155 set_dynamic_sa_command_1(sa, cm, SA_HASH_MODE_HASH, in crypto4xx_setkey_aes()
160 crypto4xx_memcpy_to_le32(get_dynamic_sa_key_field(sa), in crypto4xx_setkey_aes()
162 sa->sa_contents.w = SA_AES_CONTENTS | (keylen << 2); in crypto4xx_setkey_aes()
163 sa->sa_command_1.bf.key_len = keylen >> 3; in crypto4xx_setkey_aes()
166 sa = ctx->sa_out; in crypto4xx_setkey_aes()
167 sa->sa_command_0.bf.dir = DIR_OUTBOUND; in crypto4xx_setkey_aes()
172 sa->sa_command_0.bf.opcode = SA_OPCODE_ENCRYPT; in crypto4xx_setkey_aes()
372 struct dynamic_sa_ctl *sa; in crypto4xx_setkey_aes_ccm() local
386 /* Setup SA */ in crypto4xx_setkey_aes_ccm()
387 sa = (struct dynamic_sa_ctl *) ctx->sa_in; in crypto4xx_setkey_aes_ccm()
388 sa->sa_contents.w = SA_AES_CCM_CONTENTS | (keylen << 2); in crypto4xx_setkey_aes_ccm()
390 set_dynamic_sa_command_0(sa, SA_SAVE_HASH, SA_NOT_SAVE_IV, in crypto4xx_setkey_aes_ccm()
397 set_dynamic_sa_command_1(sa, CRYPTO_MODE_CTR, SA_HASH_MODE_HASH, in crypto4xx_setkey_aes_ccm()
403 sa->sa_command_1.bf.key_len = keylen >> 3; in crypto4xx_setkey_aes_ccm()
405 crypto4xx_memcpy_to_le32(get_dynamic_sa_key_field(sa), key, keylen); in crypto4xx_setkey_aes_ccm()
408 sa = (struct dynamic_sa_ctl *) ctx->sa_out; in crypto4xx_setkey_aes_ccm()
410 set_dynamic_sa_command_0(sa, SA_SAVE_HASH, SA_NOT_SAVE_IV, in crypto4xx_setkey_aes_ccm()
417 set_dynamic_sa_command_1(sa, CRYPTO_MODE_CTR, SA_HASH_MODE_HASH, in crypto4xx_setkey_aes_ccm()
423 sa->sa_command_1.bf.key_len = keylen >> 3; in crypto4xx_setkey_aes_ccm()
434 struct dynamic_sa_ctl *sa = (struct dynamic_sa_ctl *)tmp_sa; in crypto4xx_crypt_aes_ccm() local
444 sa->sa_command_0.bf.digest_len = crypto_aead_authsize(aead) >> 2; in crypto4xx_crypt_aes_ccm()
448 sa->sa_command_1.bf.crypto_mode9_8 = 1; in crypto4xx_crypt_aes_ccm()
456 sa, ctx->sa_len, req->assoclen, rctx->dst); in crypto4xx_crypt_aes_ccm()
518 struct dynamic_sa_ctl *sa; in crypto4xx_setkey_aes_gcm() local
535 sa = (struct dynamic_sa_ctl *) ctx->sa_in; in crypto4xx_setkey_aes_gcm()
537 sa->sa_contents.w = SA_AES_GCM_CONTENTS | (keylen << 2); in crypto4xx_setkey_aes_gcm()
538 set_dynamic_sa_command_0(sa, SA_SAVE_HASH, SA_NOT_SAVE_IV, in crypto4xx_setkey_aes_gcm()
544 set_dynamic_sa_command_1(sa, CRYPTO_MODE_CTR, SA_HASH_MODE_HASH, in crypto4xx_setkey_aes_gcm()
550 sa->sa_command_1.bf.key_len = keylen >> 3; in crypto4xx_setkey_aes_gcm()
552 crypto4xx_memcpy_to_le32(get_dynamic_sa_key_field(sa), in crypto4xx_setkey_aes_gcm()
555 rc = crypto4xx_compute_gcm_hash_key_sw(get_dynamic_sa_inner_digest(sa), in crypto4xx_setkey_aes_gcm()
563 sa = (struct dynamic_sa_ctl *) ctx->sa_out; in crypto4xx_setkey_aes_gcm()
564 sa->sa_command_0.bf.dir = DIR_OUTBOUND; in crypto4xx_setkey_aes_gcm()
565 sa->sa_command_0.bf.opcode = SA_OPCODE_ENCRYPT_HASH; in crypto4xx_setkey_aes_gcm()
617 struct dynamic_sa_hash160 *sa; in crypto4xx_hash_alg_init() local
624 /* Create SA */ in crypto4xx_hash_alg_init()
634 sa = (struct dynamic_sa_hash160 *)ctx->sa_in; in crypto4xx_hash_alg_init()
635 set_dynamic_sa_command_0(&sa->ctrl, SA_SAVE_HASH, SA_NOT_SAVE_IV, in crypto4xx_hash_alg_init()
640 set_dynamic_sa_command_1(&sa->ctrl, 0, SA_HASH_MODE_HASH, in crypto4xx_hash_alg_init()
645 /* Need to zero hash digest in SA */ in crypto4xx_hash_alg_init()
646 memset(sa->inner_digest, 0, sizeof(sa->inner_digest)); in crypto4xx_hash_alg_init()
647 memset(sa->outer_digest, 0, sizeof(sa->outer_digest)); in crypto4xx_hash_alg_init()
656 struct dynamic_sa_ctl *sa; in crypto4xx_hash_init() local
658 sa = ctx->sa_in; in crypto4xx_hash_init()
661 sa->sa_command_0.bf.digest_len = ds >> 2; in crypto4xx_hash_init()
662 sa->sa_command_0.bf.load_hash_state = SA_LOAD_HASH_FROM_SA; in crypto4xx_hash_init()