Change in openvpn[master]: Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
A message that is not in the archive (sent off-list or not yet received): gerrit.1712017317000.I911e25949a8647b567fd4178683534d4404ab469@...2715...
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/+/552?usp=email
to review the following change.
Change subject: Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before so this call does not do anything useful
---
M src/openvpn/crypto_openssl.c
1 file changed, 0 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/552/1
src/openvpn/crypto_openssl.c +0 -4
@@ -846,10 +846,6 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - }if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
to look at the new patch set (#2).
Change subject: Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before so this call does not do anything useful.
OpenSSL 1.0.2:
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/evp/evp_enc.c#L94
EVP_CipherInit calls first EVP_CIPHER_CTX_init and then EVP_CipherInit_ex
Our openssl_compat.h has
for these older OpenSSL versions
OpenSSL 3.0:
https://github.com/openssl/openssl/blob/openssl-3.2/crypto/evp/evp_enc.c#L450
basically the same as 1.0.2. Just that method names have been changed.
---
M src/openvpn/crypto_openssl.c
1 file changed, 0 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/552/2
src/openvpn/crypto_openssl.c +0 -4
@@ -846,10 +846,6 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - }if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/552?usp=email )
Change subject: Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Patch Set 2: Code-Review+2
(1 comment)
Patchset:
PS2:
The openssl source is very enlightening and makes it very clear that this is correct.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 02 Apr 2024 12:21:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v2 1/1 Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before so this call does not do anything useful.
OpenSSL 1.0.2:
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/evp/evp_enc.c#L94
EVP_CipherInit calls first EVP_CIPHER_CTX_init and then EVP_CipherInit_ex
Our openssl_compat.h has
for these older OpenSSL versions
OpenSSL 3.0:
https://github.com/openssl/openssl/blob/openssl-3.2/crypto/evp/evp_enc.c#L450
basically the same as 1.0.2. Just that method names have been changed.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/552
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/crypto_openssl.c +0 -4
@@ -846,10 +846,6 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - }if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" );
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/552?usp=email )
Change subject: Remove redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
Patchset:
PS2:
withdrawing the +2 for the time being - it causes failures in ssl_testdriver (and possibly others) now, on some platforms
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 02 Apr 2024 12:47:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[Openvpn-devel] [XS] Change in openvpn[master]: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
In reply to a message not in the archiveAttention is currently required from: cron2, flichtenheld, plaisthos.
Hello cron2, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before. Also ensure that EVP_CipherInit_Ex gets the cipher to actually be able to initialise the context.
OpenSSL 1.0.2:
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/evp/evp_enc.c#L94
EVP_CipherInit calls first EVP_CIPHER_CTX_init and then EVP_CipherInit_ex
Our openssl_compat.h has
for these older OpenSSL versions
OpenSSL 3.0:
https://github.com/openssl/openssl/blob/openssl-3.2/crypto/evp/evp_enc.c#L450
basically the same as 1.0.2. Just that method names have been changed.
---
M src/openvpn/crypto_openssl.c
1 file changed, 1 insertion(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/552/3
src/openvpn/crypto_openssl.c +1 -5
@@ -846,11 +846,7 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - } -if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) +if (!EVP_CipherInit_ex (ctx, kt,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
[Openvpn-devel] [XS] Change in openvpn[master]: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
In reply to a message not in the archiveAttention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/552?usp=email )
Change subject: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Patch Set 3: Code-Review+2
(1 comment)
Patchset:
PS3:
now all tests pass
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 02 Apr 2024 13:48:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v3 1/1 Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before. Also ensure that EVP_CipherInit_Ex gets the cipher to actually be able to initialise the context.
OpenSSL 1.0.2:
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/evp/evp_enc.c#L94
EVP_CipherInit calls first EVP_CIPHER_CTX_init and then EVP_CipherInit_ex
Our openssl_compat.h has
for these older OpenSSL versions
OpenSSL 3.0:
https://github.com/openssl/openssl/blob/openssl-3.2/crypto/evp/evp_enc.c#L450
basically the same as 1.0.2. Just that method names have been changed.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/552
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/crypto_openssl.c +1 -5
@@ -846,11 +846,7 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - } -if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) +if (!EVP_CipherInit_ex (ctx, kt,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" ); }
[Openvpn-devel] [PATCH applied] Re: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
Looking at the OpenSSL implementation for the EVP_CipherInit*() functions makes it really clear that this is, basically, dead code. Of course the "kt" init needs to go to the second call now, because otherwise it will bomb with OpenSSL 3.x ("no default cipher").
Tested with various OpenSSL (and LibreSSL) versions across the buildbot and GHA test bed.
Your patch has been applied to the master branch.
(Not applied to release/2.6 since it's not actually fixing something, just cleaning up old code - typical "master" material)
commit e81e3eb1a4322148b06f353eaa22b0a803fd74f4
Author: Arne Schwabe Date: Tue Apr 2 15:49:09 2024 +0200
Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28523.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [XS] Change in openvpn[master]: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
In reply to a message not in the archivecron2 has uploaded a new patch set (#4) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/552?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before. Also ensure that EVP_CipherInit_Ex gets the cipher to actually be able to initialise the context.
OpenSSL 1.0.2:
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/evp/evp_enc.c#L94
EVP_CipherInit calls first EVP_CIPHER_CTX_init and then EVP_CipherInit_ex
Our openssl_compat.h has
for these older OpenSSL versions
OpenSSL 3.0:
https://github.com/openssl/openssl/blob/openssl-3.2/crypto/evp/evp_enc.c#L450
basically the same as 1.0.2. Just that method names have been changed.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28523.html
---
M src/openvpn/crypto_openssl.c
1 file changed, 1 insertion(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/552/4
src/openvpn/crypto_openssl.c +1 -5
@@ -846,11 +846,7 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - } -if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) +if (!EVP_CipherInit_ex (ctx, kt,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
[Openvpn-devel] [XS] Change in openvpn[master]: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
In reply to a message not in the archivecron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/552?usp=email )
Change subject: Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
......................................................................
Remove/combine redundant call of EVP_CipherInit before EVP_CipherInit_Ex
EVP_CipherInit basically is the same EVP_CipherInit_ex except that it in some instances it resets/inits the ctx parameter first. We already call EVP_CIPHER_CTX_reset to reset/init the ctx before. Also ensure that EVP_CipherInit_Ex gets the cipher to actually be able to initialise the context.
OpenSSL 1.0.2:
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/evp/evp_enc.c#L94
EVP_CipherInit calls first EVP_CIPHER_CTX_init and then EVP_CipherInit_ex
Our openssl_compat.h has
for these older OpenSSL versions
OpenSSL 3.0:
https://github.com/openssl/openssl/blob/openssl-3.2/crypto/evp/evp_enc.c#L450
basically the same as 1.0.2. Just that method names have been changed.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28523.html
---
M src/openvpn/crypto_openssl.c
1 file changed, 1 insertion(+), 5 deletions(-)
src/openvpn/crypto_openssl.c +1 -5
@@ -846,11 +846,7 @@evp_cipher_type *kt =cipher_get (ciphername);EVP_CIPHER_CTX_reset (ctx); -if (!EVP_CipherInit (ctx, kt,NULL ,NULL , enc)) - { -crypto_msg (M_FATAL ,"EVP cipher init #1" ); - } -if (!EVP_CipherInit_ex (ctx,NULL ,NULL , key,NULL , enc)) +if (!EVP_CipherInit_ex (ctx, kt,NULL , key,NULL , enc)) {crypto_msg (M_FATAL ,"EVP cipher init #2" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/552?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I911e25949a8647b567fd4178683534d4404ab469
Gerrit-Change-Number: 552
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged