summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-25 10:36:34 -0500
committerNick Mathewson <nickm@torproject.org>2015-11-25 22:29:59 -0500
commit10fdee628552bca65ddb86b17e0b057628ad3703 (patch)
tree3091b28e5cd359f38d0a25d0199099909339e3f5 /src
parentdedea28c2ef59eb86f5d9704e5609ae13fa8b3c2 (diff)
downloadtor-10fdee628552bca65ddb86b17e0b057628ad3703.tar.gz
tor-10fdee628552bca65ddb86b17e0b057628ad3703.zip
Add crypto-initializer functions to those whose return values must be checked
Diffstat (limited to 'src')
-rw-r--r--src/common/crypto.c3
-rw-r--r--src/common/crypto.h4
-rw-r--r--src/test/test_workqueue.c5
3 files changed, 8 insertions, 4 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index b7dc4b86af..1ca86ea8f3 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -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;
diff --git a/src/common/crypto.h b/src/common/crypto.h
index d2ced63bd5..60f9e28902 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -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);
diff --git a/src/test/test_workqueue.c b/src/test/test_workqueue.c
index 6edfd313cb..1202f80fa3 100644
--- a/src/test/test_workqueue.c
+++ b/src/test/test_workqueue.c
@@ -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;