Skip to content

Commit 1ee8700

Browse files
committedNov 2, 2024
Make OpenSSL engine optional
1 parent b10f3a9 commit 1ee8700

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed
 

‎myproxy/source/certauth_extensions.c

+12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
#include "myproxy_common.h"
7+
#ifndef OPENSSL_NO_ENGINE
78
#include <openssl/engine.h>
9+
#endif
810
#include <openssl/ui.h>
911

1012
#define BUF_SIZE 16384
@@ -467,8 +469,10 @@ write_certificate(X509 *cert, const char serial[], const char dir[]) {
467469
}
468470

469471
static EVP_PKEY *e_cakey=NULL;
472+
#ifndef OPENSSL_NO_ENGINE
470473
static ENGINE *engine=NULL;
471474
static int engine_used=0;
475+
#endif
472476

473477
static int
474478
generate_certificate( X509_REQ *request,
@@ -701,6 +705,7 @@ generate_certificate( X509_REQ *request,
701705

702706
/* load ca key */
703707

708+
#ifndef OPENSSL_NO_ENGINE
704709
if (engine) {
705710
if (server_context->certificate_openssl_engine_lockfile) {
706711
lockfd = open(server_context->certificate_openssl_engine_lockfile,
@@ -725,6 +730,7 @@ generate_certificate( X509_REQ *request,
725730
goto error;
726731
}
727732
}
733+
#endif
728734

729735
if(e_cakey) {
730736
cakey = e_cakey;
@@ -770,6 +776,7 @@ generate_certificate( X509_REQ *request,
770776
goto error;
771777
}
772778
serial = i2s_ASN1_OCTET_STRING(NULL, X509_get_serialNumber(cert));
779+
#ifndef OPENSSL_NO_ENGINE
773780
if (engine) {
774781
engine_used=1;
775782
if (lockfd != -1) close(lockfd);
@@ -779,6 +786,7 @@ generate_certificate( X509_REQ *request,
779786
goto error;
780787
}
781788
}
789+
#endif
782790

783791
return_value = 0;
784792

@@ -827,6 +835,7 @@ arraylen(char **options) {
827835
return c;
828836
}
829837

838+
#ifndef OPENSSL_NO_ENGINE
830839
void shutdown_openssl_engine(void) {
831840
if (e_cakey) EVP_PKEY_free( e_cakey );
832841
if (engine) ENGINE_finish(engine);
@@ -837,6 +846,7 @@ void shutdown_openssl_engine(void) {
837846

838847
if (engine_used) ENGINE_cleanup();
839848
}
849+
#endif
840850

841851
static int ui_read_fn(UI *ui, UI_STRING *ui_string) {
842852
switch(UI_get_string_type(ui_string)) {
@@ -868,6 +878,7 @@ static int ui_write_fn(UI *ui, UI_STRING *ui_string) {
868878
return 1;
869879
}
870880

881+
#ifndef OPENSSL_NO_ENGINE
871882
int initialise_openssl_engine(myproxy_server_context_t *server_context) {
872883
ENGINE *e;
873884
EVP_PKEY *cakey;
@@ -982,6 +993,7 @@ int initialise_openssl_engine(myproxy_server_context_t *server_context) {
982993
UI_destroy_method(ui_method);
983994
return 1;
984995
}
996+
#endif
985997

986998
static int
987999
do_check(const char *callout, const X509_REQ *req, const X509 *cert)

‎myproxy/source/certauth_extensions.h

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*
55
*/
66

7+
#ifndef OPENSSL_NO_ENGINE
78
int initialise_openssl_engine(myproxy_server_context_t *server_context);
9+
#endif
810

911
int is_certificate_authority_configured(myproxy_server_context_t
1012
*server_context);

‎myproxy/source/configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
AC_INIT([myproxy],[6.2.18])
2+
AC_INIT([myproxy],[6.2.19])
33
AC_CONFIG_AUX_DIR([build-aux])
44
AM_INIT_AUTOMAKE([foreign])
55
LT_INIT([dlopen win32-dll])

‎myproxy/source/myproxy_server.c

+7
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,17 @@ main(int argc, char *argv[])
287287
}
288288

289289
if(server_context->certificate_openssl_engine_id) {
290+
#ifndef OPENSSL_NO_ENGINE
290291
if(!initialise_openssl_engine(server_context)) {
291292
myproxy_log_verror();
292293
my_failure("Could not initialise OpenSSL engine.");
293294
}
295+
#else
296+
myproxy_log("Openssl has no engine support.");
297+
myproxy_log("Can not use certificate_openssl_engine_id option.");
298+
myproxy_log("Exiting.");
299+
exit(1);
300+
#endif
294301
}
295302

296303
if (!server_context->run_as_daemon) {

‎packaging/debian/myproxy/debian/changelog.in

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
myproxy (6.2.19-1+gct.@distro@) @distro@; urgency=medium
2+
3+
* Make OpenSSL engine optional
4+
5+
-- Mattias Ellert <mattias.ellert@physics.uu.se> Sat, 02 Nov 2024 08:58:37 +0100
6+
17
myproxy (6.2.18-1+gct.@distro@) @distro@; urgency=medium
28

39
* Change private key cipher to EVP_aes_256_cbc

‎packaging/fedora/myproxy.spec

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Name: myproxy
44
%global soname 6
5-
Version: 6.2.18
5+
Version: 6.2.19
66
Release: 1%{?dist}
77
Summary: Manage X.509 Public Key Infrastructure (PKI) security credentials
88

@@ -391,6 +391,9 @@ fi
391391
%doc %{_pkgdocdir}/LICENSE*
392392

393393
%changelog
394+
* Sat Nov 02 2024 Mattias Ellert <mattias.ellert@physics.uu.se> - 6.2.19-1
395+
- Make OpenSSL engine optional
396+
394397
* Tue Jul 23 2024 Mattias Ellert <mattias.ellert@physics.uu.se> - 6.2.18-1
395398
- Change private key cipher to EVP_aes_256_cbc
396399

0 commit comments

Comments
 (0)
Failed to load comments.