diff options
author | Alexander Traud <pabstraud@compuserve.com> | 2016-06-07 12:45:34 +0200 |
---|---|---|
committer | Alexander Traud <pabstraud@compuserve.com> | 2016-06-07 12:46:25 +0200 |
commit | 52120204c9a538e00679461ec5404d04a07e57f4 (patch) | |
tree | 176cbfee111bfe72ba33bbedac20e6b3635328de | |
parent | 3e8d523d889351c69b21fdc563cb98d18a7bdb66 (diff) |
res_srtp: Instead of libSRTP use OpenSSL as random source.
Since libSRTP 1.5, its Random Number Generator (RNG) is not maintained anymore.
Therefore, the symbol RAND_bytes is used instead of crypto_get_random.
ASTERISK-24436 #close
Change-Id: Iea0bae4d4e3c9aa0926ea442b6484b5159789d96
-rw-r--r-- | res/res_srtp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_srtp.c b/res/res_srtp.c index 1e68f9675..0b1fb73e7 100644 --- a/res/res_srtp.c +++ b/res/res_srtp.c @@ -40,7 +40,11 @@ ASTERISK_REGISTER_FILE() #include <srtp/srtp.h> +#ifdef HAVE_OPENSSL +#include <openssl/rand.h> +#else #include <srtp/crypto_kernel.h> +#endif #include "asterisk/lock.h" #include "asterisk/sched.h" @@ -305,7 +309,11 @@ static int ast_srtp_policy_set_master_key(struct ast_srtp_policy *policy, const static int ast_srtp_get_random(unsigned char *key, size_t len) { +#ifdef HAVE_OPENSSL + return RAND_bytes(key, len) > 0 ? 0: -1; +#else return crypto_get_random(key, len) != err_status_ok ? -1: 0; +#endif } static void ast_srtp_set_cb(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data) |