git: 5ce0850641a3 - stable/13 - ktls_ocf: Fix a few places to not hardcode the GMAC hash length.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Nov 2021 23:12:49 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5ce0850641a3224e999c501030df08d8f1dd994d commit 5ce0850641a3224e999c501030df08d8f1dd994d Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-11-23 23:11:44 +0000 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 (cherry picked from commit 4a92afae7fcbb0a8453712dfec5de086aaf5cba4) --- sys/opencrypto/ktls_ocf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 1d5dce83b376..78331b76abd7 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -403,11 +403,11 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, /* Duplicate iovec and append vector for tag. */ memcpy(iov, tag_uio->uio_iov, iovcnt * sizeof(struct iovec)); iov[iovcnt].iov_base = trailer; - iov[iovcnt].iov_len = AES_GMAC_HASH_LEN; + iov[iovcnt].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; @@ -492,7 +492,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); }