diff options
author | 2013-08-01 19:42:08 +0000 | |
---|---|---|
committer | 2013-08-01 19:42:08 +0000 | |
commit | 3d4cb4cc84bd9b3ac7ab97162eeaf2dd1c159f23 (patch) | |
tree | b631a855fcfd7eb59aec27e6dc256effa37b6615 /lib/libc/stdlib/random.c | |
parent | more set queue fallout fixups (diff) | |
download | wireguard-openbsd-3d4cb4cc84bd9b3ac7ab97162eeaf2dd1c159f23.tar.xz wireguard-openbsd-3d4cb4cc84bd9b3ac7ab97162eeaf2dd1c159f23.zip |
Add linker warnings for rand() and random() and various related functions.
ok deraadt@
Diffstat (limited to 'lib/libc/stdlib/random.c')
-rw-r--r-- | lib/libc/stdlib/random.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index f299d8e2f65..00edf2dca1c 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: random.c,v 1.18 2013/03/15 19:07:53 tedu Exp $ */ +/* $OpenBSD: random.c,v 1.19 2013/08/01 19:42:08 kettenis Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. @@ -233,6 +233,11 @@ srandom(unsigned int x) UNLOCK(); } +#if defined(APIWARN) +__warn_references(srandom, + "warning: srandom() seed choices are invariably poor"); +#endif + /* * srandomdev: * @@ -267,6 +272,11 @@ srandomdev(void) UNLOCK(); } +#if defined(APIWARN) +__warn_references(srandomdev, + "warning: srandomdev() usage; consider switching to arc4random()"); +#endif + /* * initstate: * @@ -429,3 +439,8 @@ random(void) UNLOCK(); return r; } + +#if defined(APIWARN) +__warn_references(random, + "warning: random() isn't random; consider using arc4random()"); +#endif |