From: Selva Nair Date: Thu, 7 Jul 2022 03:51:51 +0000 (-0400) Subject: Fix crash in xkey-provider in msvc builds X-Git-Tag: v2.6_beta1~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b2e4d0ad5c3a309af8425be8e6e605975fb2a43;p=thirdparty%2Fopenvpn.git Fix crash in xkey-provider in msvc builds The function signature for xkey_load_generic_key had function pointers defined as function types that seems to work in gcc but not in msvc. Fix it by changing the function signatures to what was intended. Also revert part of commit 627d1a3d28638... as that workaround should be no longer required. Reported by: Lev Stipakov https://github.com/lstipakov Signed-off-by: Selva Nair Acked-by: Arne Schwabe Message-Id: <20220707035151.25469-1-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24664.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/xkey_common.h b/src/openvpn/xkey_common.h index e0e5ed5b2..6d6a1e2c3 100644 --- a/src/openvpn/xkey_common.h +++ b/src/openvpn/xkey_common.h @@ -152,7 +152,7 @@ xkey_digest(const unsigned char *src, size_t srclen, unsigned char *buf, */ EVP_PKEY * xkey_load_generic_key(OSSL_LIB_CTX *libctx, void *handle, EVP_PKEY *pubkey, - XKEY_EXTERNAL_SIGN_fn sign_op, XKEY_PRIVKEY_FREE_fn free_op); + XKEY_EXTERNAL_SIGN_fn *sign_op, XKEY_PRIVKEY_FREE_fn *free_op); extern OSSL_LIB_CTX *tls_libctx; /* Global */ diff --git a/src/openvpn/xkey_helper.c b/src/openvpn/xkey_helper.c index 287f9df8b..81dd71dc0 100644 --- a/src/openvpn/xkey_helper.c +++ b/src/openvpn/xkey_helper.c @@ -115,7 +115,7 @@ xkey_load_management_key(OSSL_LIB_CTX *libctx, EVP_PKEY *pubkey) */ EVP_PKEY * xkey_load_generic_key(OSSL_LIB_CTX *libctx, void *handle, EVP_PKEY *pubkey, - XKEY_EXTERNAL_SIGN_fn sign_op, XKEY_PRIVKEY_FREE_fn free_op) + XKEY_EXTERNAL_SIGN_fn *sign_op, XKEY_PRIVKEY_FREE_fn *free_op) { EVP_PKEY *pkey = NULL; const char *origin = "external"; @@ -125,8 +125,8 @@ xkey_load_generic_key(OSSL_LIB_CTX *libctx, void *handle, EVP_PKEY *pubkey, {"xkey-origin", OSSL_PARAM_UTF8_STRING, (char *) origin, 0, 0}, {"pubkey", OSSL_PARAM_OCTET_STRING, &pubkey, sizeof(pubkey), 0}, {"handle", OSSL_PARAM_OCTET_PTR, &handle, sizeof(handle), 0}, - {"sign_op", OSSL_PARAM_OCTET_PTR, (void **) &sign_op, sizeof(void *), 0}, - {"free_op", OSSL_PARAM_OCTET_PTR, (void **) &free_op, sizeof(void *), 0}, + {"sign_op", OSSL_PARAM_OCTET_PTR, (void **) &sign_op, sizeof(sign_op), 0}, + {"free_op", OSSL_PARAM_OCTET_PTR, (void **) &free_op, sizeof(free_op), 0}, {NULL, 0, NULL, 0, 0} };