[S] Change in openvpn[master]: Replace ASSERT(rand_bytes(...)) with prng_bytes

"cron2 \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <56988a55a827ad2e439d0f81aacefd810ba201fc-EmailReplacePatchSet-HTML@gerrit.openvpn.net>
Attention is currently required from: cron2.

cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1833?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld, Code-Review-1 by cron2


Change subject: Replace ASSERT(rand_bytes(...)) with prng_bytes
......................................................................

Replace ASSERT(rand_bytes(...)) with prng_bytes

prng_bytes is already ASSERT(rand_bytes(...)), so this change is
just a little cleanup that makes a code a little bit nicer.

Change-Id: If458a3362e03630ce699bd122e957169601657a5
Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1833
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38108.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/crypto.c
M src/openvpn/proxy.c
M tests/unit_tests/openvpn/test_ssl.c
3 files changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1833/2

diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index ee43d65..8f59838 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -1219,7 +1219,7 @@
             ASSERT(cipher_ctx_iv_length(cipher) >= OPENVPN_AEAD_MIN_IV_LEN);
 
             /* Generate dummy implicit IV */
-            ASSERT(rand_bytes(co->key_ctx_bi.encrypt.implicit_iv, OPENVPN_MAX_IV_LENGTH));
+            prng_bytes(co->key_ctx_bi.encrypt.implicit_iv, OPENVPN_MAX_IV_LENGTH);
 
             memcpy(co->key_ctx_bi.decrypt.implicit_iv, co->key_ctx_bi.encrypt.implicit_iv,
                    OPENVPN_MAX_IV_LENGTH);
@@ -1239,7 +1239,7 @@
         ASSERT(buf_init(&src, 0));
         ASSERT(i <= src.capacity);
         src.len = i;
-        ASSERT(rand_bytes(BPTR(&src), BLEN(&src)));
+        prng_bytes(BPTR(&src), BLEN(&src));
 
         /* copy source to input buf */
         buf = work;
diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c
index 9f3ec93..9acb2fa 100644
--- a/src/openvpn/proxy.c
+++ b/src/openvpn/proxy.c
@@ -734,7 +734,7 @@
                 }
 
                 /* generate a client nonce */
-                ASSERT(rand_bytes(cnonce_raw, sizeof(cnonce_raw)));
+                prng_bytes(cnonce_raw, sizeof(cnonce_raw));
                 cnonce = make_base64_string2(cnonce_raw, sizeof(cnonce_raw), &gc);
 
 
diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn/test_ssl.c
index 3e84fb8..793a70f 100644
--- a/tests/unit_tests/openvpn/test_ssl.c
+++ b/tests/unit_tests/openvpn/test_ssl.c
@@ -324,7 +324,7 @@
         ASSERT(buf_init(&src, 0));
         ASSERT(i <= src.capacity);
         src.len = i;
-        ASSERT(rand_bytes(BPTR(&src), BLEN(&src)));
+        prng_bytes(BPTR(&src), BLEN(&src));
 
         /* copy source to input buf */
         buf = work;
@@ -370,7 +370,7 @@
     ASSERT(buf_init(&src, 0));
     ASSERT(len <= src.capacity);
     src.len = len;
-    ASSERT(rand_bytes(BPTR(&src), BLEN(&src)));
+    prng_bytes(BPTR(&src), BLEN(&src));
 
     /* copy source to input buf */
     buf = work;
@@ -455,10 +455,10 @@
     }
     else
     {
-        ASSERT(rand_bytes(key2.keys[0].cipher, sizeof(key2.keys[0].cipher)));
-        ASSERT(rand_bytes(key2.keys[0].hmac, sizeof(key2.keys[0].hmac)));
-        ASSERT(rand_bytes(key2.keys[1].cipher, sizeof(key2.keys[1].cipher)));
-        ASSERT(rand_bytes(key2.keys[1].hmac, sizeof(key2.keys)[1].hmac));
+        prng_bytes(key2.keys[0].cipher, sizeof(key2.keys[0].cipher));
+        prng_bytes(key2.keys[0].hmac, sizeof(key2.keys[0].hmac));
+        prng_bytes(key2.keys[1].cipher, sizeof(key2.keys[1].cipher));
+        prng_bytes(key2.keys[1].hmac, sizeof(key2.keys)[1].hmac);
     }
 
     struct crypto_options co = { 0 };

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1833?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If458a3362e03630ce699bd122e957169601657a5
Gerrit-Change-Number: 1833
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: cron2 <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.