4
4
*/
5
5
6
6
#include "myproxy_common.h"
7
+ #ifndef OPENSSL_NO_ENGINE
7
8
#include <openssl/engine.h>
9
+ #endif
8
10
#include <openssl/ui.h>
9
11
10
12
#define BUF_SIZE 16384
@@ -467,8 +469,10 @@ write_certificate(X509 *cert, const char serial[], const char dir[]) {
467
469
}
468
470
469
471
static EVP_PKEY * e_cakey = NULL ;
472
+ #ifndef OPENSSL_NO_ENGINE
470
473
static ENGINE * engine = NULL ;
471
474
static int engine_used = 0 ;
475
+ #endif
472
476
473
477
static int
474
478
generate_certificate ( X509_REQ * request ,
@@ -701,6 +705,7 @@ generate_certificate( X509_REQ *request,
701
705
702
706
/* load ca key */
703
707
708
+ #ifndef OPENSSL_NO_ENGINE
704
709
if (engine ) {
705
710
if (server_context -> certificate_openssl_engine_lockfile ) {
706
711
lockfd = open (server_context -> certificate_openssl_engine_lockfile ,
@@ -725,6 +730,7 @@ generate_certificate( X509_REQ *request,
725
730
goto error ;
726
731
}
727
732
}
733
+ #endif
728
734
729
735
if (e_cakey ) {
730
736
cakey = e_cakey ;
@@ -770,6 +776,7 @@ generate_certificate( X509_REQ *request,
770
776
goto error ;
771
777
}
772
778
serial = i2s_ASN1_OCTET_STRING (NULL , X509_get_serialNumber (cert ));
779
+ #ifndef OPENSSL_NO_ENGINE
773
780
if (engine ) {
774
781
engine_used = 1 ;
775
782
if (lockfd != -1 ) close (lockfd );
@@ -779,6 +786,7 @@ generate_certificate( X509_REQ *request,
779
786
goto error ;
780
787
}
781
788
}
789
+ #endif
782
790
783
791
return_value = 0 ;
784
792
@@ -827,6 +835,7 @@ arraylen(char **options) {
827
835
return c ;
828
836
}
829
837
838
+ #ifndef OPENSSL_NO_ENGINE
830
839
void shutdown_openssl_engine (void ) {
831
840
if (e_cakey ) EVP_PKEY_free ( e_cakey );
832
841
if (engine ) ENGINE_finish (engine );
@@ -837,6 +846,7 @@ void shutdown_openssl_engine(void) {
837
846
838
847
if (engine_used ) ENGINE_cleanup ();
839
848
}
849
+ #endif
840
850
841
851
static int ui_read_fn (UI * ui , UI_STRING * ui_string ) {
842
852
switch (UI_get_string_type (ui_string )) {
@@ -868,6 +878,7 @@ static int ui_write_fn(UI *ui, UI_STRING *ui_string) {
868
878
return 1 ;
869
879
}
870
880
881
+ #ifndef OPENSSL_NO_ENGINE
871
882
int initialise_openssl_engine (myproxy_server_context_t * server_context ) {
872
883
ENGINE * e ;
873
884
EVP_PKEY * cakey ;
@@ -982,6 +993,7 @@ int initialise_openssl_engine(myproxy_server_context_t *server_context) {
982
993
UI_destroy_method (ui_method );
983
994
return 1 ;
984
995
}
996
+ #endif
985
997
986
998
static int
987
999
do_check (const char * callout , const X509_REQ * req , const X509 * cert )
0 commit comments