| 1828 | } |
| 1829 | |
| 1830 | static void |
| 1831 | ccp_gcm_done(struct ccp_queue *qp, struct ccp_session *s, void *vcrp, |
| 1832 | int error) |
| 1833 | { |
| 1834 | char tag[GMAC_DIGEST_LEN]; |
| 1835 | struct cryptop *crp; |
| 1836 | |
| 1837 | crp = vcrp; |
| 1838 | |
| 1839 | s->pending--; |
| 1840 | |
| 1841 | if (error != 0) { |
| 1842 | crp->crp_etype = error; |
| 1843 | goto out; |
| 1844 | } |
| 1845 | |
| 1846 | /* Encrypt is done. Decrypt needs to verify tag. */ |
| 1847 | if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) |
| 1848 | goto out; |
| 1849 | |
| 1850 | /* Copy in message tag. */ |
| 1851 | crypto_copydata(crp, crp->crp_digest_start, s->gmac.hash_len, tag); |
| 1852 | |
| 1853 | /* Verify tag against computed GMAC */ |
| 1854 | if (timingsafe_bcmp(tag, s->gmac.final_block, s->gmac.hash_len) != 0) |
| 1855 | crp->crp_etype = EBADMSG; |
| 1856 | |
| 1857 | out: |
| 1858 | explicit_bzero(&s->blkcipher.iv, sizeof(s->blkcipher.iv)); |
| 1859 | explicit_bzero(&s->gmac.final_block, sizeof(s->gmac.final_block)); |
| 1860 | crypto_done(crp); |
| 1861 | } |
| 1862 | |
| 1863 | int __must_check |
| 1864 | ccp_gcm(struct ccp_queue *qp, struct ccp_session *s, struct cryptop *crp) |
nothing calls this directly
no test coverage detected