Skip to content

Commit bb82009

Browse files
Copilotchipitsine
andcommitted
Guard ENGINE-specific code in gost_lcl.h for OpenSSL 4.x compatibility
- Wrap ENGINE header include with #ifndef OPENSSL_NO_ENGINE - Guard ENGINE_CMD_BASE macros with conditional compilation - Protect ENGINE function declarations - Allows provider code to compile without Engine API Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com>
1 parent f543b49 commit bb82009

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

gost_lcl.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# include <openssl/evp.h>
1616
# include <openssl/asn1t.h>
1717
# include <openssl/x509.h>
18-
# include <openssl/engine.h>
18+
# ifndef OPENSSL_NO_ENGINE
19+
# include <openssl/engine.h>
20+
# endif
1921
# include <openssl/ec.h>
2022
# include <openssl/asn1.h>
2123
# include "gost89.h"
@@ -42,9 +44,11 @@ EVP_CTRL_SET_TLSTREE_PARAMS definition in OpenSSL is expected."
4244
# define GOST_PARAM_PBE_PARAMS 1
4345
# define GOST_PARAM_PK_FORMAT 2
4446
# define GOST_PARAM_MAX 3
45-
# define GOST_CTRL_CRYPT_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_CRYPT_PARAMS)
46-
# define GOST_CTRL_PBE_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_PBE_PARAMS)
47-
# define GOST_CTRL_PK_FORMAT (ENGINE_CMD_BASE+GOST_PARAM_PK_FORMAT)
47+
# ifndef OPENSSL_NO_ENGINE
48+
# define GOST_CTRL_CRYPT_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_CRYPT_PARAMS)
49+
# define GOST_CTRL_PBE_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_PBE_PARAMS)
50+
# define GOST_CTRL_PK_FORMAT (ENGINE_CMD_BASE+GOST_PARAM_PK_FORMAT)
51+
# endif
4852

4953
typedef struct R3410_ec {
5054
int nid;
@@ -63,8 +67,10 @@ extern R3410_ec_params R3410_2001_paramset[],
6367

6468
void free_cached_groups(void);
6569

70+
# ifndef OPENSSL_NO_ENGINE
6671
extern const ENGINE_CMD_DEFN gost_cmds[];
6772
int gost_control_func(ENGINE *e, int cmd, long i, void *p, void (*f) (void));
73+
# endif
6874
const char *get_gost_engine_param(int param);
6975
int gost_set_default_param(int param, const char *value);
7076
void gost_param_free(void);

0 commit comments

Comments
 (0)