Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: srtp/crypto/rng/ctr_prng.c

Issue 936663005: Land https://codereview.chromium.org/889083003/ to update libsrtp to upstream 1.5.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libsrtp/
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « srtp/crypto/replay/ut_sim.c ('k') | srtp/crypto/rng/prng.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: srtp/crypto/rng/ctr_prng.c
===================================================================
--- srtp/crypto/rng/ctr_prng.c (revision 294174)
+++ srtp/crypto/rng/ctr_prng.c (working copy)
@@ -43,6 +43,10 @@
*/
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
#include "prng.h"
/* single, global prng structure */
@@ -66,7 +70,11 @@
return status;
/* initialize aes ctr context with random 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 @@
/*
* 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;
« no previous file with comments | « srtp/crypto/replay/ut_sim.c ('k') | srtp/crypto/rng/prng.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698