From patchwork Sat Oct 7 10:25:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3375 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:b412:b0:f2:62eb:61c1 with SMTP id dj18csp937772dyb; Sat, 7 Oct 2023 03:26:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVUpDi+AulrVoN49ATrLLBw9ywinNaHi4RBDOa1M7IeEW5VKDDyTtM777TIPrgIZm4VQuf X-Received: by 2002:a17:902:dac8:b0:1bf:1a9e:85f7 with SMTP id q8-20020a170902dac800b001bf1a9e85f7mr11661094plx.1.1696674400323; Sat, 07 Oct 2023 03:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696674400; cv=none; d=google.com; s=arc-20160816; b=IjSj0y/w0O13EhQ9Z3HBTVMj1HteEpz4kyIMXjZw98lQHGo5q05j1CkK1T5mil93kL gorDQxiRK2H8V86CAfx/3HcWaZ9zoJnuBj5ecvjy5kfbGFf1PxVnzcjgPN0rYwusifaa CmRc1T6dnxGMDzHgWFzujy5e9LD0r7TKKpqkY/sybQRetgjInw7ZIhxZkxenS2isPL1L b3Oc5WYsg0jlplcmL8Lhl2IfRWI6UBxhHroQW4T4C6INSO9WS6PLkue8U5nqBX9v7fRa 49mMV4ON6b63O/Yb/O7V757Iooz/CbvS+ARMup4if/TMdpn7Ohr3B45QaccZtfr7Hzdt u4Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=GQ2KCXlbbVsNTgT8f5xwN5GIFj0mbgj0I5+FkxchKvM=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=TFfOeepVhC2j7mrL/Lq0MHGBqyOV9bYmtA6BtO/nNcWm/K7y10BdWyCysH89gjhOlJ H52EVZVN4hTGiLe2QI7BqKNBglbWKCnHWeUY62W43Dtzq2aohN0ezdR4RbRnEq7shSBW /F0whY47WTqUPAFYZdSZfke3bw/2yhEX5PAdJjR9L4hAmT9YsepYnGs0DiMt7DKG65M6 WgkSTDHA+sFPDZUTuYxVzsQCAuSq/H9nb6swcNq0KBmLcF7zyws8M738cpSrjPmAxcad ZNGoVAARTyQd2DFy+V2zlId/WkJgOWGOTPHFBKa/GToOBtsWGexMQkvzx5vJpZzrDELA 26bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BZOnOlFt; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=in5UhmxM; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=UHHIJNJN; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id b7-20020a170903228700b001c1f1394bf9si5946653plh.357.2023.10.07.03.26.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Oct 2023 03:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BZOnOlFt; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=in5UhmxM; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=UHHIJNJN; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qp4VM-0000tJ-Oh; Sat, 07 Oct 2023 10:25:51 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qp4VJ-0000sR-MM for openvpn-devel@lists.sourceforge.net; Sat, 07 Oct 2023 10:25:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RYIim8xdXTrnn0QzWdF+F8Oygly65CPUCFgQ8QKQLh8=; b=BZOnOlFtjqhUuvS73jM/VAEoTO YoA7qUZWa9JTyw4XijH9w9smOyrzUF51Vms1dcdH5nyhxfgq7KIIo3UEaCsP81hGIjWtdG+ZcUL3r dFZ50f86aMJPnIA/ry2I5+A/sKass9yLXIRhEaqj5myLdD322BAKc4jchLTuse2Yk10c=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=RYIim8xdXTrnn0QzWdF+F8Oygly65CPUCFgQ8QKQLh8=; b=i n5UhmxMUBGK2MDca2FgM9a7/jw4o/uZ/HsxcHoZ5WCBOohdLR1KY2vYfIvynY+beMgIVKKSJK6a/G fwyhVxAN7PUwKuQrKjifxPzE2znC/S22918NBbvhmP/VINHQYjZ9uFyqzLBHR42Ye9D6wAc5uFE0f rT86nfVP76AZlpPI=; Received: from mail-lf1-f47.google.com ([209.85.167.47]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qp4V7-0000yU-1S for openvpn-devel@lists.sourceforge.net; Sat, 07 Oct 2023 10:25:44 +0000 Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5041d6d8b10so3799900e87.2 for ; Sat, 07 Oct 2023 03:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1696674330; x=1697279130; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=RYIim8xdXTrnn0QzWdF+F8Oygly65CPUCFgQ8QKQLh8=; b=UHHIJNJNdwA2wrMLerkXQj59YELqhrlwclYA9oF0hTtAqPV8Z9j87GdNDKoqcMdsiH OT0F3N/3enExS8eIIPrrwNEyBPUoU/6SbPB4f9pNpV/9KVWP4ibtJJtNPOTofxDUzs0B 0MamjPrOialZHbRRsVoKo/5+FAhIkk5VQ5+zY5wtR7gBR6GSjYiyQVMpRYtjk8213EUH VRCg/yk//YBCYPwil0iTu9pDkBs6PLIpSKqbjQa0GLHK2tZAuHv8BSqyICpEeroC356/ jVl/eBwtkPhOLqD1kG+ui+A4dZg4Ax/kEPyjZa4NlW1Z7MQt2+kltieAAMjn718FZZLD fkgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696674330; x=1697279130; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RYIim8xdXTrnn0QzWdF+F8Oygly65CPUCFgQ8QKQLh8=; b=gbnryiC7c9MBVJT37BncHOdNzVYjFQxTz6KRS8HUYOoOF0e0PZmGiOUMo0fTI1iQKz 5iri4sty7znj1yXT58g+1Kd0H4nBjzbJztLHELsXeqtmjn+3Ppuhn7v7JRCtnqQr38Q5 jL130TM4OHGhPP3GWQnp50Oe+kijNZFS/6WEQpr1/rl5s4yLIpV7eIoKauxqy6nwXTFB ymUgZqP0XaeNj3Reznvc3XIH/eQnn4iJmtp+KS6txpCDBZe2RNcJFCXpsiofH3z7NJLJ W+BsqMsnqlKin/A0otGWyc9XrVtf1jKziUF8abK312MT0jTtsEaOTmI0PjPbwghbpq+G SO+w== X-Gm-Message-State: AOJu0YxLxt3Ku3xCCO3nDdSS/xjcf4is2Eg40d5CyRXMIsVoK8LqmAHn 8CJUes1NtSwZmo+c/dmwRSDSHI8DAZctIMHKUk4= X-Received: by 2002:a05:6512:3686:b0:500:b14a:cc63 with SMTP id d6-20020a056512368600b00500b14acc63mr7624478lfs.12.1696674330147; Sat, 07 Oct 2023 03:25:30 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id x11-20020a05600c21cb00b00405bbfd5d16sm5860921wmj.7.2023.10.07.03.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 03:25:29 -0700 (PDT) From: "plaisthos (Code Review)" X-Google-Original-From: "plaisthos (Code Review)" X-Gerrit-PatchSet: 1 Date: Sat, 7 Oct 2023 10:25:29 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Iaf12bb51a2aac7bcf19070f0b56fa3b1a5863bc3 X-Gerrit-Change-Number: 364 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: f3e7ac90e77dfe800d6299f91d8df23c33d76c48 References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -0.6 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-0.6 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.4 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.47 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.47 listed in list.dnswl.org] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1qp4V7-0000yU-1S Subject: [Openvpn-devel] [M] Change in openvpn[master]: Print server temp key details X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1779092055948887421?= X-GMAIL-MSGID: =?utf-8?q?1779092055948887421?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/364?usp=email to review the following change. Change subject: Print server temp key details ...................................................................... Print server temp key details Change-Id: Iaf12bb51a2aac7bcf19070f0b56fa3b1a5863bc3 --- M src/openvpn/ssl_openssl.c 1 file changed, 44 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/364/1 diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index b5cc9a7..b91ea07 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -2052,18 +2052,11 @@ return ret; } -/** - * Print human readable information about the certifcate into buf - * @param cert the certificate being used - * @param buf output buffer - * @param buflen output buffer length - */ static void -print_cert_details(X509 *cert, char *buf, size_t buflen) +print_pkey_details(EVP_PKEY *pkey, char *buf, size_t buflen) { const char *curve = ""; const char *type = "(error getting type)"; - EVP_PKEY *pkey = X509_get_pubkey(cert); if (pkey == NULL) { @@ -2126,6 +2119,23 @@ #endif /* if OPENSSL_VERSION_NUMBER < 0x30000000L */ } + openvpn_snprintf(buf, buflen, "%d bits %s%s", + EVP_PKEY_bits(pkey), type, curve); +} + +/** + * Print human readable information about the certifcate into buf + * @param cert the certificate being used + * @param buf output buffer + * @param buflen output buffer length + */ +static void +print_cert_details(X509 *cert, char *buf, size_t buflen) +{ + EVP_PKEY *pkey = X509_get_pubkey(cert); + char pkeybuf[128] = { 0 }; + print_pkey_details(pkey, pkeybuf, sizeof(pkeybuf)); + char sig[128] = { 0 }; int signature_nid = X509_get_signature_nid(cert); if (signature_nid != 0) @@ -2134,8 +2144,27 @@ OBJ_nid2sn(signature_nid)); } - openvpn_snprintf(buf, buflen, ", peer certificate: %d bit %s%s%s", - EVP_PKEY_bits(pkey), type, curve, sig); + openvpn_snprintf(buf, buflen, ", peer certificate: %s%s", + pkeybuf, sig); + + EVP_PKEY_free(pkey); +} + +static void +print_server_tempkey(SSL *ssl, char *buf, size_t buflen) +{ + EVP_PKEY *pkey = NULL; + SSL_get_peer_tmp_key(ssl, &pkey); + if (!pkey) + { + return; + } + + char pkeybuf[128] = { 0 }; + print_pkey_details(pkey, pkeybuf, sizeof(pkeybuf)); + + openvpn_snprintf(buf, buflen, ", server temp key: %s", + pkeybuf); EVP_PKEY_free(pkey); } @@ -2153,8 +2182,9 @@ const SSL_CIPHER *ciph; char s1[256]; char s2[256]; + char s3[256]; - s1[0] = s2[0] = 0; + s1[0] = s2[0] = s3[0] = 0; ciph = SSL_get_current_cipher(ks_ssl->ssl); openvpn_snprintf(s1, sizeof(s1), "%s %s, cipher %s %s", prefix, @@ -2168,7 +2198,9 @@ print_cert_details(cert, s2, sizeof(s2)); X509_free(cert); } - msg(D_HANDSHAKE, "%s%s", s1, s2); + print_server_tempkey(ks_ssl->ssl, s3, sizeof(s3)); + + msg(D_HANDSHAKE, "%s%s%s", s1, s2, s3); } void