[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Do not underestimate number of encrypted/decrypted AEAD blocks Even though the current code typically counts all the encrypted/decrypted traffic, this is only the case because of the specific implementation of OpenSSL at the moment. Instead of counting the length returned by one call only, count all the encrypted/decrypted bytes. Other implementations that use AES-GCM (like IPSec, MacSEC, TLS 1.2) (currently) do not honour these usage limits at all. This is the reason that I also currently do not consider the lack/improper validation in our code to be a security vulnerability. In the current state implementations/protocol that lack this feature altogether are not considered vulnerable. Reported by: Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1358 Message-Id: <[email protected]> Signed-off-by: Gert Doering --- M src/openvpn/crypto.c 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 307d1ee..8049b3a 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -152,15 +152,15 @@ ASSERT(cipher_ctx_update(ctx->cipher, BEND(&work), &outlen, BPTR(buf), BLEN(buf))); ASSERT(buf_inc_len(&work, outlen)); -/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick - * to round up the result to the number of blocks used */ -const int blocksize = AEAD_LIMIT_BLOCKSIZE; -opt->key_ctx_bi.encrypt.plaintext_blocks += (outlen + (blocksize - 1)) / blocksize; - /* Flush the encryption buffer */ ASSERT(cipher_ctx_final(ctx->cipher, BEND(&work), &outlen)); ASSERT(buf_inc_len(&work, outlen)); +/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick + * to round up the result to the number of blocks used */ +const int blocksize = AEAD_LIMIT_BLOCKSIZE; +opt->key_ctx_bi.encrypt.plaintext_blocks += (BLEN(&work) + (blocksize - 1)) / blocksize; + /* if the tag is at end the end, allocate it now */ if (use_epoch_data_format) { @@ -580,11 +580,10 @@ goto error_exit; } - /* update number of plaintext blocks decrypted. Use the (x + (n-1))/n trick * to round up the result to the number of blocks used. */ const int blocksize = AEAD_LIMIT_BLOCKSIZE; -opt->key_ctx_bi.decrypt.plaintext_blocks += (outlen + (blocksize - 1)) / blocksize; +opt->key_ctx_bi.decrypt.plaintext_blocks += (BLEN(&work) + (blocksize - 1)) / blocksize; *buf = work; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 4 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
cron2 has uploaded a new patch set (#4) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Do not underestimate number of encrypted/decrypted AEAD blocks Even though the current code typically counts all the encrypted/decrypted traffic, this is only the case because of the specific implementation of OpenSSL at the moment. Instead of counting the length returned by one call only, count all the encrypted/decrypted bytes. Other implementations that use AES-GCM (like IPSec, MacSEC, TLS 1.2) (currently) do not honour these usage limits at all. This is the reason that I also currently do not consider the lack/improper validation in our code to be a security vulnerability. In the current state implementations/protocol that lack this feature altogether are not considered vulnerable. Reported by: Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1358 Message-Id: <[email protected]> Signed-off-by: Gert Doering --- M src/openvpn/crypto.c 1 file changed, 6 insertions(+), 7 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1358/4 diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 307d1ee..8049b3a 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -152,15 +152,15 @@ ASSERT(cipher_ctx_update(ctx->cipher, BEND(&work), &outlen, BPTR(buf), BLEN(buf))); ASSERT(buf_inc_len(&work, outlen)); -/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick - * to round up the result to the number of blocks used */ -const int blocksize = AEAD_LIMIT_BLOCKSIZE; -opt->key_ctx_bi.encrypt.plaintext_blocks += (outlen + (blocksize - 1)) / blocksize; - /* Flush the encryption buffer */ ASSERT(cipher_ctx_final(ctx->cipher, BEND(&work), &outlen)); ASSERT(buf_inc_len(&work, outlen)); +/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick + * to round up the result to the number of blocks used */ +const int blocksize = AEAD_LIMIT_BLOCKSIZE; +opt->key_ctx_bi.encrypt.plaintext_blocks += (BLEN(&work) + (blocksize - 1)) / blocksize; + /* if the tag is at end the end, allocate it now */ if (use_epoch_data_format) { @@ -580,11 +580,10 @@ goto error_exit; } - /* update number of plaintext blocks decrypted. Use the (x + (n-1))/n trick * to round up the result to the number of blocks used. */ const int blocksize = AEAD_LIMIT_BLOCKSIZE; -opt->key_ctx_bi.decrypt.plaintext_blocks += (outlen + (blocksize - 1)) / blocksize; +opt->key_ctx_bi.decrypt.plaintext_blocks += (BLEN(&work) + (blocksize - 1)) / blocksize; *buf = work; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 4 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: flichtenheld, plaisthos. cron2 has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Patch Set 3: Code-Review+2 -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Wed, 12 Nov 2025 11:21:17 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: flichtenheld. plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Patch Set 2: (3 comments) Commit Message: http://gerrit.openvpn.net/c/openvpn/+/1358/comment/0812d9e2_08140794?usp=email : PS2, Line 17: do not honour these usage limits at all. So this currently not something > "this is" Done http://gerrit.openvpn.net/c/openvpn/+/1358/comment/5e7d9c19_4de9b80f?usp=email : PS2, Line 18: that I consider to be security vulnerability. In the current state > "a security vulnerability" Done http://gerrit.openvpn.net/c/openvpn/+/1358/comment/b5d24397_2efc8cfc?usp=email : PS2, Line 19: implementations/protocol that lack this feature all together are also > "altogether" Done -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Mon, 10 Nov 2025 11:11:14 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: flichtenheld ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks
..
Do not underestimate number of encrypted/decrypted AEAD blocks
Even though the current code typically counts all the encrypted/decrypted
traffic, this is only the case because of the specific implementation
of OpenSSL at the moment.
Instead of counting the length returned by one call only, count all
the encrypted/decrypted bytes.
Other implementations that use AES-GCM (like IPSec, MacSEC, TLS 1.2)
(currently) do not honour these usage limits at all. This is the reason that
I also currently do not consider the lack/improper validation in our code
to be a security vulnerability. In the current state implementations/protocol
that lack this feature altogether are not considered vulnerable.
Reported by:
Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Signed-off-by: Arne Schwabe
---
M src/openvpn/crypto.c
1 file changed, 6 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1358/3
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 307d1ee..8049b3a 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -152,15 +152,15 @@
ASSERT(cipher_ctx_update(ctx->cipher, BEND(&work), &outlen, BPTR(buf),
BLEN(buf)));
ASSERT(buf_inc_len(&work, outlen));
-/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick
- * to round up the result to the number of blocks used */
-const int blocksize = AEAD_LIMIT_BLOCKSIZE;
-opt->key_ctx_bi.encrypt.plaintext_blocks += (outlen + (blocksize - 1)) /
blocksize;
-
/* Flush the encryption buffer */
ASSERT(cipher_ctx_final(ctx->cipher, BEND(&work), &outlen));
ASSERT(buf_inc_len(&work, outlen));
+/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick
+ * to round up the result to the number of blocks used */
+const int blocksize = AEAD_LIMIT_BLOCKSIZE;
+opt->key_ctx_bi.encrypt.plaintext_blocks += (BLEN(&work) + (blocksize -
1)) / blocksize;
+
/* if the tag is at end the end, allocate it now */
if (use_epoch_data_format)
{
@@ -580,11 +580,10 @@
goto error_exit;
}
-
/* update number of plaintext blocks decrypted. Use the (x + (n-1))/n trick
* to round up the result to the number of blocks used. */
const int blocksize = AEAD_LIMIT_BLOCKSIZE;
-opt->key_ctx_bi.decrypt.plaintext_blocks += (outlen + (blocksize - 1)) /
blocksize;
+opt->key_ctx_bi.decrypt.plaintext_blocks += (BLEN(&work) + (blocksize -
1)) / blocksize;
*buf = work;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Gerrit-Change-Number: 1358
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos
Gerrit-Reviewer: flichtenheld
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
___
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: plaisthos. flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Patch Set 2: Code-Review-1 (3 comments) Commit Message: http://gerrit.openvpn.net/c/openvpn/+/1358/comment/09bd77c7_4735a9a9?usp=email : PS2, Line 17: do not honour these usage limits at all. So this currently not something "this is" http://gerrit.openvpn.net/c/openvpn/+/1358/comment/7ee7fb5b_664c0294?usp=email : PS2, Line 18: that I consider to be security vulnerability. In the current state "a security vulnerability" http://gerrit.openvpn.net/c/openvpn/+/1358/comment/82e17f8a_521e59c5?usp=email : PS2, Line 19: implementations/protocol that lack this feature all together are also "altogether" -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Fri, 07 Nov 2025 14:34:19 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: flichtenheld. plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Patch Set 1: (3 comments) Commit Message: http://gerrit.openvpn.net/c/openvpn/+/1358/comment/4e5730c1_4e0377f5?usp=email : PS1, Line 9: Even thought the current code typically counts all the encrypted/decrypted > "though" Done http://gerrit.openvpn.net/c/openvpn/+/1358/comment/1d3f5c6b_16348d97?usp=email : PS1, Line 16: Other implementations that AES-GCM (like IPSec, MacSEC, TLS 1.2) currently > "that use" ? Done http://gerrit.openvpn.net/c/openvpn/+/1358/comment/fb7f9781_43ee9b19?usp=email : PS1, Line 17: do not honour these usage limits at all. So this currently not something > That whole last sentence is difficult to parse, mostly because of > redundancies. […] Done -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Fri, 07 Nov 2025 14:30:22 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: flichtenheld ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks
..
Do not underestimate number of encrypted/decrypted AEAD blocks
Even though the current code typically counts all the encrypted/decrypted
traffic, this is only the case because of the specific implementation
of OpenSSL at the moment.
Instead of counting the length returned by one call only, count all
the encrypted/decrypted bytes.
Other implementations that use AES-GCM (like IPSec, MacSEC, TLS 1.2) currently
do not honour these usage limits at all. So this currently not something
that I consider to be security vulnerability. In the current state
implementations/protocol that lack this feature all together are also
not considered vulnerable.
Reported by:
Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Signed-off-by: Arne Schwabe
---
M src/openvpn/crypto.c
1 file changed, 6 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1358/2
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 307d1ee..8049b3a 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -152,15 +152,15 @@
ASSERT(cipher_ctx_update(ctx->cipher, BEND(&work), &outlen, BPTR(buf),
BLEN(buf)));
ASSERT(buf_inc_len(&work, outlen));
-/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick
- * to round up the result to the number of blocks used */
-const int blocksize = AEAD_LIMIT_BLOCKSIZE;
-opt->key_ctx_bi.encrypt.plaintext_blocks += (outlen + (blocksize - 1)) /
blocksize;
-
/* Flush the encryption buffer */
ASSERT(cipher_ctx_final(ctx->cipher, BEND(&work), &outlen));
ASSERT(buf_inc_len(&work, outlen));
+/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick
+ * to round up the result to the number of blocks used */
+const int blocksize = AEAD_LIMIT_BLOCKSIZE;
+opt->key_ctx_bi.encrypt.plaintext_blocks += (BLEN(&work) + (blocksize -
1)) / blocksize;
+
/* if the tag is at end the end, allocate it now */
if (use_epoch_data_format)
{
@@ -580,11 +580,10 @@
goto error_exit;
}
-
/* update number of plaintext blocks decrypted. Use the (x + (n-1))/n trick
* to round up the result to the number of blocks used. */
const int blocksize = AEAD_LIMIT_BLOCKSIZE;
-opt->key_ctx_bi.decrypt.plaintext_blocks += (outlen + (blocksize - 1)) /
blocksize;
+opt->key_ctx_bi.decrypt.plaintext_blocks += (BLEN(&work) + (blocksize -
1)) / blocksize;
*buf = work;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Gerrit-Change-Number: 1358
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos
Gerrit-Reviewer: flichtenheld
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
___
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: plaisthos. flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email ) Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks .. Patch Set 1: Code-Review-1 (3 comments) Commit Message: http://gerrit.openvpn.net/c/openvpn/+/1358/comment/a141389a_c2889698?usp=email : PS1, Line 9: Even thought the current code typically counts all the encrypted/decrypted "though" http://gerrit.openvpn.net/c/openvpn/+/1358/comment/cd75af22_24654220?usp=email : PS1, Line 16: Other implementations that AES-GCM (like IPSec, MacSEC, TLS 1.2) currently "that use" ? http://gerrit.openvpn.net/c/openvpn/+/1358/comment/2ce4762d_48224900?usp=email : PS1, Line 17: do not honour these usage limits at all. So this currently not something That whole last sentence is difficult to parse, mostly because of redundancies. Maybe something like: "So the absence of usage limit enforcement is not currently considered a security vulnerability, yet." -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053 Gerrit-Change-Number: 1358 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Fri, 07 Nov 2025 12:59:15 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes ___ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Do not underestimate number of encrypted/decrypted AEAD blocks
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email
to review the following change.
Change subject: Do not underestimate number of encrypted/decrypted AEAD blocks
..
Do not underestimate number of encrypted/decrypted AEAD blocks
Even thought the current code typically counts all the encrypted/decrypted
traffic, this is only the case because of the specific implementation
of OpenSSL at the moment.
Instead of counting the length returned by one call only, count all
the encrypted/decrypted bytes.
Other implementations that AES-GCM (like IPSec, MacSEC, TLS 1.2) currently
do not honour these usage limits at all. So this currently not something
that I consider to be security vulnerability since currently this something
that enhances security but is not yet required so to say.
Reported by:
Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Signed-off-by: Arne Schwabe
---
M src/openvpn/crypto.c
1 file changed, 6 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1358/1
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 307d1ee..8049b3a 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -152,15 +152,15 @@
ASSERT(cipher_ctx_update(ctx->cipher, BEND(&work), &outlen, BPTR(buf),
BLEN(buf)));
ASSERT(buf_inc_len(&work, outlen));
-/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick
- * to round up the result to the number of blocks used */
-const int blocksize = AEAD_LIMIT_BLOCKSIZE;
-opt->key_ctx_bi.encrypt.plaintext_blocks += (outlen + (blocksize - 1)) /
blocksize;
-
/* Flush the encryption buffer */
ASSERT(cipher_ctx_final(ctx->cipher, BEND(&work), &outlen));
ASSERT(buf_inc_len(&work, outlen));
+/* update number of plaintext blocks encrypted. Use the (x + (n-1))/n trick
+ * to round up the result to the number of blocks used */
+const int blocksize = AEAD_LIMIT_BLOCKSIZE;
+opt->key_ctx_bi.encrypt.plaintext_blocks += (BLEN(&work) + (blocksize -
1)) / blocksize;
+
/* if the tag is at end the end, allocate it now */
if (use_epoch_data_format)
{
@@ -580,11 +580,10 @@
goto error_exit;
}
-
/* update number of plaintext blocks decrypted. Use the (x + (n-1))/n trick
* to round up the result to the number of blocks used. */
const int blocksize = AEAD_LIMIT_BLOCKSIZE;
-opt->key_ctx_bi.decrypt.plaintext_blocks += (outlen + (blocksize - 1)) /
blocksize;
+opt->key_ctx_bi.decrypt.plaintext_blocks += (BLEN(&work) + (blocksize -
1)) / blocksize;
*buf = work;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1358?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Gerrit-Change-Number: 1358
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos
Gerrit-Reviewer: flichtenheld
Gerrit-CC: openvpn-devel
Gerrit-Attention: flichtenheld
___
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
