| 1720 | } |
| 1721 | |
| 1722 | static int __must_check |
| 1723 | ccp_do_ghash_aad(struct ccp_queue *qp, struct ccp_session *s) |
| 1724 | { |
| 1725 | struct ccp_desc *desc; |
| 1726 | struct sglist_seg *seg; |
| 1727 | unsigned i; |
| 1728 | |
| 1729 | if (ccp_queue_get_ring_space(qp) < qp->cq_sg_ulptx->sg_nseg) |
| 1730 | return (EAGAIN); |
| 1731 | |
| 1732 | for (i = 0; i < qp->cq_sg_ulptx->sg_nseg; i++) { |
| 1733 | seg = &qp->cq_sg_ulptx->sg_segs[i]; |
| 1734 | |
| 1735 | desc = &qp->desc_ring[qp->cq_tail]; |
| 1736 | |
| 1737 | desc->engine = CCP_ENGINE_AES; |
| 1738 | desc->aes.mode = CCP_AES_MODE_GHASH; |
| 1739 | desc->aes.type = s->blkcipher.cipher_type; |
| 1740 | desc->aes.encrypt = CCP_AES_MODE_GHASH_AAD; |
| 1741 | |
| 1742 | desc->som = (i == 0); |
| 1743 | desc->length = seg->ss_len; |
| 1744 | |
| 1745 | desc->src_lo = (uint32_t)seg->ss_paddr; |
| 1746 | desc->src_hi = (seg->ss_paddr >> 32); |
| 1747 | desc->src_mem = CCP_MEMTYPE_SYSTEM; |
| 1748 | |
| 1749 | desc->lsb_ctx_id = ccp_queue_lsb_entry(qp, LSB_ENTRY_IV); |
| 1750 | |
| 1751 | desc->key_lo = ccp_queue_lsb_address(qp, LSB_ENTRY_KEY); |
| 1752 | desc->key_mem = CCP_MEMTYPE_SB; |
| 1753 | |
| 1754 | qp->cq_tail = (qp->cq_tail + 1) % |
| 1755 | (1 << qp->cq_softc->ring_size_order); |
| 1756 | } |
| 1757 | return (0); |
| 1758 | } |
| 1759 | |
| 1760 | static int __must_check |
| 1761 | ccp_do_gctr(struct ccp_queue *qp, struct ccp_session *s, |
no test coverage detected