summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2008-03-16 19:47:44 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2008-03-16 19:47:44 +0000
commit184652f0aac51db18e318953058474a7ac4493b6 (patch)
tree6e7242d79cb5d0773cd151043408f25fec5d6fb9 /include
parent75714c460fcad691f65aac83a88aa5e47478871f (diff)
diff from djm@ committed at his request:
introduce two new APIs for requesting strong random numbers: arc4random_buf() - fill an arbitrary memory range with random numbers arc4random_uniform() - return a uniformly distributed random number below a specified upper bound, avoiding the bias that comes from a naive "arc4random() % upper_bound" construction. these mirror similarly-named functions in the kernel; lots of discussion deraadt@ mcbride@
Diffstat (limited to 'include')
-rw-r--r--include/stdlib.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index bf3a88e05da..6c337ba13ab 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdlib.h,v 1.40 2007/09/03 14:37:02 millert Exp $ */
+/* $OpenBSD: stdlib.h,v 1.41 2008/03/16 19:47:43 otto Exp $ */
/* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */
/*-
@@ -272,6 +272,10 @@ u_int32_t arc4random(void);
void arc4random_stir(void);
void arc4random_addrandom(unsigned char *, int)
__attribute__((__bounded__ (__string__,1,2)));
+u_int32_t arc4random_uniform(u_int32_t);
+void arc4random_buf(void *, size_t)
+ __attribute__((__bounded__ (__string__,1,2)));
+
#endif /* __BSD_VISIBLE */
__END_DECLS