Fri Jul 15 21:19:19 2016 UTC ()
Fix mdoclint warnings.


(wiz)
diff -r1.20 -r1.21 src/lib/libc/gen/arc4random.3

cvs diff -r1.20 -r1.21 src/lib/libc/gen/arc4random.3 (expand / switch to unified diff)

--- src/lib/libc/gen/arc4random.3 2016/07/15 15:23:43 1.20
+++ src/lib/libc/gen/arc4random.3 2016/07/15 21:19:19 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: arc4random.3,v 1.20 2016/07/15 15:23:43 riastradh Exp $ 1.\" $NetBSD: arc4random.3,v 1.21 2016/07/15 21:19:19 wiz Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2014 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Taylor R. Campbell. 7.\" by Taylor R. Campbell.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -155,27 +155,27 @@ uniform distribution on all functions fr @@ -155,27 +155,27 @@ uniform distribution on all functions fr
155strings. 155strings.
156.Pp 156.Pp
157The PRNG state is a 32-byte ChaCha20 key 157The PRNG state is a 32-byte ChaCha20 key
158.Fa s . 158.Fa s .
159Each request to 159Each request to
160an 160an
161.Nm 161.Nm
162function 162function
163.Bl -bullet -offset abcd -compact 163.Bl -bullet -offset abcd -compact
164.It 164.It
165computes the 64-byte quantity 165computes the 64-byte quantity
166.Fa x 166.Fa x
167= 167=
168.Pf ChaCha20_ Fa s Ns (0), 168.Pf ChaCha20_ Fa s Ns Pq 0 ,
169.It 169.It
170splits 170splits
171.Fa x 171.Fa x
172into two 32-byte quantities 172into two 32-byte quantities
173.Fa s' 173.Fa s'
174and 174and
175.Fa k , 175.Fa k ,
176.It 176.It
177replaces 177replaces
178.Fa s 178.Fa s
179by 179by
180.Fa s' , 180.Fa s' ,
181and 181and
@@ -186,29 +186,29 @@ as output. @@ -186,29 +186,29 @@ as output.
186.El 186.El
187.Pp 187.Pp
188.Fn arc4random 188.Fn arc4random
189yields the first four bytes of 189yields the first four bytes of
190.Fa k 190.Fa k
191as output directly. 191as output directly.
192.Fn arc4random_buf 192.Fn arc4random_buf
193either yields up to 32 bytes of 193either yields up to 32 bytes of
194.Fa k 194.Fa k
195as output directly, or, for longer 195as output directly, or, for longer
196requests, uses 196requests, uses
197.Fa k 197.Fa k
198as a ChaCha20 key and yields the concatenation 198as a ChaCha20 key and yields the concatenation
199.Pf ChaCha20_ Fa k Ns (0) 199.Pf ChaCha20_ Fa k Ns Pq 0
200|| 200||
201.Pf ChaCha20_ Fa k Ns (1) 201.Pf ChaCha20_ Fa k Ns Pq 1
202|| ... as output. 202|| ... as output.
203.Fn arc4random_uniform 203.Fn arc4random_uniform
204repeats 204repeats
205.Fn arc4random 205.Fn arc4random
206until it obtains an integer in [2^32 % 206until it obtains an integer in [2^32 %
207.Fa bound , 207.Fa bound ,
2082^32), and reduces that modulo 2082^32), and reduces that modulo
209.Fa bound . 209.Fa bound .
210.Pp 210.Pp
211The PRNG state is per-thread, unless memory allocation fails inside the 211The PRNG state is per-thread, unless memory allocation fails inside the
212library, in which case some threads may share global PRNG state with a 212library, in which case some threads may share global PRNG state with a
213mutex. 213mutex.
214The global PRNG state is zeroed on fork in the parent via 214The global PRNG state is zeroed on fork in the parent via