From: "plaisthos (Code Review)" Date: Mon, 20 Nov 2023 10:08:19 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <239072d555cb45830e7e28000f6a95977c06c052-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="WfvRgZpESSA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: protocol_dump: tls-crypt support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --WfvRgZpESSA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/+/442?usp=3Demail to review the following change. Change subject: protocol_dump: tls-crypt support ...................................................................... protocol_dump: tls-crypt support Change-Id: Ie25aa287f3534090c1d93fc3bb69727dd20fc6fe --- M src/openvpn/openvpn.h M src/openvpn/ssl.c M src/openvpn/ssl.h 3 files changed, 29 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/442/1 diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 5b2be63..dabc5be 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -541,7 +541,8 @@ #define PROTO_DUMP(buf, gc) protocol_dump((buf), \ PROTO_DUMP_FLAGS \ |(c->c2.tls_multi ? PD_TLS : 0) = \ - |(c->options.tls_auth_file ? md_= kt_size(c->c1.ks.key_type.digest) : 0), \ + |(c->options.tls_auth_file ? md_= kt_size(c->c1.ks.key_type.digest) : 0) \ + |(c->options.tls_crypt_file || c= ->options.tls_crypt_v2_file ? PD_TLS_CRYPT : 0), \ gc) /* this represents "disabled peer-id" */ diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index b4cd8f5..400230c 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -4272,6 +4272,32 @@ } buf_printf(&out, " pid=3D%s", packet_id_net_print(&pin, (flags & P= D_VERBOSE), gc)); } + /* + * packet_id + tls-crypt hmac + */ + if (flags & PD_TLS_CRYPT) + { + struct packet_id_net pin; + uint8_t tls_crypt_hmac[TLS_CRYPT_TAG_SIZE]; + + if (!packet_id_read(&pin, &buf, true)) + { + goto done; + } + buf_printf(&out, " pid=3D%s", packet_id_net_print(&pin, (flags & P= D_VERBOSE), gc)); + if (!buf_read(&buf, tls_crypt_hmac, TLS_CRYPT_TAG_SIZE)) + { + goto done; + } + if (flags & PD_VERBOSE) + { + buf_printf(&out, " tls_crypt_hmac=3D%s", format_hex(tls_crypt_= hmac, TLS_CRYPT_TAG_SIZE, 0, gc)); + } + /* + * Remainder is encrypted and optional wKc + */ + goto done; + } /* * ACK list diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index 3c40fbe..e842746 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -525,6 +525,7 @@ #define PD_SHOW_DATA (1<<8) #define PD_TLS (1<<9) #define PD_VERBOSE (1<<10) +#define PD_TLS_CRYPT (1<<11) const char *protocol_dump(struct buffer *buffer, unsigned int flags, -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/442?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie25aa287f3534090c1d93fc3bb69727dd20fc6fe Gerrit-Change-Number: 442 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --WfvRgZpESSA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

protocol_dump: tls-crypt support

Change-Id: Ie25aa287f= 3534090c1d93fc3bb69727dd20fc6fe
---
M src/openvpn/openvpn.h
M src/= openvpn/ssl.c
M src/openvpn/ssl.h
3 files changed, 29 insertions(+), = 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn ref=
s/changes/42/442/1
diff --git a/src/openvpn/openvpn.h b/src/openvpn=
/openvpn.h
index 5b2be63..dabc5be 100644
--= - a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -541,7 +541,8 @@
#define PROTO_DUMP(buf, gc)= protocol_dump((buf), \
= PROTO_DUMP_FLAGS \
= |(c->c2.tls_multi ? PD_TLS : 0) \
- |= (c->options.tls_auth_file ? md_kt_size(c->c1.ks.key_type.digest) : 0)= , \
+ = |(c->options.tls_auth_file ? md_kt_size(c->= c1.ks.key_type.digest) : 0) \
+ |(c->options.tls_cry= pt_file || c->options.tls_crypt_v2_file ? PD_TLS_CRYPT : 0), \ gc)

/* this represents "disabled peer-id" */
= diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
in= dex b4cd8f5..400230c 100644
--- a/src/openvpn/ssl.c<= br>+++ b/src/openvpn/ssl.c
@@ -4272,6 +4272,32 @@
}
buf_printf(&out, "= ; pid=3D%s", packet_id_net_print(&pin, (flags & PD_VERBOSE), g= c));
}
+ /*
+ = * packet_id + tls-crypt hmac
+ */
+ = if (flags & PD_TLS_CRYPT)
+ {
+ = struct packet_id_net pin;
+ uint8_t tls_crypt_hmac[TLS_CRYPT_TAG_SIZE];
+

+ if (!packet_id_read(&pin, &buf, tru= e))
+ {=
+ goto done;
+ }
+ buf_printf(&out, &quo= t; pid=3D%s", packet_id_net_print(&pin, (flags & PD_VERBOSE), = gc));

+ if (!b= uf_read(&buf, tls_crypt_hmac, TLS_CRYPT_TAG_SIZE))
+ {
+ goto done;
+ }
+ if (flags & PD_VERBOSE)
+ {
+ buf_printf(&out, " tls_crypt_h= mac=3D%s", format_hex(tls_crypt_hmac, TLS_CRYPT_TAG_SIZE, 0, gc));
+ }
+ /*

+ * Remainder is encrypted and opt= ional wKc
+ *= /
+ goto done;=
+ }

/*
* ACK list
diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h

index= 3c40fbe..e842746 100644
--- a/src/openvpn/ssl.h
= +++ b/src/openvpn/ssl.h
@@ -525,6 +525,7 @@ #define PD_SHOW_DATA (1<<8)
#d= efine PD_TLS (1<<9)
#define PD_V= ERBOSE (1<<10)
+#define PD_TLS_CRYPT (1<<11)
const char *protocol_dump(struct buffer *buffer,<= /span>
unsigned int flags,

To view, visit change 442. To unsubscribe, or for help w= riting mail filters, visit s= ettings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie25aa287f3534090c1d93fc3bb6= 9727dd20fc6fe
Gerrit-Change-Number: 442
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--WfvRgZpESSA=--