mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Make crypto_seed_rng() and crypto_rand() less scary.
These functions must really never fail; so have crypto_rand() assert that it's working okay, and have crypto_seed_rng() demand that callers check its return value. Also have crypto_seed_rng() check RAND_status() before returning.
This commit is contained in:
@@ -118,6 +118,7 @@
|
||||
#define ATTR_CONST __attribute__((const))
|
||||
#define ATTR_MALLOC __attribute__((malloc))
|
||||
#define ATTR_NORETURN __attribute__((noreturn))
|
||||
#define ATTR_WUR __attribute__((warn_unused_result))
|
||||
/* Alas, nonnull is not at present a good idea for us. We'd like to get
|
||||
* warnings when we pass NULL where we shouldn't (which nonnull does, albeit
|
||||
* spottily), but we don't want to tell the compiler to make optimizations
|
||||
@@ -153,6 +154,7 @@
|
||||
#define ATTR_NORETURN
|
||||
#define ATTR_NONNULL(x)
|
||||
#define ATTR_UNUSED
|
||||
#define ATTR_WUR
|
||||
#define PREDICT_LIKELY(exp) (exp)
|
||||
#define PREDICT_UNLIKELY(exp) (exp)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user