From: "plaisthos (Code Review)" Date: Wed, 13 Nov 2024 12:49:21 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., gert@...1296..., a@...2181... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="oB3Na14Q+Os="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Use XOR instead of concatenation for calculation of IV from implicit IV List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cron2 , flichtenheld , openvpn-devel --oB3Na14Q+Os= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld, ordex. plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c= /openvpn/+/797?usp=3Demail ) Change subject: Use XOR instead of concatenation for calculation of IV fro= m implicit IV ...................................................................... Patch Set 2: (9 comments) Commit Message: http://gerrit.openvpn.net/c/openvpn/+/797/comment/59bcb58e_1dd37b5e : PS2, Line 12: IV generation code later. > Question: what is the advantage or XOR'ing the IV with the packet ID? And= why is the implicit IV gro [=E2=80=A6] The implicit IV is growing from 64 bit to 96 bits. The whole IV is 96 bits = and with Data v2 we use 32 bit packet id || implicit_iv to form the IV. File src/openvpn/crypto.h: http://gerrit.openvpn.net/c/openvpn/+/797/comment/141bbf3c_5381bd8d : PS2, Line 168: size_t implicit_iv_len; /**< The length of implicit_= iv */ > why is the len being removed? What is the underlying assumption allowing = us to drop the len? [=E2=80=A6] The underlying assumption is that implicit IV is always xored to generate t= he IV. So implicit IV len is always the same length as the length of the IV. http://gerrit.openvpn.net/c/openvpn/+/797/comment/cc89468e_4b046e53 : PS2, Line 173: uint8_t implicit_iv[OPENVPN_MAX_IV_LENGTH]; > I believe I understand the comment above, but I have troubles combining i= t with OPENVPN_MAX_IV_LENGT [=E2=80=A6] Yes, we only fill as many bytes as the size of the IV of the cipher we are = using. File src/openvpn/crypto.c: http://gerrit.openvpn.net/c/openvpn/+/797/comment/d33cecd7_d179dad1 : PS2, Line 102: * XOR of packet and implicit IV */ > This comment doesn't fully compile. [=E2=80=A6] Done http://gerrit.openvpn.net/c/openvpn/+/797/comment/23e39761_6d3a4ea0 : PS2, Line 445: * XOR of packet counter and implicit IV */ > same comment as before Done File src/openvpn/dco_freebsd.c: http://gerrit.openvpn.net/c/openvpn/+/797/comment/dc522f44_9fe63698 : PS2, Line 398: /* FreeBSD uses the contact operation, need to skip = the first 4 null > concat? Acknowledged File src/openvpn/dco_linux.c: http://gerrit.openvpn.net/c/openvpn/+/797/comment/e2a5f44c_31248b37 : PS2, Line 588: /* First 4 zero bytes as the kernel does concat inst= ead of XOR */ > "skip" first 4 zero bytes? Done http://gerrit.openvpn.net/c/openvpn/+/797/comment/a7e16baf_72713641 : PS2, Line 599: /* First 4 zero bytes as the kernel does concat inst= ead of XOR */ > as above Done File src/openvpn/dco_win.c: http://gerrit.openvpn.net/c/openvpn/+/797/comment/9c728a26_c4af20b0 : PS2, Line 317: /* First 4 zero bytes as ovpn-dco-win does concat instea= d of XOR */ > same comment as for Linux DCO, but no +4 here? confusing Yeah looks that I only tested windows. Since all of them directly get the k= eys from the key2 structure, the patch does not interact with that. Will re= move it from all platforms in the fixed version. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/797?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: I74216d776d3e0a8dc987ec7b1671c8e8dcccdbd6 Gerrit-Change-Number: 797 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-CC: ordex Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: ordex Gerrit-Comment-Date: Wed, 13 Nov 2024 12:49:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: cron2 Comment-In-Reply-To: ordex Gerrit-MessageType: comment --oB3Na14Q+Os= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, flichtenheld, ordex.

View C= hange

9 comments:

    =
  • Commit Message:

    • <= p style=3D"margin-bottom: 4px;">Patch Set #2, Line 12: IV generation code later.

      Question: what is the advantage or XOR'ing the IV with the pa= cket ID? And why is the implicit IV gro [=E2=80=A6]

      The implicit IV is grow= ing from 64 bit to 96 bits. The whole IV is 96 bits and with Data v2 we use= 32 bit packet id || implicit_iv to form the IV.

  • File src/openvpn/crypto.h:

    • Patch Set #2, Line 168: size_t implicit_iv_len; /*= *< The length of implicit_iv */

      why is the len bei= ng removed? What is the underlying assumption allowing us to drop the len? = [=E2=80=A6]

      The underlying assumption is that implicit IV is always xored t= o generate the IV. So implicit IV len is always the same length as the leng= th of the IV.

    • Patch Set #2, Line 173: uint8_t implicit_iv[OPENVPN_MAX_IV_LENG= TH];

      I believe I understand the comment above, but I = have troubles combining it with OPENVPN_MAX_IV_LENGT [=E2=80=A6]

      Yes, we on= ly fill as many bytes as the size of the IV of the cipher we are using.

      =
  • File src/openvpn/cry= pto.c:

    • Patch Set #2= , Line 102: * = XOR of packet and implicit IV */

      This comment doesn&#= 39;t fully compile. [=E2=80=A6]

      Done

    • Patch Set #2, Line 44= 5: * XOR of pa= cket counter and implicit IV */

      same comment as befor= e

      File src/o= penvpn/dco_freebsd.c:

      • Patch Set #2, Line 398: /* FreeBSD uses the contact operation, need to skip the first 4= null

        concat?

        Acknowledged

    • File src/openvpn/dco_linux.c:

    • File = src/openvpn/dco_win.c:

    • <= /ul>

      To view, visit change 797. To unsubscribe, or for help writing mail filte= rs, visit settings.

      <= div itemscope itemtype=3D"http://schema.org/EmailMessage">
      Gerrit-Project: openvpn
      Gerrit-Branch: master
      Gerrit-Change-Id: I74216d776d3e0a8dc987ec7b167= 1c8e8dcccdbd6
      Gerrit-Change-Number: 797
      Gerrit-PatchSet: 2
      Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
      Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
      Gerrit-CC: cron2 <gert@...1296...>
      Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
      Gerrit-CC: ordex <a@...2181...>
      Gerrit-Attention: cron2 <gert@...1296...>= ;
      Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
      Gerrit-Attention: ordex <a@...2181...> <= /div>
      Gerrit-Comment-Date: Wed, 13 Nov 2024 12:49:21= +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: cron2 <gert@...1296...= >
      Comment-In-Reply-To: ordex <a@...2181...>= ;
      Gerrit-MessageType: comment
      --oB3Na14Q+Os=--