Lines Matching refs:cr

237 	struct cesa_request *cr;  in cesa_alloc_request()  local
239 CESA_GENERIC_ALLOC_LOCKED(sc, cr, requests); in cesa_alloc_request()
240 if (!cr) in cesa_alloc_request()
243 STAILQ_INIT(&cr->cr_tdesc); in cesa_alloc_request()
244 STAILQ_INIT(&cr->cr_sdesc); in cesa_alloc_request()
246 return (cr); in cesa_alloc_request()
250 cesa_free_request(struct cesa_softc *sc, struct cesa_request *cr) in cesa_free_request() argument
255 STAILQ_CONCAT(&sc->sc_free_tdesc, &cr->cr_tdesc); in cesa_free_request()
260 STAILQ_CONCAT(&sc->sc_free_sdesc, &cr->cr_sdesc); in cesa_free_request()
264 if (cr->cr_dmap_loaded) { in cesa_free_request()
265 bus_dmamap_unload(sc->sc_data_dtag, cr->cr_dmap); in cesa_free_request()
266 cr->cr_dmap_loaded = 0; in cesa_free_request()
269 CESA_GENERIC_FREE_LOCKED(sc, cr, requests); in cesa_free_request()
273 cesa_enqueue_request(struct cesa_softc *sc, struct cesa_request *cr) in cesa_enqueue_request() argument
277 STAILQ_INSERT_TAIL(&sc->sc_ready_requests, cr, cr_stq); in cesa_enqueue_request()
296 cesa_alloc_sdesc(struct cesa_softc *sc, struct cesa_request *cr) in cesa_alloc_sdesc() argument
307 STAILQ_INSERT_TAIL(&cr->cr_sdesc, csd, csd_stq); in cesa_alloc_sdesc()
349 cesa_tdma_copyin_sa_data(struct cesa_softc *sc, struct cesa_request *cr) in cesa_tdma_copyin_sa_data() argument
353 sizeof(struct cesa_sa_hdesc), cr->cr_csd_paddr, in cesa_tdma_copyin_sa_data()
358 cesa_tdma_copyout_sa_data(struct cesa_softc *sc, struct cesa_request *cr) in cesa_tdma_copyout_sa_data() argument
361 return (cesa_tdma_copy(sc, cr->cr_csd_paddr, sc->sc_sram_base_pa + in cesa_tdma_copyout_sa_data()
374 cesa_append_tdesc(struct cesa_request *cr, struct cesa_tdma_desc *ctd) in cesa_append_tdesc() argument
378 if (!STAILQ_EMPTY(&cr->cr_tdesc)) { in cesa_append_tdesc()
379 ctd_prev = STAILQ_LAST(&cr->cr_tdesc, cesa_tdma_desc, ctd_stq); in cesa_append_tdesc()
384 STAILQ_INSERT_TAIL(&cr->cr_tdesc, ctd, ctd_stq); in cesa_append_tdesc()
388 cesa_append_packet(struct cesa_softc *sc, struct cesa_request *cr, in cesa_append_packet() argument
398 cesa_append_tdesc(cr, ctd); in cesa_append_packet()
402 cesa_append_tdesc(cr, ctd); in cesa_append_packet()
410 cesa_append_tdesc(cr, ctd); in cesa_append_packet()
414 cesa_append_tdesc(cr, ctd); in cesa_append_packet()
553 struct cesa_request *cr; in cesa_create_chain_cb() local
563 cr = cci->cci_cr; in cesa_create_chain_cb()
564 crp = cr->cr_crp; in cesa_create_chain_cb()
581 (crp->crp_aad_length & (cr->cr_cs->cs_ivlen - 1)) != 0) { in cesa_create_chain_cb()
663 mpsize &= ~((cr->cr_cs->cs_ivlen - 1) | (cr->cr_cs->cs_mblen - 1)); in cesa_create_chain_cb()
708 csd = cesa_alloc_sdesc(sc, cr); in cesa_create_chain_cb()
758 error = cesa_append_packet(sc, cr, &cp, csd); in cesa_create_chain_cb()
776 STAILQ_CONCAT(&cr->cr_tdesc, &cp.cp_copyin); in cesa_create_chain_cb()
777 STAILQ_CONCAT(&cr->cr_tdesc, &cp.cp_copyout); in cesa_create_chain_cb()
784 const struct crypto_session_params *csp, struct cesa_request *cr) in cesa_create_chain() argument
797 !CRYPTO_OP_IS_ENCRYPT(cr->cr_crp->crp_op)) in cesa_create_chain()
798 memcpy(cr->cr_csd->csd_key, cr->cr_cs->cs_aes_dkey, in cesa_create_chain()
801 memcpy(cr->cr_csd->csd_key, cr->cr_cs->cs_key, in cesa_create_chain()
806 memcpy(cr->cr_csd->csd_hiv_in, cr->cr_cs->cs_hiv_in, in cesa_create_chain()
808 memcpy(cr->cr_csd->csd_hiv_out, cr->cr_cs->cs_hiv_out, in cesa_create_chain()
812 ctd = cesa_tdma_copyin_sa_data(sc, cr); in cesa_create_chain()
816 cesa_append_tdesc(cr, ctd); in cesa_create_chain()
819 config = cr->cr_cs->cs_config; in cesa_create_chain()
822 !CRYPTO_OP_IS_ENCRYPT(cr->cr_crp->crp_op)) in cesa_create_chain()
839 cci.cci_cr = cr; in cesa_create_chain()
843 error = bus_dmamap_load_crp(sc->sc_data_dtag, cr->cr_dmap, cr->cr_crp, in cesa_create_chain()
847 cr->cr_dmap_loaded = 1; in cesa_create_chain()
856 ctd = cesa_tdma_copyout_sa_data(sc, cr); in cesa_create_chain()
860 cesa_append_tdesc(cr, ctd); in cesa_create_chain()
869 struct cesa_request *prev_cr, *cr; in cesa_execute() local
895 STAILQ_FOREACH(cr, &sc->sc_queued_requests, cr_stq) { in cesa_execute()
897 ctd = STAILQ_FIRST(&cr->cr_tdesc); in cesa_execute()
905 prev_cr = cr; in cesa_execute()
913 cr = STAILQ_FIRST(&sc->sc_queued_requests); in cesa_execute()
914 ctd = STAILQ_FIRST(&cr->cr_tdesc); in cesa_execute()
1443 struct cesa_request *cr, *tmp; in cesa_intr() local
1502 STAILQ_FOREACH_SAFE(cr, &requests, cr_stq, tmp) { in cesa_intr()
1503 bus_dmamap_sync(sc->sc_data_dtag, cr->cr_dmap, in cesa_intr()
1506 cr->cr_crp->crp_etype = sc->sc_error; in cesa_intr()
1507 if (cr->cr_cs->cs_hlen != 0 && cr->cr_crp->crp_etype == 0) { in cesa_intr()
1508 if (cr->cr_crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { in cesa_intr()
1509 crypto_copydata(cr->cr_crp, in cesa_intr()
1510 cr->cr_crp->crp_digest_start, in cesa_intr()
1511 cr->cr_cs->cs_hlen, hash); in cesa_intr()
1512 if (timingsafe_bcmp(hash, cr->cr_csd->csd_hash, in cesa_intr()
1513 cr->cr_cs->cs_hlen) != 0) in cesa_intr()
1514 cr->cr_crp->crp_etype = EBADMSG; in cesa_intr()
1516 crypto_copyback(cr->cr_crp, in cesa_intr()
1517 cr->cr_crp->crp_digest_start, in cesa_intr()
1518 cr->cr_cs->cs_hlen, cr->cr_csd->csd_hash); in cesa_intr()
1520 crypto_done(cr->cr_crp); in cesa_intr()
1521 cesa_free_request(sc, cr); in cesa_intr()
1678 struct cesa_request *cr; in cesa_process() local
1712 cr = cesa_alloc_request(sc); in cesa_process()
1713 if (!cr) { in cesa_process()
1721 cr->cr_crp = crp; in cesa_process()
1722 cr->cr_cs = cs; in cesa_process()
1728 crypto_read_iv(crp, cr->cr_csd->csd_iv); in cesa_process()
1743 error = cesa_create_chain(sc, csp, cr); in cesa_process()
1749 cesa_free_request(sc, cr); in cesa_process()
1755 bus_dmamap_sync(sc->sc_data_dtag, cr->cr_dmap, BUS_DMASYNC_PREREAD | in cesa_process()
1759 cesa_enqueue_request(sc, cr); in cesa_process()