From: "flichtenheld (Code Review)" Date: Thu, 28 Nov 2024 09:47:14 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, gert@...1296... Message-ID: <150e6e5a29cda7db0f8eca901804b8db34ae787e-EmailReviewComments-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="fjPrUXGko5I="; 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: , To: plaisthos Cc: cron2 , openvpn-devel --fjPrUXGko5I= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, plaisthos. flichtenheld has posted comments on this change. ( http://gerrit.openvpn.ne= t/c/openvpn/+/796?usp=3Demail ) Change subject: Trigger renegotiation of data key if getting close to the A= EAD usage limit ...................................................................... Patch Set 6: Code-Review-1 (8 comments) File src/openvpn/crypto.h: http://gerrit.openvpn.net/c/openvpn/+/796/comment/cd492ae9_fd17bd7c : PS6, Line 603: * number of number of block + packets. Return -1 if ciphern= ame is not an AEAD "blocks" File src/openvpn/crypto.c: http://gerrit.openvpn.net/c/openvpn/+/796/comment/884aa131_043fac76 : PS6, Line 353: * q + s <=3D (p^36 - 1) `2^36` http://gerrit.openvpn.net/c/openvpn/+/796/comment/5487e9b6_1af10abb : PS6, Line 502: /* update number of plaintext blocks decrypted. Use the = x + (n-1)/n trick Should be `(x + (n-1))/n`. The code is correct, but comment is wrong. http://gerrit.openvpn.net/c/openvpn/+/796/comment/38ba5a32_7a3341ec : PS6, Line 503: * to round up the result to the number of blocked used.= */ "blocks" http://gerrit.openvpn.net/c/openvpn/+/796/comment/4cbb5beb_e82ad0e6 : PS6, Line 505: opt->key_ctx_bi.decrypt.plaintext_blocks +=3D (outlen + = (blocksize - 1))/blocksize; So we increase this number before we have done all checks on the packet. Do= esn't that open us up to potential attacks that force renegotiation by repl= aying packets? File src/openvpn/ssl.c: http://gerrit.openvpn.net/c/openvpn/+/796/comment/dc63e5a8_82d0b335 : PS6, Line 144: /* set limit to 7/8 of the limit so the renogiation has = can succeeds before "renegotiation can succeed" ? File src/openvpn/ssl_common.h: http://gerrit.openvpn.net/c/openvpn/+/796/comment/728ac18b_aa309cd4 : PS6, Line 336: /** This limit for AEAD cipher, this is the sum of packe= ts + blocks "This" -> "The"? Or maybe just remove it? File tests/unit_tests/openvpn/test_crypto.c: http://gerrit.openvpn.net/c/openvpn/+/796/comment/fd854db2_f454d881 : PS6, Line 463: int64_t L =3D 101; Please mention or use AEAD_LIMIT_BLOCKSIZE -- 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: 6 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Comment-Date: Thu, 28 Nov 2024 09:47:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment --fjPrUXGko5I= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, plaisthos.

Patch set 6:Code-Review -1=

Vi= ew Change

8 comments:

  • File src/openvpn/crypto.h:

    <= ul style=3D"list-style: none; padding: 0;">
  • Patch Set #6, Line 603:= * number of number of= block + packets. Return -1 if ciphername is not an AEAD

    "blocks"

  • File src/openvpn/crypt= o.c:

    • Patch Set #6, = Line 353: * q= + s <=3D (p^36 - 1)

      `2^36`

    • Patch Set #6, Line 502: /* update number of plaintex= t blocks decrypted. Use the x + (n-1)/n trick

      Should be `(x + (n-1))/n`. The code= is correct, but comment is wrong.

    • Patch Set #6, Line 503:= * to round up the= result to the number of blocked used. */

      "blocks"

    • Pa= tch Set #6, Line 505: = opt->key_ctx_bi.decrypt.plaintext_blocks +=3D (outlen + (blocksize - = 1))/blocksize;

      So we increase this number before we have done all checks on the p= acket. Doesn't that open us up to potential attacks that force renegoti= ation by replaying packets?

  • File src/openvpn/ssl.c:

    • Patch Set #6, Line 144: /* set limit to 7/8 of the limit so the renogiation ha= s can succeeds before

      "renegotiation can succeed" ?

  • <= li style=3D"margin: 0; padding: 0;">

    File src/openvpn/ssl_common.h:

  • Patch Set #6, Line 336:<= /a> /** This limit for = AEAD cipher, this is the sum of packets + blocks

    "This" -> "The= "? Or maybe just remove it?

  • File tests/unit_tests/openvpn/test_crypto.c:

  • 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: 6
    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-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
    Gerrit-Attention: cron2 <gert@...1296...>= ;
    Gerrit-Comment-Date: Thu, 28 Nov 2024 09:47:14= +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment
    --fjPrUXGko5I=--