From: "MaxF (Code Review)"
Date: Sat, 23 Nov 2024 00:00:15 +0000
In-Reply-To:
References:
Reply-To: max@...2606..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...
Message-ID: <9c0818170654bbcd878b4faceb360545fa6aeb08-EmailReviewComments-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="/4f72QFVhlk="; charset=UTF-8
Subject: [Openvpn-devel] [L] Change in openvpn[master]: Implement HKDF
expand function based on RFC 8446
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos
Cc: flichtenheld , openvpn-devel
--/4f72QFVhlk=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/open=
vpn/+/798?usp=3Demail )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 5: -Code-Review
(5 comments)
Patchset:
PS5:
The ovpn_expand_label() function looks good to me now. I have some nitpicks=
but it should work correctly. Also, I really like that you added a test to=
see that it produces the same result as OpenSSL!
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/4f1de082_54f44df5 :
PS4, Line 67: hmac_ctx_cleanup(hmac_ctx);
: hmac_ctx_free(hmac_ctx);
> mbed TLS needs both: [=E2=80=A6]
Makes sense!
http://gerrit.openvpn.net/c/openvpn/+/798/comment/a592ddf7_ad5c9cd2 :
PS4, Line 86: /* 2 byte for the outlen encoded as uint16, 5 bytes for "=
ovpn " */
: int hkdf_label_len =3D 2 + 5 + label_len + context_len;
: struct buffer hkdf_label =3D alloc_buf_gc(hkdf_label_len,=
&gc);
:
:
: buf_write_u16(&hkdf_label, out_len);
: buf_write(&hkdf_label, "ovpn ", 5);
: buf_write(&hkdf_label, label, label_len);
: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }
> Yeah, you are right. [=E2=80=A6]
I agree, it's a good idea to keep it close to the TLS standard. Also makes =
it easier if someone else is going to review it in the future.
The current implementation looks good to me!
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/2574664f_9fe72c38 :
PS5, Line 89: int hkdf_label_len =3D 2 + 5 + 1 + label_len + 1 + contex=
t_len;
: struct buffer hkdf_label =3D alloc_buf_gc(hkdf_label_len,=
&gc);
:
: const uint8_t *label_prefix =3D (const uint8_t *) ("ovpn =
");
: int prefix_len =3D 5;
You could move the prefix_len declaration up and replace the "5" in hkdf_la=
bel_len with it.
http://gerrit.openvpn.net/c/openvpn/+/798/comment/effb4ac6_eb381832 :
PS5, Line 101: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }
Why do we need this check? buf_write() doesn't do anything if context_len i=
s 0 right?
(And if it's needed, why is it not needed for label?)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?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: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos
Gerrit-Reviewer: MaxF
Gerrit-Reviewer: flichtenheld
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
Gerrit-Comment-Date: Sat, 23 Nov 2024 00:00:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: plaisthos
Comment-In-Reply-To: MaxF
Gerrit-MessageType: comment
--/4f72QFVhlk=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
Patch set 5:-Code-Review
<=
p>View Ch=
ange
5 comments:
<=
li style=3D"margin: 0; padding: 0;">Patchset:
File src/openvpn/=
crypto_epoch.c:
Pa=
tch Set #4, Line 67:
hmac_ctx_cleanup(hmac_ctx);
=
hmac_ctx_free(hmac_ctx);
mbed TLS=
needs both: [=E2=80=A6]
Makes sense!
Patch Set #4, Line 8=
6:
/* 2 byte for the outlen encoded as uint16, 5 bytes=
for "ovpn " */
int hkdf_label_len =3D 2 + 5 + label_len +=
context_len;
struct buffer hkdf_label =3D alloc_buf_gc(hkdf_label_l=
en, &gc);
buf_write_u16(&hkdf_label, out_len);
=
buf_write(&hkdf_label, "ovpn ", 5);
buf_write(&h=
kdf_label, label, label_len);
if (context_len > 0)
{
=
buf_write(&hkdf_label, context, context_len);
}
<=
/blockquote>Yeah, you are right. [=E2=80=A6]
=
p>I agree, it=
9;s a good idea to keep it close to the TLS standard. Also makes it easier =
if someone else is going to review it in the future.
The current implementation looks go=
od to me!
File sr=
c/openvpn/crypto_epoch.c:
Patch Set #5, Line 1=
01:
if (context_len > 0)
{
buf_wr=
ite(&hkdf_label, context, context_len);
}
=
Why do we ne=
ed this check? buf_write() doesn't do anything if context_len is 0 righ=
t?
(And if it=
's needed, why is it not needed for label?)
T=
o view, visit change 798. To unsubscribe, or for help writing mail filters, visi=
t settings.
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff=
620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <arne-openvpn@...1711...=
27...>
Gerrit-Reviewer: MaxF <max@...2606...> <=
/div>
Gerrit-Reviewer: flichtenheld <frank@...2716...=
1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
Gerrit-Comment-Date: Sat, 23 Nov 2024 00:00:15=
+0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: plaisthos <arne-openvp=
n@...1227...>
Comment-In-Reply-To: MaxF <max@...2606...&g=
t;
Gerrit-MessageType: comment
--/4f72QFVhlk=--