From: "plaisthos (Code Review)" Date: Thu, 12 Dec 2024 15:49:22 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., steffan@...1856..., max@...2606..., gert@...1296... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="2D0CL752Izc="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Trigger renegotiation of data key if getting close to the AEAD usage ... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syzzer , MaxF , flichtenheld , cron2 , openvpn-devel --2D0CL752Izc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: MaxF, cron2, flichtenheld, syzzer. plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c= /openvpn/+/796?usp=3Demail ) Change subject: Trigger renegotiation of data key if getting close to the A= EAD usage limit ...................................................................... Patch Set 13: (5 comments) File src/openvpn/ssl.c: http://gerrit.openvpn.net/c/openvpn/+/796/comment/c237d8e4_41a211f7 : PS10, Line 134: static int64_t : tls_get_limit_aead(const char *ciphername) : { : int64_t limit =3D cipher_get_aead_limits(ciphername); : : if (limit =3D=3D 0) : { : return 0; : } : : /* set limit to 7/8 of the limit so the renogiation can= succeed before : * we go over the limit */ : limit =3D limit * 7/8; : : msg(D_SHOW_KEYS, "Note: AEAD cipher %s will be limited = to a sum of %" : PRIi64 " for block and packets before renegotiation= ", : ciphername, limit); : return limit; : } > This function could return uint Done File src/openvpn/ssl.c: http://gerrit.openvpn.net/c/openvpn/+/796/comment/9c45c755_8086e09c : PS12, Line 144: /* set limit to 7/8 of the limit so the renogiation can= succeed before > renegotiation Done http://gerrit.openvpn.net/c/openvpn/+/796/comment/ee3d97c9_67c4d1c6 : PS12, Line 146: limit =3D limit * 7/8; > Consider adding overflow checks. [=E2=80=A6] I changed the order to /8 * 7 which does not have the overflow problem and = I think if we now off by a few packets because of the lower precision that = is not doing much in the grand scheme. http://gerrit.openvpn.net/c/openvpn/+/796/comment/2ddba798_2401cb2d : PS12, Line 149: PRIi64 " for block and packets before renegotiation= ", > This suggests a hard limit, but it's a soft limit we can (and typically w= ill) exceed. [=E2=80=A6] The hard limit of 2**32-1 is still there. The higher pid limit only comes w= ith the epoch patches and those actually have this as as a hard limit. I think implementing a hard limit for this feature is not so important, so = I changed the message to indicate that there will be a renegotiation. http://gerrit.openvpn.net/c/openvpn/+/796/comment/55c0c5e2_32a406f5 : PS12, Line 3027: || aead_usage_limit_reached(usage_limit, &key_ctx_= bi->decrypt, > This is a safety precaution? The sending party is ultimately responsible = for not exceeding the limit [=E2=80=A6] My thinking was that this code will most certainly only be in use when only= one side is aware of the limitation. Since if both sides are aware, then b= oth sides will probably also switch to use epoch data channel instead, whic= h only the sender checks. I will add a comment to indicate this as well. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/796?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: I057f007577f10c6ac917ee4620ee3d2559187dc7 Gerrit-Change-Number: 796 Gerrit-PatchSet: 13 Gerrit-Owner: plaisthos Gerrit-Reviewer: MaxF Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: syzzer Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: syzzer Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: MaxF Gerrit-Comment-Date: Thu, 12 Dec 2024 15:49:22 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: syzzer Comment-In-Reply-To: MaxF Gerrit-MessageType: comment --2D0CL752Izc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: MaxF, cron2, flichtenheld, syzzer= .

View C= hange

5 comments:

    =
  • File src/openvpn/ssl.c:

    • Patch Set #10, Line 134: <= /p>

      static int64_t
      tls_get_limit_aead(const char *ciphername){
      int64_t limit =3D cipher_get_aead_limits(ciphername);

      = if (limit =3D=3D 0)
      {
      return 0;
      }

      /* se= t limit to 7/8 of the limit so the renogiation can succeed before
      *= we go over the limit */
      limit =3D limit * 7/8;

      msg(D_SHO= W_KEYS, "Note: AEAD cipher %s will be limited to a sum of %"
      = PRIi64 " for block and packets before renegotiation",
      = ciphername, limit);
      return limit;
      }
      =

      This function could return uint

      Done

  • File src/openvpn/ssl.c:

    • Patch Set #12, Line 144: /* set limit to 7/8 of the l= imit so the renogiation can succeed before

      renegoti= ation

      Done

    • Patch Set #12, Line 146: limit =3D limit * 7/8;

      Consider adding overflow checks. [=E2=80=A6]

      I changed the order to /= 8 * 7 which does not have the overflow problem and I think if we now off by= a few packets because of the lower precision that is not doing much in the= grand scheme.

    • Patch Set #12, Line 149: PRIi64 " for block and packe= ts before renegotiation",

      This suggests a hard l= imit, but it's a soft limit we can (and typically will) exceed. [=E2=80= =A6]

      The hard limit of 2**32-1 is still there. The higher pid limit only co= mes with the epoch patches and those actually have this as as a hard limit.=

      I think impl= ementing a hard limit for this feature is not so important, so I changed th= e message to indicate that there will be a renegotiation.

    • = Patch Set #12, Line 3027: || aead_usage_limit_reached(usage_limit, &key_ctx_bi->dec= rypt,

      This is a safety precaution? The sending party = is ultimately responsible for not exceeding the limit [=E2=80=A6]

      My thinki= ng was that this code will most certainly only be in use when only one side= is aware of the limitation. Since if both sides are aware, then both sides= will probably also switch to use epoch data channel instead, which only th= e sender checks.

      I will add a comment to indicate this as well.

<= p>To view, visit change 796. To unsubscribe, or for help writing mail filters,= visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I057f007577f10c6ac917ee4620e= e3d2559187dc7
Gerrit-Change-Number: 796
Gerrit-PatchSet: 13
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: MaxF <max@...2606...> <= /div>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: syzzer <steffan@...1856...= >
Gerrit-CC: cron2 <gert@...1296...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: syzzer <steffan@...2115...= .>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: MaxF <max@...2606...> =
Gerrit-Comment-Date: Thu, 12 Dec 2024 15:49:22= +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: syzzer <steffan@...1852...= 6...>
Comment-In-Reply-To: MaxF <max@...2606...&g= t;
Gerrit-MessageType: comment
--2D0CL752Izc=--