From: "plaisthos (Code Review)" Date: Sat, 23 Nov 2024 21:04:00 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., max@...2606... Message-ID: <2d40e3d74531cb410220e679cfbd529cf6f9674a-EmailReviewComments-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="0m2gt25QJRs="; 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: , Cc: MaxF , flichtenheld , openvpn-devel --0m2gt25QJRs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: MaxF, flichtenheld. plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c= /openvpn/+/798?usp=3Demail ) Change subject: Implement HKDF expand function based on RFC 8446 ...................................................................... Patch Set 6: (3 comments) File src/openvpn/crypto_epoch.h: http://gerrit.openvpn.net/c/openvpn/+/798/comment/4094583d_be1b5fbb : PS4, Line 32: * - salt is always assumed to be zero length (ie not suppor= ted) : * - IKM (secret) is assumed to be always 32 bytes > You are right. [=E2=80=A6] Done File src/openvpn/crypto_epoch.c: http://gerrit.openvpn.net/c/openvpn/+/798/comment/3d0b791f_15e4f6e5 : 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_= label_len with it. Done http://gerrit.openvpn.net/c/openvpn/+/798/comment/0f194e22_472a8009 : 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= is 0 right? [=E2=80=A6] label is supposed to always at least 1 character. I added a check for that. buf_write will still call memcpy with a 0 and at least according to C stand= ard the pointer must still be valid so I wanted to be safe. -- 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: 6 Gerrit-Owner: plaisthos Gerrit-Reviewer: MaxF Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-Attention: MaxF Gerrit-Comment-Date: Sat, 23 Nov 2024 21:04:00 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: plaisthos Comment-In-Reply-To: MaxF Gerrit-MessageType: comment --0m2gt25QJRs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: MaxF, flichtenheld.

View C= hange

3 comments:

    =
  • File src/openvpn/crypto_epoch.h:

    • Patch Set #4, Line 32= :

       *  - salt is always assumed to be zero length (ie not s=
      upported)
      * - IKM (secret) is assumed to be always 32 bytes
      <= /blockquote>

      You are right. [=E2=80=A6]

      Done

  • File src/openvpn/crypto_epoch.c:=

    • Patch Set #5, Line= 89:

          int hkdf_label_len =3D 2 + 5 + 1 + label_len + 1 =
      + context_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_label_len with it.

      Done

    • Patch Set #5= , 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 is 0 right? [=E2=80=A6]

      label is supposed to alw= ays at least 1 character. I added a check for that.

      buf_write will still call memcpy wit= h a 0 and at least according to C standard the pointer must still be valid = so I wanted to be safe.

To view, visit change 798. To = unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff= 620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 6
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: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: MaxF <max@...2606...> =
Gerrit-Comment-Date: Sat, 23 Nov 2024 21:04:00= +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <arne-openvp= n@...1227...>
Comment-In-Reply-To: MaxF <max@...2606...&g= t;
Gerrit-MessageType: comment
--0m2gt25QJRs=--