diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2016-03-15 03:57:39 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2016-03-15 03:57:39 +0000 |
commit | 26d978a556ae9099f6610ace9834991636e4a71b (patch) | |
tree | d8789c5afbe3920f3f7ef46ad73aa34f48173591 /third_party/srtp/crypto/rng/ctr_prng.c | |
parent | 8b9358503884ec1901d807ff56c2fc588be896a2 (diff) |
Close #1847: Upgraded libsrtp version to 1.5.4 and added support for AES-CM-256 crypto.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5261 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'third_party/srtp/crypto/rng/ctr_prng.c')
-rw-r--r-- | third_party/srtp/crypto/rng/ctr_prng.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/third_party/srtp/crypto/rng/ctr_prng.c b/third_party/srtp/crypto/rng/ctr_prng.c index ab76df36..e24b0aba 100644 --- a/third_party/srtp/crypto/rng/ctr_prng.c +++ b/third_party/srtp/crypto/rng/ctr_prng.c @@ -43,6 +43,10 @@ */ +#ifdef HAVE_CONFIG_H + #include <config.h> +#endif + #include "prng.h" /* single, global prng structure */ @@ -66,7 +70,11 @@ ctr_prng_init(rand_source_func_t random_source) { return status; /* initialize aes ctr context with random key */ - status = aes_icm_context_init(&ctr_prng.state, tmp_key); +#ifdef OPENSSL + status = aes_icm_openssl_context_init(&ctr_prng.state, tmp_key, 30); +#else + status = aes_icm_context_init(&ctr_prng.state, tmp_key, 30); +#endif if (status) return status; @@ -79,10 +87,8 @@ ctr_prng_get_octet_string(void *dest, uint32_t len) { /* * if we need to re-initialize the prng, do so now - * - * avoid 32-bit overflows by subtracting instead of adding */ - if (ctr_prng.octet_count > MAX_PRNG_OUT_LEN - len) { + if ((aes_icm_bytes_encrypted(&ctr_prng.state) + len) > 0xffff) { status = ctr_prng_init(ctr_prng.rand); if (status) return status; |