Lines Matching refs:crp

431     u_int sgl_len, u_int hash_size, struct cryptop *crp)  in ccr_populate_wreq()  argument
457 crwr->wreq.cookie = htobe64((uintptr_t)crp); in ccr_populate_wreq()
476 ccr_hash(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) in ccr_hash() argument
487 if (crp->crp_payload_length > MAX_REQUEST_SIZE) in ccr_hash()
513 if (crp->crp_payload_length == 0) { in ccr_hash()
517 } else if (ccr_use_imm_data(transhdr_len, crp->crp_payload_length)) { in ccr_hash()
518 imm_len = crp->crp_payload_length; in ccr_hash()
525 crp->crp_payload_start, crp->crp_payload_length); in ccr_hash()
544 hash_size_in_response, crp); in ccr_hash()
553 crwr->sec_cpl.pldlen = htobe32(crp->crp_payload_length == 0 ? in ccr_hash()
554 axf->blocksize : crp->crp_payload_length); in ccr_hash()
568 V_SCMD_MORE_FRAGS(crp->crp_payload_length == 0 ? 1 : 0) | in ccr_hash()
582 if (crp->crp_payload_length == 0) { in ccr_hash()
588 crypto_copydata(crp, crp->crp_payload_start, in ccr_hash()
589 crp->crp_payload_length, dst); in ccr_hash()
600 ccr_hash_done(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, in ccr_hash_done() argument
608 if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { in ccr_hash_done()
609 crypto_copydata(crp, crp->crp_digest_start, s->hmac.hash_len, in ccr_hash_done()
614 crypto_copyback(crp, crp->crp_digest_start, s->hmac.hash_len, in ccr_hash_done()
620 ccr_cipher(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) in ccr_cipher() argument
632 if (s->cipher.key_len == 0 || crp->crp_payload_length == 0) in ccr_cipher()
635 (crp->crp_payload_length % AES_BLOCK_LEN) != 0) in ccr_cipher()
639 if (crp->crp_payload_length > MAX_REQUEST_SIZE) in ccr_cipher()
642 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_cipher()
648 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_cipher()
650 crp->crp_payload_output_start, crp->crp_payload_length); in ccr_cipher()
653 crp->crp_payload_start, crp->crp_payload_length); in ccr_cipher()
671 if (ccr_use_imm_data(transhdr_len, crp->crp_payload_length + iv_len)) { in ccr_cipher()
672 imm_len = crp->crp_payload_length; in ccr_cipher()
679 crp->crp_payload_start, crp->crp_payload_length); in ccr_cipher()
698 crypto_read_iv(crp, iv); in ccr_cipher()
704 crp); in ccr_cipher()
713 crwr->sec_cpl.pldlen = htobe32(iv_len + crp->crp_payload_length); in ccr_cipher()
739 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_cipher()
754 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_cipher()
769 crypto_copydata(crp, crp->crp_payload_start, in ccr_cipher()
770 crp->crp_payload_length, dst); in ccr_cipher()
783 struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error) in ccr_cipher_done() argument
812 ccr_eta(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) in ccr_eta() argument
833 if (s->cipher.key_len == 0 || crp->crp_payload_length == 0) in ccr_eta()
836 (crp->crp_payload_length % AES_BLOCK_LEN) != 0) in ccr_eta()
845 if (crp->crp_aad_length + iv_len > MAX_AAD_LEN) in ccr_eta()
850 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_eta()
865 if (iv_len + crp->crp_aad_length + crp->crp_payload_length + in ccr_eta()
869 if (iv_len + crp->crp_aad_length + crp->crp_payload_length > in ccr_eta()
875 iv_len + crp->crp_aad_length); in ccr_eta()
878 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_eta()
880 crp->crp_payload_output_start, crp->crp_payload_length); in ccr_eta()
883 crp->crp_payload_start, crp->crp_payload_length); in ccr_eta()
887 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_eta()
889 crp->crp_digest_start, hash_size_in_response); in ccr_eta()
892 crp->crp_digest_start, hash_size_in_response); in ccr_eta()
922 input_len = crp->crp_aad_length + crp->crp_payload_length; in ccr_eta()
944 if (crp->crp_aad_length != 0) { in ccr_eta()
945 if (crp->crp_aad != NULL) in ccr_eta()
947 crp->crp_aad, crp->crp_aad_length); in ccr_eta()
950 s->sg_input, crp->crp_aad_start, in ccr_eta()
951 crp->crp_aad_length); in ccr_eta()
956 crp->crp_payload_start, crp->crp_payload_length); in ccr_eta()
961 crp->crp_digest_start, hash_size_in_response); in ccr_eta()
970 if (crp->crp_aad_length != 0) { in ccr_eta()
972 aad_stop = aad_start + crp->crp_aad_length - 1; in ccr_eta()
977 cipher_start = iv_len + crp->crp_aad_length + 1; in ccr_eta()
999 crypto_read_iv(crp, iv); in ccr_eta()
1005 op_type == CHCR_DECRYPT_OP ? hash_size_in_response : 0, crp); in ccr_eta()
1047 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_eta()
1062 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_eta()
1080 if (crp->crp_aad_length != 0) { in ccr_eta()
1081 if (crp->crp_aad != NULL) in ccr_eta()
1082 memcpy(dst, crp->crp_aad, crp->crp_aad_length); in ccr_eta()
1084 crypto_copydata(crp, crp->crp_aad_start, in ccr_eta()
1085 crp->crp_aad_length, dst); in ccr_eta()
1086 dst += crp->crp_aad_length; in ccr_eta()
1088 crypto_copydata(crp, crp->crp_payload_start, in ccr_eta()
1089 crp->crp_payload_length, dst); in ccr_eta()
1090 dst += crp->crp_payload_length; in ccr_eta()
1092 crypto_copydata(crp, crp->crp_digest_start, in ccr_eta()
1106 struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error) in ccr_eta_done() argument
1117 ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) in ccr_gcm() argument
1138 if (crp->crp_payload_length == 0) in ccr_gcm()
1141 if (crp->crp_aad_length + AES_BLOCK_LEN > MAX_AAD_LEN) in ccr_gcm()
1145 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_gcm()
1155 if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) in ccr_gcm()
1168 if (iv_len + crp->crp_aad_length + crp->crp_payload_length + in ccr_gcm()
1172 if (iv_len + crp->crp_aad_length + crp->crp_payload_length > in ccr_gcm()
1178 crp->crp_aad_length); in ccr_gcm()
1181 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_gcm()
1183 crp->crp_payload_output_start, crp->crp_payload_length); in ccr_gcm()
1186 crp->crp_payload_start, crp->crp_payload_length); in ccr_gcm()
1190 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_gcm()
1192 crp->crp_digest_start, hash_size_in_response); in ccr_gcm()
1195 crp->crp_digest_start, hash_size_in_response); in ccr_gcm()
1222 input_len = crp->crp_aad_length + crp->crp_payload_length; in ccr_gcm()
1234 if (crp->crp_aad_length != 0) { in ccr_gcm()
1235 if (crp->crp_aad != NULL) in ccr_gcm()
1237 crp->crp_aad, crp->crp_aad_length); in ccr_gcm()
1240 s->sg_input, crp->crp_aad_start, in ccr_gcm()
1241 crp->crp_aad_length); in ccr_gcm()
1246 crp->crp_payload_start, crp->crp_payload_length); in ccr_gcm()
1251 crp->crp_digest_start, hash_size_in_response); in ccr_gcm()
1259 if (crp->crp_aad_length != 0) { in ccr_gcm()
1261 aad_stop = aad_start + crp->crp_aad_length - 1; in ccr_gcm()
1266 cipher_start = iv_len + crp->crp_aad_length + 1; in ccr_gcm()
1288 crypto_read_iv(crp, iv); in ccr_gcm()
1292 crp); in ccr_gcm()
1351 if (crp->crp_aad_length != 0) { in ccr_gcm()
1352 if (crp->crp_aad != NULL) in ccr_gcm()
1353 memcpy(dst, crp->crp_aad, crp->crp_aad_length); in ccr_gcm()
1355 crypto_copydata(crp, crp->crp_aad_start, in ccr_gcm()
1356 crp->crp_aad_length, dst); in ccr_gcm()
1357 dst += crp->crp_aad_length; in ccr_gcm()
1359 crypto_copydata(crp, crp->crp_payload_start, in ccr_gcm()
1360 crp->crp_payload_length, dst); in ccr_gcm()
1361 dst += crp->crp_payload_length; in ccr_gcm()
1363 crypto_copydata(crp, crp->crp_digest_start, in ccr_gcm()
1377 struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error) in ccr_gcm_done() argument
1413 generate_ccm_b0(struct cryptop *crp, u_int hash_size_in_response, in generate_ccm_b0() argument
1426 payload_len = crp->crp_payload_length; in generate_ccm_b0()
1438 if (crp->crp_aad_length != 0) { in generate_ccm_b0()
1440 *(uint16_t *)(b0 + CCM_B0_SIZE) = htobe16(crp->crp_aad_length); in generate_ccm_b0()
1445 ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) in ccr_ccm() argument
1461 csp = crypto_get_params(crp->crp_session); in ccr_ccm()
1470 if (crp->crp_payload_length == 0) in ccr_ccm()
1474 if (crp->crp_payload_length > ccm_max_payload_length(csp)) in ccr_ccm()
1482 if (crp->crp_aad_length != 0) in ccr_ccm()
1484 aad_len = b0_len + crp->crp_aad_length; in ccr_ccm()
1490 if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) in ccr_ccm()
1503 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_ccm()
1518 if (iv_len + aad_len + crp->crp_payload_length + in ccr_ccm()
1522 if (iv_len + aad_len + crp->crp_payload_length > in ccr_ccm()
1531 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_ccm()
1533 crp->crp_payload_output_start, crp->crp_payload_length); in ccr_ccm()
1536 crp->crp_payload_start, crp->crp_payload_length); in ccr_ccm()
1540 if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_ccm()
1542 crp->crp_digest_start, hash_size_in_response); in ccr_ccm()
1545 crp->crp_digest_start, hash_size_in_response); in ccr_ccm()
1572 input_len = aad_len + crp->crp_payload_length; in ccr_ccm()
1586 if (crp->crp_aad_length != 0) { in ccr_ccm()
1587 if (crp->crp_aad != NULL) in ccr_ccm()
1589 crp->crp_aad, crp->crp_aad_length); in ccr_ccm()
1592 s->sg_input, crp->crp_aad_start, in ccr_ccm()
1593 crp->crp_aad_length); in ccr_ccm()
1598 crp->crp_payload_start, crp->crp_payload_length); in ccr_ccm()
1603 crp->crp_digest_start, hash_size_in_response); in ccr_ccm()
1641 crypto_read_iv(crp, iv + 1); in ccr_ccm()
1644 crp); in ccr_ccm()
1697 generate_ccm_b0(crp, hash_size_in_response, iv, dst); in ccr_ccm()
1700 if (crp->crp_aad_length != 0) { in ccr_ccm()
1701 if (crp->crp_aad != NULL) in ccr_ccm()
1702 memcpy(dst, crp->crp_aad, crp->crp_aad_length); in ccr_ccm()
1704 crypto_copydata(crp, crp->crp_aad_start, in ccr_ccm()
1705 crp->crp_aad_length, dst); in ccr_ccm()
1706 dst += crp->crp_aad_length; in ccr_ccm()
1708 crypto_copydata(crp, crp->crp_payload_start, in ccr_ccm()
1709 crp->crp_payload_length, dst); in ccr_ccm()
1710 dst += crp->crp_payload_length; in ccr_ccm()
1712 crypto_copydata(crp, crp->crp_digest_start, in ccr_ccm()
1743 struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error) in ccr_ccm_done() argument
1761 ccr_soft_done(struct cryptop *crp) in ccr_soft_done() argument
1765 orig = crp->crp_opaque; in ccr_soft_done()
1766 orig->crp_etype = crp->crp_etype; in ccr_soft_done()
1767 crypto_freereq(crp); in ccr_soft_done()
1773 ccr_soft(struct ccr_session *s, struct cryptop *crp) in ccr_soft() argument
1778 new = crypto_clonereq(crp, s->sw_session, M_NOWAIT); in ccr_soft()
1780 crp->crp_etype = ENOMEM; in ccr_soft()
1781 crypto_done(crp); in ccr_soft()
1791 new->crp_opaque = crp; in ccr_soft()
1795 crp->crp_etype = error; in ccr_soft()
1796 crypto_done(crp); in ccr_soft()
2523 ccr_process(device_t dev, struct cryptop *crp, int hint) in ccr_process() argument
2530 csp = crypto_get_params(crp->crp_session); in ccr_process()
2531 s = crypto_get_driver_session(crp->crp_session); in ccr_process()
2535 error = ccr_populate_sglist(s->sg_input, &crp->crp_buf); in ccr_process()
2536 if (error == 0 && CRYPTO_HAS_OUTPUT_BUFFER(crp)) in ccr_process()
2537 error = ccr_populate_sglist(s->sg_output, &crp->crp_obuf); in ccr_process()
2545 error = ccr_hash(sc, s, crp); in ccr_process()
2550 if (crp->crp_auth_key != NULL) in ccr_process()
2552 s->hmac.partial_digest_len, crp->crp_auth_key, in ccr_process()
2554 error = ccr_hash(sc, s, crp); in ccr_process()
2559 if (crp->crp_cipher_key != NULL) in ccr_process()
2560 ccr_aes_setkey(s, crp->crp_cipher_key, in ccr_process()
2562 error = ccr_cipher(sc, s, crp); in ccr_process()
2564 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_process()
2571 if (crp->crp_auth_key != NULL) in ccr_process()
2573 s->hmac.partial_digest_len, crp->crp_auth_key, in ccr_process()
2575 if (crp->crp_cipher_key != NULL) in ccr_process()
2576 ccr_aes_setkey(s, crp->crp_cipher_key, in ccr_process()
2578 error = ccr_eta(sc, s, crp); in ccr_process()
2580 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_process()
2587 if (crp->crp_cipher_key != NULL) { in ccr_process()
2588 t4_init_gmac_hash(crp->crp_cipher_key, in ccr_process()
2590 ccr_aes_setkey(s, crp->crp_cipher_key, in ccr_process()
2593 error = ccr_gcm(sc, s, crp); in ccr_process()
2597 ccr_soft(s, crp); in ccr_process()
2601 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_process()
2608 if (crp->crp_cipher_key != NULL) { in ccr_process()
2609 ccr_aes_setkey(s, crp->crp_cipher_key, in ccr_process()
2612 error = ccr_ccm(sc, s, crp); in ccr_process()
2616 ccr_soft(s, crp); in ccr_process()
2620 if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) in ccr_process()
2641 crp->crp_etype = error; in ccr_process()
2642 crypto_done(crp); in ccr_process()
2655 struct cryptop *crp; in do_cpl6_fw_pld() local
2664 crp = (struct cryptop *)(uintptr_t)be64toh(cpl->data[1]); in do_cpl6_fw_pld()
2665 s = crypto_get_driver_session(crp->crp_session); in do_cpl6_fw_pld()
2684 error = ccr_hash_done(sc, s, crp, cpl, error); in do_cpl6_fw_pld()
2687 error = ccr_cipher_done(sc, s, crp, cpl, error); in do_cpl6_fw_pld()
2690 error = ccr_eta_done(sc, s, crp, cpl, error); in do_cpl6_fw_pld()
2693 error = ccr_gcm_done(sc, s, crp, cpl, error); in do_cpl6_fw_pld()
2696 error = ccr_ccm_done(sc, s, crp, cpl, error); in do_cpl6_fw_pld()
2706 crp->crp_etype = error; in do_cpl6_fw_pld()
2707 crypto_done(crp); in do_cpl6_fw_pld()