aboutsummaryrefslogtreecommitdiff
path: root/sys/opencrypto/ktls_ocf.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2021-05-25 23:59:18 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2021-05-25 23:59:18 +0000
commit4a92afae7fcbb0a8453712dfec5de086aaf5cba4 (patch)
treeac9fbb3db3d745e577673c3e45e8e64724101ed2 /sys/opencrypto/ktls_ocf.c
parent883a0196b629a07e52562b4103cc0f6391083080 (diff)
downloadsrc-4a92afae7fcbb0a8453712dfec5de086aaf5cba4.tar.gz
src-4a92afae7fcbb0a8453712dfec5de086aaf5cba4.zip
ktls_ocf: Fix a few places to not hardcode the GMAC hash length.
This is not a functional change as the Poly1305 hash is the same length as the GMAC hash length. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30137
Diffstat (limited to 'sys/opencrypto/ktls_ocf.c')
-rw-r--r--sys/opencrypto/ktls_ocf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c
index 2f2249cd3bfe..31aaba119091 100644
--- a/sys/opencrypto/ktls_ocf.c
+++ b/sys/opencrypto/ktls_ocf.c
@@ -416,11 +416,11 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls,
/* Duplicate iovec and append vector for tag. */
memcpy(iov, tag_uio->uio_iov, outiovcnt * sizeof(struct iovec));
iov[outiovcnt].iov_base = trailer;
- iov[outiovcnt].iov_len = AES_GMAC_HASH_LEN;
+ iov[outiovcnt].iov_len = tls->params.tls_tlen;
tag_uio->uio_iov = iov;
tag_uio->uio_iovcnt++;
crp.crp_digest_start = tag_uio->uio_resid;
- tag_uio->uio_resid += AES_GMAC_HASH_LEN;
+ tag_uio->uio_resid += tls->params.tls_tlen;
crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST;
crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE;
@@ -505,7 +505,7 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls,
error = ktls_ocf_dispatch(os, &crp);
crypto_destroyreq(&crp);
- *trailer_len = AES_GMAC_HASH_LEN;
+ *trailer_len = tls->params.tls_tlen;
return (error);
}