From: "plaisthos (Code Review)" Date: Thu, 14 Nov 2024 13:45:07 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <2ff986022dac3951ecb9dc289c722ebd30f20d0e-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="uMGS7ni8D8A="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Rename aead-tag-at-end to aead-epoch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --uMGS7ni8D8A= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld,=20 I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/805?usp=3Demail to look at the new patch set (#3). Change subject: Rename aead-tag-at-end to aead-epoch ...................................................................... Rename aead-tag-at-end to aead-epoch Change-Id: I9e9433b56dcbaa538d9bed30e50cf74948c647cc Signed-off-by: Arne Schwabe --- M doc/man-sections/client-options.rst M src/openvpn/crypto.c M src/openvpn/crypto.h M src/openvpn/init.c M src/openvpn/options.c M src/openvpn/push.c M src/openvpn/ssl.h M tests/unit_tests/openvpn/test_ssl.c 8 files changed, 18 insertions(+), 13 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/05/805/3 diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-= options.rst index 5ca85e0..0aee9e2 100644 --- a/doc/man-sections/client-options.rst +++ b/doc/man-sections/client-options.rst @@ -367,6 +367,7 @@ - bit 7: The client is capable of sending exit notification via contro= l channel using ``EXIT`` message. Also, the client is accepting the protoco= l-flags pushed option for the EKM capability - bit 8: The client is capable of accepting ``AUTH_FAILED,TEMP`` messa= ges - bit 9: The client is capable of dynamic tls-crypt + - bit 10: The client is capable of data epoch keys :code:`IV_NCP=3D2` Negotiable ciphers, client supports ``--cipher`` pushed by diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index c04ef4f..d3f479f 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -128,7 +128,7 @@ dmsg(D_PACKET_CONTENT, "ENCRYPT AD: %s", format_hex(BPTR(&work), BLEN(&work), 0, &gc)); - if (!(opt->flags & CO_AEAD_TAG_AT_THE_END)) + if (!(opt->flags & CO_EPOCH_DATA_KEY_FORMAT)) { /* Reserve space for authentication tag */ mac_out =3D buf_write_alloc(&work, mac_len); @@ -149,7 +149,7 @@ ASSERT(buf_inc_len(&work, outlen)); /* if the tag is at end the end, allocate it now */ - if (opt->flags & CO_AEAD_TAG_AT_THE_END) + if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT) { /* Reserve space for authentication tag */ mac_out =3D buf_write_alloc(&work, mac_len); @@ -475,7 +475,7 @@ uint8_t *tag_ptr =3D NULL; int data_len =3D 0; - if (opt->flags & CO_AEAD_TAG_AT_THE_END) + if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT) { data_len =3D BLEN(buf) - tag_size; tag_ptr =3D BPTR(buf) + data_len; diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index 1c41443..de94ef1 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -362,9 +362,10 @@ /**< Bit-flag indicating that renegotiations are using tls-crypt * with a TLS-EKM derived key. */ -#define CO_AEAD_TAG_AT_THE_END (1<<8) - /**< Bit-flag indicating that the AEAD tag is at the end of the - * packet. +#define CO_EPOCH_DATA_KEY_FORMAT (1<<8) + /**< Bit-flag indicating that the data format using + * AEAD tag is at the end of the packet and using epoch + * keys is used. */ unsigned int flags; /**< Bit-flags determining behavior of diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 9371024..2c831fe 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2390,9 +2390,9 @@ { buf_printf(&out, " dyn-tls-crypt"); } - if (o->imported_protocol_flags & CO_AEAD_TAG_AT_THE_END) + if (o->imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT) { - buf_printf(&out, " aead-tag-end"); + buf_printf(&out, " aead-epoch"); } } diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 10ee9f6..ec27e7f 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8692,9 +8692,9 @@ options->imported_protocol_flags |=3D CO_USE_DYNAMIC_TLS_C= RYPT; } #endif - else if (streq(p[j], "aead-tag-end")) + else if (streq(p[j], "aead-epoch")) { - options->imported_protocol_flags |=3D CO_AEAD_TAG_AT_THE_E= ND; + options->imported_protocol_flags |=3D CO_EPOCH_DATA_KEY_FO= RMAT; } else { diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 6c06374..01d3699 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -689,9 +689,9 @@ buf_printf(&proto_flags, " dyn-tls-crypt"); } - if (o->imported_protocol_flags & CO_AEAD_TAG_AT_THE_END) + if (o->imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT) { - buf_printf(&proto_flags, " aead-tag-end"); + buf_printf(&proto_flags, " aead-epoch"); } if (buf_len(&proto_flags) > 0) diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index eea1323..e47a94d 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -107,6 +107,9 @@ /** Support to dynamic tls-crypt (renegotiation with TLS-EKM derived tls-c= rypt key) */ #define IV_PROTO_DYN_TLS_CRYPT (1<<9) +/** Support the extended packet id and epoch format for data channel packe= ts */ +#define IV_PROTO_DATA_EPOCH (1<<10) + /** Supports the --dns option after all the incompatible changes */ #define IV_PROTO_DNS_OPTION_V2 (1<<11) diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn= /test_ssl.c index caacd9e..845ca56 100644 --- a/tests/unit_tests/openvpn/test_ssl.c +++ b/tests/unit_tests/openvpn/test_ssl.c @@ -404,7 +404,7 @@ run_data_channel_with_cipher_end(const char *cipher) { struct crypto_options co =3D init_crypto_options(cipher, "none"); - co.flags |=3D CO_AEAD_TAG_AT_THE_END; + co.flags |=3D CO_EPOCH_DATA_KEY_FORMAT; do_data_channel_round_trip(&co); uninit_crypto_options(&co); } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/805?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: I9e9433b56dcbaa538d9bed30e50cf74948c647cc Gerrit-Change-Number: 805 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --uMGS7ni8D8A= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos uploaded patch set #3 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/805?usp=3Demail">View Chang= e

Rename aead-tag-at-end to aead-epoch

Change-Id: I9e9433b56dcba= a538d9bed30e50cf74948c647cc
Signed-off-by: Arne Schwabe <arne@...1830...= ...>
---
M doc/man-sections/client-options.rst
M src/openvpn/cr= ypto.c
M src/openvpn/crypto.h
M src/openvpn/init.c
M src/openvpn/o= ptions.c
M src/openvpn/push.c
M src/openvpn/ssl.h
M tests/unit_tes= ts/openvpn/test_ssl.c
8 files changed, 18 insertions(+), 13 deletions(-)=

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/05/=
805/3
diff --git a/doc/man-sections/client-options.rst b/doc/man-se=
ctions/client-options.rst
index 5ca85e0..0aee9e2 100644
--- a/doc/man-sections/client-options.rst
+++ = b/doc/man-sections/client-options.rst
@@ -367,6 +367,7 @@
- bit 7: The client is capable of sending exit notifica= tion via control channel using ``EXIT`` message. Also, the client is accept= ing the protocol-flags pushed option for the EKM capability
- bit 8: The client is capable of accepting ``AUTH_FAILED,TEMP`` mess= ages

- bit 9: The client is capable of dynamic tls-cry= pt
+ - bit 10: The= client is capable of data epoch keys

= :code:`IV_NCP=3D2`
Negotiable ciphers, client supp= orts ``--cipher`` pushed by
diff --git a/src/openvpn/crypto= .c b/src/openvpn/crypto.c
index c04ef4f..d3f479f 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/c= rypto.c
@@ -128,7 +128,7 @@
dmsg(D_PAC= KET_CONTENT, "ENCRYPT AD: %s",
format_h= ex(BPTR(&work), BLEN(&work), 0, &gc));
=
- if (!(opt->flags &= ; CO_AEAD_TAG_AT_THE_END))
+ if (!(opt->flags & CO_EPOCH_DATA_KEY_FORMAT))
<= span> {

/* Reserve space for authentication ta= g */
mac_out =3D buf_write_alloc(&work, mac_le= n);
@@ -149,7 +149,7 @@
ASSERT(buf_inc= _len(&work, outlen));

/* if the = tag is at end the end, allocate it now */
- if (opt->flags & CO_AEAD_TAG_AT_THE_END)
+ if (opt->flags &= amp; CO_EPOCH_DATA_KEY_FORMAT)
{
= /* Reserve space for authentication tag */
mac= _out =3D buf_write_alloc(&work, mac_len);
@@ -475,7 +47= 5,7 @@
uint8_t *tag_ptr =3D NULL;
= int data_len =3D 0;

- if (opt->flags & CO_AEAD_TAG_AT_THE_END)=
+ if (opt->flags &= ; CO_EPOCH_DATA_KEY_FORMAT)
{
= data_len =3D BLEN(buf) - tag_size;
tag_ptr =3D BP= TR(buf) + data_len;
diff --git a/src/openvpn/crypto.h b/src= /openvpn/crypto.h
index 1c41443..de94ef1 100644
<= span>--- a/src/openvpn/crypto.h

+++ b/src/openvpn/crypto.h<= /span>
@@ -362,9 +362,10 @@
/**< Bit-flag = indicating that renegotiations are using tls-crypt
* = with a TLS-EKM derived key.
*/
-#define CO_AEAD_TAG_AT_THE_END (1<<= 8)
- /**< Bit-fla= g indicating that the AEAD tag is at the end of the
- * packet.
+#define CO_EPOCH_DATA_KEY_FORMAT (1<<8)=
+ /**< Bit-fla= g indicating that the data format using
+ * AEAD tag is at the end of the packet and using = epoch
+ * keys is= used.
*/

unsi= gned int flags; /**< Bit-flags determining behavior ofdiff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 9371024..2c831fe 100644

--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -2390,9 +2390,9 @@=
{
buf_printf(&ou= t, " dyn-tls-crypt");
}
- if (o->imported_protocol_fl= ags & CO_AEAD_TAG_AT_THE_END)
+ if (o->imported_protocol_flags & CO_EPOCH_DATA= _KEY_FORMAT)
{
- buf_printf(&out, " aead-tag-end"= ;);
+ buf_= printf(&out, " aead-epoch");
}
}

diff --git a/src/openvp= n/options.c b/src/openvpn/options.c
index 10ee9f6..ec27e7f = 100644
--- a/src/openvpn/options.c
+++ b/sr= c/openvpn/options.c
@@ -8692,9 +8692,9 @@
= options->imported_protocol_flags |=3D CO_USE_DYNAMIC_TLS= _CRYPT;
}
#endif
- else if (streq(p[j], &= quot;aead-tag-end"))

+ else if (streq(p[j], "aead-epoch"))
<= span> {

- = options->imported_protocol_flags |=3D CO_AEAD_TAG_AT_THE_E= ND;
+ = options->imported_protocol_flags |=3D CO_EPOCH_DATA_KEY_FORMAT; }
else
= {
diff --git a/src/openvpn/push.c b/src/openvpn/= push.c
index 6c06374..01d3699 100644
--- a/= src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -689,9 +689,9 @@

buf_printf(&proto_flags, = " dyn-tls-crypt");
}

- if (o->imported_prot= ocol_flags & CO_AEAD_TAG_AT_THE_END)
+ if (o->imported_protocol_flags & CO_EPOCH_D= ATA_KEY_FORMAT)
{
- buf_printf(&proto_flags, " aead-tag-end&q= uot;);
+ buf_p= rintf(&proto_flags, " aead-epoch");
}

if (buf_len(&proto_flags) > 0)<= /span>
diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.hindex eea1323..e47a94d 100644
--- a/src/openvpn/ssl= .h
+++ b/src/openvpn/ssl.h
@@ -107,6 +107,9= @@
/** Support to dynamic tls-crypt (renegotiation with T= LS-EKM derived tls-crypt key) */
#define IV_PROTO_DYN_TLS_= CRYPT (1<<9)

+/** Support the extended packet id and epoch format for = data channel packets */
+#define IV_PROTO_DATA_EPOCH (1<<10)
+
/** Supports the --dns opt= ion after all the incompatible changes */
#define IV_PROTO= _DNS_OPTION_V2 (1<<11)

diff --git= a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn/test_ssl.= c
index caacd9e..845ca56 100644
--- a/tests= /unit_tests/openvpn/test_ssl.c
+++ b/tests/unit_tests/openv= pn/test_ssl.c
@@ -404,7 +404,7 @@
run_data= _channel_with_cipher_end(const char *cipher)
{
<= span> struct crypto_options co =3D init_crypto_options(cipher, "no= ne");

- co.flag= s |=3D CO_AEAD_TAG_AT_THE_END;
+ co.flags |=3D CO_EPOCH_DATA_KEY_FORMAT;
= do_data_channel_round_trip(&co);
uninit_crypto_op= tions(&co);
}

To v= iew, visit change 805. To unsubscribe, or for help writing mail filters, visit <= a href=3D"http://gerrit.openvpn.net/settings">settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9e9433b56dcbaa538d9bed30e50= cf74948c647cc
Gerrit-Change-Number: 805
Gerrit-PatchSet: 3
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: newpatchset
--uMGS7ni8D8A=--