]> granicus.if.org Git - php/commitdiff
Attempt to add more entropy for key generation.
authorWez Furlong <wez@php.net>
Thu, 12 Dec 2002 15:50:11 +0000 (15:50 +0000)
committerWez Furlong <wez@php.net>
Thu, 12 Dec 2002 15:50:11 +0000 (15:50 +0000)
ext/openssl/tests/001.phpt

index b3f5602f7ff385f23774b019af47ecba0dce0a06..9b15e134a5fc08b9c26db39fca32c1a2abd916d4 100644 (file)
@@ -9,6 +9,15 @@ include('skipif.inc'); ?>
 <?php
 echo "Creating private key\n";
 
+/* stack up some entropy; performance is not critical,
+ * and being slow will most likely even help the test.
+ */
+for ($z = "", $i = 0; $i < 1024; $i++) {
+       $z .= $i * $i;
+       if (function_exists("usleep"))
+               usleep($i);
+}
+
 $privkey = openssl_pkey_new();
 
 if ($privkey === false)