Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-08-11 16:03:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-08-11 16:03:18 +0400
commit5b4e301b36c6d22a18b16eb544a0305ee94f28fc (patch)
tree910d2756ad221752bcb9f81fdd04c3a3561341ca /winsup/cygwin/fhandler_random.cc
parentf9c956a1ff9f636a6a2cc201d1996231231a7c77 (diff)
* cpuid.h: Add missing copyright header. Fix formatting. Use uint32_t
instead of unsigned throughout. Change functions to static inline and always inline. (cpuid): Add parameter to set ecx, allowing to request extended CPUID info. * fhandler_proc.cc (format_proc_cpuinfo): Use uint32_t instead of unsigned throughout. Add fake decimal places to MHz info. Handle more feature flags. * fhandler_random.cc (fhandler_dev_random::write): Allow up to 4K input to add entropy. * syscalls.cc: Drop including cpuid.h.
Diffstat (limited to 'winsup/cygwin/fhandler_random.cc')
-rw-r--r--winsup/cygwin/fhandler_random.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc
index 0d28738de..375398296 100644
--- a/winsup/cygwin/fhandler_random.cc
+++ b/winsup/cygwin/fhandler_random.cc
@@ -11,6 +11,7 @@ details. */
#include "winsup.h"
#include <unistd.h>
+#include <sys/param.h>
#include "cygerrno.h"
#include "path.h"
#include "fhandler.h"
@@ -65,10 +66,10 @@ fhandler_dev_random::write (const void *ptr, size_t len)
return -1;
}
- /* Limit len to a value <= 512 since we don't want to overact.
+ /* Limit len to a value <= 4096 since we don't want to overact.
Copy to local buffer because CryptGenRandom violates const. */
- unsigned char buf[512];
- size_t limited_len = len <= 512 ? len : 512;
+ size_t limited_len = MIN (len, 4096);
+ unsigned char buf[limited_len];
memcpy (buf, ptr, limited_len);
/* Mess up system entropy source. Return error if device is /dev/random. */