]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add crypto-initializer functions to those whose return values must be checked
authorNick Mathewson <nickm@torproject.org>
Wed, 25 Nov 2015 15:36:34 +0000 (10:36 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 26 Nov 2015 03:29:59 +0000 (22:29 -0500)
src/common/crypto.c
src/common/crypto.h
src/test/test_workqueue.c

index b7dc4b86af71a32b39a8583f0165e16ca906fc5b..1ca86ea8f381d759c89b0f88f5805e36fda40987 100644 (file)
@@ -322,7 +322,8 @@ int
 crypto_global_init(int useAccel, const char *accelName, const char *accelDir)
 {
   if (!crypto_global_initialized_) {
-    crypto_early_init();
+    if (crypto_early_init() < 0)
+      return -1;
 
     crypto_global_initialized_ = 1;
 
index d2ced63bd572daddcdd26bd7def354c718af4a7c..60f9e289020aa5b1f299dd6f120446f0e1beb237 100644 (file)
@@ -112,10 +112,10 @@ typedef struct crypto_dh_t crypto_dh_t;
 /* global state */
 const char * crypto_openssl_get_version_str(void);
 const char * crypto_openssl_get_header_version_str(void);
-int crypto_early_init(void);
+int crypto_early_init(void) ATTR_WUR;
 int crypto_global_init(int hardwareAccel,
                        const char *accelName,
-                       const char *accelPath);
+                       const char *accelPath) ATTR_WUR;
 void crypto_thread_cleanup(void);
 int crypto_global_cleanup(void);
 
index 6edfd313cb0ff35ad4b2c6eeff83c06561981854..1202f80fa3fb5a3ebd654ff50f04b0cc70d6d6c8 100644 (file)
@@ -390,7 +390,10 @@ main(int argc, char **argv)
 
   init_logging(1);
   network_init();
-  crypto_global_init(1, NULL, NULL);
+  if (crypto_global_init(1, NULL, NULL) < 0) {
+    printf("Couldn't initialize crypto subsystem; exiting.\n");
+    return 1;
+  }
   if (crypto_seed_rng() < 0) {
     printf("Couldn't seed RNG; exiting.\n");
     return 1;