Browse code

Initialize OpenSSL within the application, not within libclamav

Shawn Webb authored on 2014/05/10 05:15:49
Showing 7 changed files
... ...
@@ -246,6 +246,8 @@ int main(int argc, char *argv[])
246 246
     int fd = -1;
247 247
     unsigned tracelevel;
248 248
 
249
+    cl_initialize_crypto();
250
+
249 251
     if(check_flevel())
250 252
 	exit(1);
251 253
 
... ...
@@ -376,6 +376,8 @@ int main(int argc, char **argv)
376 376
 	unsigned int i, j;
377 377
 	struct cli_environment env;
378 378
 
379
+    cl_initialize_crypto();
380
+
379 381
     opts = optparse(NULL, argc, argv, 1, OPT_CLAMCONF, 0, NULL);
380 382
     if(!opts) {
381 383
 	printf("ERROR: Can't parse command line options\n");
... ...
@@ -139,10 +139,10 @@ int main(int argc, char **argv)
139 139
     sa.sa_handler = SIG_IGN;
140 140
     sigaction(SIGHUP, &sa, NULL);
141 141
     sigaction(SIGUSR2, &sa, NULL);
142
-#else
143
-    cl_initialize_crypto();
144 142
 #endif
145 143
 
144
+    cl_initialize_crypto();
145
+
146 146
     if((opts = optparse(NULL, argc, argv, 1, OPT_CLAMD, 0, NULL)) == NULL) {
147 147
         mprintf("!Can't parse command line options\n");
148 148
         return 1;
... ...
@@ -69,9 +69,7 @@ int main(int argc, char **argv)
69 69
 	struct sigaction sigact;
70 70
 #endif
71 71
 
72
-#if defined(_WIN32)
73 72
     cl_initialize_crypto();
74
-#endif
75 73
 
76 74
     if((opts = optparse(NULL, argc, argv, 1, OPT_CLAMDSCAN, OPT_CLAMSCAN, NULL)) == NULL) {
77 75
 	mprintf("!Can't parse command line options\n");
... ...
@@ -80,9 +80,7 @@ int main(int argc, char **argv)
80 80
     sigprocmask(SIG_SETMASK, &sigset, NULL);
81 81
 #endif
82 82
 
83
-#if defined(_WIN32)
84 83
     cl_initialize_crypto();
85
-#endif
86 84
 
87 85
 
88 86
     if((opts = optparse(NULL, argc, argv, 1, OPT_CLAMSCAN, 0, NULL)) == NULL) {
... ...
@@ -1312,15 +1312,3 @@ void cl_engine_set_clcb_meta(struct cl_engine *engine, clcb_meta callback)
1312 1312
 {
1313 1313
     engine->cb_meta = callback;
1314 1314
 }
1315
-
1316
-#if !defined(_WIN32)
1317
-__attribute__((constructor)) void init(void)
1318
-{
1319
-    cl_initialize_crypto();
1320
-}
1321
-
1322
-__attribute__((destructor)) void deinit(void)
1323
-{
1324
-    cl_cleanup_crypto();
1325
-}
1326
-#endif
... ...
@@ -2995,9 +2995,7 @@ int main(int argc, char **argv)
2995 2995
     if(check_flevel())
2996 2996
 	exit(1);
2997 2997
 
2998
-#if defined(_WIN32)
2999 2998
     cl_initialize_crypto();
3000
-#endif
3001 2999
 
3002 3000
     if((ret = cl_init(CL_INIT_DEFAULT)) != CL_SUCCESS) {
3003 3001
 	mprintf("!Can't initialize libclamav: %s\n", cl_strerror(ret));