From owner-svn-src-projects@freebsd.org Sat Jul 25 02:55:34 2020 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C22B37BAC5 for ; Sat, 25 Jul 2020 02:55:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BD9fs6XDkz4bbn; Sat, 25 Jul 2020 02:55:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF4FD14BFF; Sat, 25 Jul 2020 02:55:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06P2tX0B050248; Sat, 25 Jul 2020 02:55:33 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06P2tXVD050247; Sat, 25 Jul 2020 02:55:33 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007250255.06P2tXVD050247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 25 Jul 2020 02:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r363508 - projects/nfs-over-tls/sys/opencrypto X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfs-over-tls/sys/opencrypto X-SVN-Commit-Revision: 363508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jul 2020 02:55:34 -0000 Author: rmacklem Date: Sat Jul 25 02:55:33 2020 New Revision: 363508 URL: https://svnweb.freebsd.org/changeset/base/363508 Log: The merge resulted in two ktls_ocf_tls12_gcm_decrypt() functions. Delete the one not in ktls_ocf.c in head. Modified: projects/nfs-over-tls/sys/opencrypto/ktls_ocf.c Modified: projects/nfs-over-tls/sys/opencrypto/ktls_ocf.c ============================================================================== --- projects/nfs-over-tls/sys/opencrypto/ktls_ocf.c Sat Jul 25 01:36:06 2020 (r363507) +++ projects/nfs-over-tls/sys/opencrypto/ktls_ocf.c Sat Jul 25 02:55:33 2020 (r363508) @@ -273,98 +273,6 @@ ktls_ocf_tls12_gcm_decrypt(struct ktls_session *tls, } static int -ktls_ocf_tls12_gcm_decrypt(struct ktls_session *tls, - const struct tls_record_layer *hdr, struct iovec *iniov, int iovcnt, - uint64_t seqno, int *trailer_len) -{ - struct uio uio; - struct tls_aead_data ad; - struct cryptop *crp; - struct ocf_session *os; - struct ocf_operation *oo; - struct iovec *iov; - int error; - uint16_t tls_comp_len; - - os = tls->cipher; - - oo = malloc(sizeof(*oo) + (iovcnt + 1) * sizeof(*iov), M_KTLS_OCF, - M_WAITOK | M_ZERO); - oo->os = os; - iov = oo->iov; - - crp = crypto_getreq(os->sid, M_WAITOK); - - /* Setup the IV. */ - memcpy(crp->crp_iv, tls->params.iv, TLS_AEAD_GCM_LEN); - memcpy(crp->crp_iv + TLS_AEAD_GCM_LEN, hdr + 1, sizeof(uint64_t)); - - /* Setup the AAD. */ - tls_comp_len = ntohs(hdr->tls_length) - - (AES_GMAC_HASH_LEN + sizeof(uint64_t)); - ad.seq = htobe64(seqno); - ad.type = hdr->tls_type; - ad.tls_vmajor = hdr->tls_vmajor; - ad.tls_vminor = hdr->tls_vminor; - ad.tls_length = htons(tls_comp_len); - iov[0].iov_base = &ad; - iov[0].iov_len = sizeof(ad); - uio.uio_resid = sizeof(ad); - - /* Copy over IOV entries for the payload and trailer. */ - memcpy(iov + 1, iniov, iovcnt * sizeof(*iov)); - - uio.uio_resid = sizeof(ad) + tls_comp_len + AES_GMAC_HASH_LEN; - uio.uio_iov = iov; - uio.uio_iovcnt = iovcnt + 1; - uio.uio_offset = 0; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_td = curthread; - - crp->crp_op = CRYPTO_OP_DECRYPT | CRYPTO_OP_VERIFY_DIGEST; - crp->crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; - crp->crp_buf_type = CRYPTO_BUF_UIO; - crp->crp_uio = &uio; - crp->crp_ilen = uio.uio_resid; - crp->crp_opaque = oo; - crp->crp_callback = ktls_ocf_callback; - - crp->crp_aad_start = 0; - crp->crp_aad_length = sizeof(ad); - crp->crp_payload_start = sizeof(ad); - crp->crp_payload_length = crp->crp_ilen - - (sizeof(ad) + AES_GMAC_HASH_LEN); - crp->crp_digest_start = crp->crp_ilen - AES_GMAC_HASH_LEN; - - counter_u64_add(ocf_tls12_gcm_crypts, 1); - for (;;) { - error = crypto_dispatch(crp); - if (error) - break; - - mtx_lock(&os->lock); - while (!oo->done) - mtx_sleep(oo, &os->lock, 0, "ocfktls", 0); - mtx_unlock(&os->lock); - - if (crp->crp_etype != EAGAIN) { - error = crp->crp_etype; - break; - } - - crp->crp_etype = 0; - crp->crp_flags &= ~CRYPTO_F_DONE; - oo->done = false; - counter_u64_add(ocf_retries, 1); - } - - crypto_freereq(crp); - free(oo, M_KTLS_OCF); - *trailer_len = AES_GMAC_HASH_LEN; - return (error); -} - -static int ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls, const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, struct iovec *outiov, int iovcnt, uint64_t seqno, uint8_t record_type)