From 3c7b2cc1ddc611dd37cd827fd389bf1f25807594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Sun, 26 Jan 2025 16:42:34 +0100 Subject: [PATCH] Fix Windows build --- src/eng_back.c | 1 - src/engine.h | 27 --------------------------- src/util.h | 36 ++++++++++++++++++++++++++++++++++++ src/util_uri.c | 2 +- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/eng_back.c b/src/eng_back.c index 126eb8ad..c8254851 100644 --- a/src/eng_back.c +++ b/src/eng_back.c @@ -28,7 +28,6 @@ #include "engine.h" #include "util.h" -#include "p11_pthread.h" #include #include diff --git a/src/engine.h b/src/engine.h index 12d33943..f31598ac 100644 --- a/src/engine.h +++ b/src/engine.h @@ -104,33 +104,6 @@ void ctx_log(ENGINE_CTX *ctx, int level, const char *format, ...) #endif ; -/* TODO: move back to eng_back.c when references are removed from util_uri.c */ -struct st_engine_ctx { - /* Engine configuration */ - /* - * The PIN used for login. Cache for the ctx_get_pin function. - * The memory for this PIN is always owned internally, - * and may be freed as necessary. Before freeing, the PIN - * must be whitened, to prevent security holes. - */ - char *pin; - size_t pin_length; - int forced_pin; - int debug_level; /* level of debug output */ - void (*vlog)(int, const char *, va_list); /* for the logging callback */ - char *module; - char *init_args; - UI_METHOD *ui_method; - void *callback_data; - int force_login; - pthread_mutex_t lock; - - /* Current operations */ - PKCS11_CTX *pkcs11_ctx; - PKCS11_SLOT *slot_list; - unsigned int slot_count; -}; - #endif /* _ENGINE_PKCS11_H */ /* vim: set noexpandtab: */ diff --git a/src/util.h b/src/util.h index 0fc7f5a5..547ab869 100644 --- a/src/util.h +++ b/src/util.h @@ -22,6 +22,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + +typedef struct st_engine_ctx ENGINE_CTX; /* opaque */ + /* defined in util_uri.c */ X509 *util_get_cert_from_uri(ENGINE_CTX *ctx, const char *object_uri, @@ -32,3 +36,35 @@ EVP_PKEY *util_get_pubkey_from_uri(ENGINE_CTX *ctx, const char *s_key_id, EVP_PKEY *util_get_privkey_from_uri(ENGINE_CTX *ctx, const char *s_key_id, UI_METHOD *ui_method, void *callback_data); + +/* TODO: move the following code back to eng_back.c as soon as + * all references to those fields are removed from util_uri.c */ +#include "engine.h" +#include "p11_pthread.h" +struct st_engine_ctx { + /* Engine configuration */ + /* + * The PIN used for login. Cache for the ctx_get_pin function. + * The memory for this PIN is always owned internally, + * and may be freed as necessary. Before freeing, the PIN + * must be whitened, to prevent security holes. + */ + char *pin; + size_t pin_length; + int forced_pin; + int debug_level; /* level of debug output */ + void (*vlog)(int, const char *, va_list); /* for the logging callback */ + char *module; + char *init_args; + UI_METHOD *ui_method; + void *callback_data; + int force_login; + pthread_mutex_t lock; + + /* Current operations */ + PKCS11_CTX *pkcs11_ctx; + PKCS11_SLOT *slot_list; + unsigned int slot_count; +}; + +/* vim: set noexpandtab: */ diff --git a/src/util_uri.c b/src/util_uri.c index 1861f27e..dd5152ca 100644 --- a/src/util_uri.c +++ b/src/util_uri.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "engine.h" +#include "util.h" #include #include