Correct the return value of cryptoapi RSA signature callbacks
PATCH 1/1 Correct the return value of cryptoapi RSA signature callbacks
From: Selva Nair <[email protected]...>
Fixes the wrong check on siglen instead of *siglen for signing failures.
Bug reported by: lilulo <[email protected]...>
---
2.4 will need a separate patch
src/openvpn/cryptoapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/cryptoapi.c +2 -2
@@ -499,7 +499,7 @@ rsa_sign_CNG(int type, const unsigned char *m, unsigned int m_len, *siglen =priv_enc_CNG (cd, alg, m, (int )m_len, sig,RSA_size (rsa),cng_padding_type (padding),0 ); -return (siglen ==0 ) ?0 :1 ; +return (*siglen ==0 ) ?0 :1 ; }/* decrypt */
@@ -973,7 +973,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, *siglen =priv_enc_CNG (cd, alg, tbs, (int )tbslen, sig, *siglen,cng_padding_type (padding), (DWORD )saltlen); - return (siglen == 0) ? 0 : 1; + return (*siglen == 0) ? 0 : 1; }#endif /* OPENSSL_VERSION >= 1.1.0 */
Signature · 1 line
2.20.1
Quoted 30 lines · On 26-07-19 22:39, [email protected]... wrote:
From: Selva Nair <[email protected]...>
Fixes the wrong check on siglen instead of *siglen for signing failures.
Bug reported by: lilulo <[email protected]...>
Signed-off-by Selva Nair <[email protected]...>---
2.4 will need a separate patch
src/openvpn/cryptoapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)src/openvpn/cryptoapi.c +1
-1@@ -499,7 +499,7 @@ rsa_sign_CNG(int type, const unsigned char *m, unsigned int m_len, *siglen =priv_enc_CNG (cd, alg, m, (int )m_len, sig,RSA_size (rsa),cng_padding_type (padding),0 ); -return (siglen ==0 ) ?0 :1 ; +return (*siglen ==0 ) ?0 :1 ; }/* decrypt */
src/openvpn/cryptoapi.c pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, · line 979
Quoted 8 lines
src/openvpn/cryptoapi.c +1
-1@@ -973,7 +973,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, *siglen =priv_enc_CNG (cd, alg, tbs, (int )tbslen, sig, *siglen,cng_padding_type (padding), (DWORD )saltlen); - return (siglen == 0) ? 0 : 1; + return (*siglen == 0) ? 0 : 1; }#endif /* OPENSSL_VERSION >= 1.1.0 */
Thanks (and thanks for sending the patch for 2.4 right with it)
I have not tested anything, but the patch looks very much "obviously correct".
Your patch has been applied to the master branch.
commit f4ac6b780db2e0c3b60d180bd6545efe30a52059
Author: Selva Nair Date: Fri Jul 26 16:39:17 2019 -0400
Correct the return value of cryptoapi RSA signature callbacks
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg18706.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering