MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ccp_gcm_done

Function ccp_gcm_done

freebsd/crypto/ccp/ccp_hardware.c:1830–1861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1828}
1829
1830static void
1831ccp_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
1857out:
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
1863int __must_check
1864ccp_gcm(struct ccp_queue *qp, struct ccp_session *s, struct cryptop *crp)

Callers

nothing calls this directly

Calls 4

crypto_copydataFunction · 0.85
timingsafe_bcmpFunction · 0.85
explicit_bzeroFunction · 0.85
crypto_doneFunction · 0.85

Tested by

no test coverage detected