]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Load OpenSSL engines
authorRosen Penev <rosenp@gmail.com>
Sun, 10 Mar 2019 09:26:11 +0000 (10:26 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 13 Mar 2019 15:14:26 +0000 (16:14 +0100)
src/main.c

index a6770e236f9b829bfeddfbf676153eea909f82ae..6d3c8404691bbff150b763b50fe633cda95b8458 100644 (file)
@@ -98,7 +98,7 @@ typedef struct {
   enum {
     OPT_STR,
     OPT_INT,
-    OPT_BOOL, 
+    OPT_BOOL,
     OPT_STR_LIST,
   }          type;
   void       *param;
@@ -526,7 +526,7 @@ show_usage
       free(desc);
     }
   }
-  printf("%s", 
+  printf("%s",
          _("\n"
            "For more information please visit the Tvheadend website:\n"
            "https://tvheadend.org\n"));
@@ -615,7 +615,7 @@ mtimer_thread(void *aux)
     next = now + sec2mono(3600);
 
     while((mti = LIST_FIRST(&mtimers)) != NULL) {
-      
+
       if (mti->mti_expire > now) {
         next = mti->mti_expire;
         break;
@@ -648,7 +648,7 @@ mtimer_thread(void *aux)
     tvh_cond_timedwait(&mtimer_cond, &global_lock, next);
     pthread_mutex_unlock(&global_lock);
   }
-  
+
   return NULL;
 }
 
@@ -678,7 +678,7 @@ mainloop(void)
 
     // TODO: there is a risk that if timers re-insert themselves to
     //       the top of the list with a 0 offset we could loop indefinitely
-    
+
 #if 0
     tvhdebug(LS_GTIMER, "now %"PRItime_t, ts.tv_sec);
     LIST_FOREACH(gti, &gtimers, gti_link)
@@ -686,7 +686,7 @@ mainloop(void)
 #endif
 
     while((gti = LIST_FIRST(&gtimers)) != NULL) {
-      
+
       if (gti->gti_expire > now) {
         ts.tv_sec = gti->gti_expire;
         break;
@@ -1033,12 +1033,12 @@ main(int argc, char **argv)
   }
   if (opt_log_debug)
     log_debug  = opt_log_debug;
-    
+
   tvhlog_init(log_level, log_options, opt_logpath);
   tvhlog_set_debug(log_debug);
   tvhlog_set_trace(log_trace);
   tvhinfo(LS_MAIN, "Log started");
+
   signal(SIGPIPE, handle_sigpipe); // will be redundant later
   signal(SIGILL, handle_sigill);   // see handler..
 
@@ -1144,7 +1144,7 @@ main(int argc, char **argv)
     tvhlog_options &= ~TVHLOG_OPT_STDERR;
   if (!isatty(2))
     tvhlog_options &= ~TVHLOG_OPT_DECORATE;
-  
+
   /* Initialise clock */
   pthread_mutex_lock(&global_lock);
   __mdispatch_clock = getmonoclock();
@@ -1159,6 +1159,12 @@ main(int argc, char **argv)
   OPENSSL_config(NULL);
   SSL_load_error_strings();
   SSL_library_init();
+
+  #ifndef OPENSSL_NO_ENGINE
+    /* ENGINE init */
+    ENGINE_load_builtin_engines();
+  #endif
+
   /* Rand seed */
   randseed.thread_id = (void *)main_tid;
   gettimeofday(&randseed.tv, NULL);
@@ -1345,7 +1351,7 @@ main(int argc, char **argv)
 
   if(opt_fork)
     unlink(opt_pidpath);
-    
+
   /* OpenSSL - welcome to the "cleanup" hell */
   ENGINE_cleanup();
   RAND_cleanup();