From owner-svn-src-all@freebsd.org Mon May 25 12:34:16 2020 Return-Path: Delivered-To: svn-src-all@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 192D42FE635; Mon, 25 May 2020 12:34:16 +0000 (UTC) (envelope-from hselasky@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 49VxNl6zH9z3RwC; Mon, 25 May 2020 12:34:15 +0000 (UTC) (envelope-from hselasky@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 EAA4812517; Mon, 25 May 2020 12:34:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04PCYFfQ034304; Mon, 25 May 2020 12:34:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04PCYFg0034303; Mon, 25 May 2020 12:34:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202005251234.04PCYFg0034303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 25 May 2020 12:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361446 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 361446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2020 12:34:16 -0000 Author: hselasky Date: Mon May 25 12:34:15 2020 New Revision: 361446 URL: https://svnweb.freebsd.org/changeset/base/361446 Log: Correctly set the initial vector for TLS v1.3 for mlx5en(4). For TLS v1.3 the 12 bytes of the initial vector, IV, should just be copied as-is from the kernel to the gcm_iv field, which hold the first 4 bytes, and the remaining 8 bytes go to the subsequent implicit_iv field. There is no need to consider the byte order on the 12 bytes of IV like initially done. Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Mon May 25 12:31:48 2020 (r361445) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Mon May 25 12:34:15 2020 (r361446) @@ -251,18 +251,14 @@ mlx5e_tls_set_params(void *ctx, const struct tls_sessi MLX5_SET(sw_tls_cntx, ctx, param.encryption_standard, 1); /* TLS */ /* copy the initial vector in place */ - if (en->iv_len == MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv)) { + switch (en->iv_len) { + case MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv): + case MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv) + + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv): memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, param.gcm_iv), - en->iv, MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv)); - } else if (en->iv_len == (MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv) + - MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv))) { - memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, param.gcm_iv), - (char *)en->iv + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv), - MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv)); - memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, param.implicit_iv), - en->iv, - MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv)); - } else { + en->iv, en->iv_len); + break; + default: return (EINVAL); }