aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/doc
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-03-12 17:20:00 +0000
committerGuilherme Andrade <[email protected]>2017-03-14 23:53:39 +0000
commitd07008a0562d1f83dcab144fdec9fd920deb2b96 (patch)
tree1e2aa60f891b6f2c47e85ded243d94d918bef9f4 /lib/crypto/doc
parent27df945c35aa541330700d75b6844de9886361b2 (diff)
downloadotp-d07008a0562d1f83dcab144fdec9fd920deb2b96.tar.gz
otp-d07008a0562d1f83dcab144fdec9fd920deb2b96.tar.bz2
otp-d07008a0562d1f83dcab144fdec9fd920deb2b96.zip
Support generation of strong random numbers
Diffstat (limited to 'lib/crypto/doc')
-rw-r--r--lib/crypto/doc/src/crypto.xml46
1 files changed, 42 insertions, 4 deletions
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index d0deaceaaf..0697f6a202 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -658,10 +658,13 @@
</type>
<desc>
<p>Set the seed for PRNG to the given binary. This calls the
- RAND_seed function from openssl. Only use this if the system
- you are running on does not have enough "randomness" built in.
- Normally this is when <seealso marker="#strong_rand_bytes/1">
- strong_rand_bytes/1</seealso> returns <c>low_entropy</c></p>
+ RAND_seed function from openssl. Only use this if the system
+ you are running on does not have enough "randomness" built in.
+ Normally this is when either
+ <seealso marker="#strong_rand_bytes/1">strong_rand_bytes/1</seealso>,
+ <seealso marker="#strong_rand_uniform/0">strong_rand_uniform/0</seealso> or
+ <seealso marker="#strong_rand_uniform/1">strong_rand_uniform/1</seealso>
+ throws <c>low_entropy</c></p>
</desc>
</func>
@@ -728,6 +731,41 @@
failed due to lack of secure "randomness".</p>
</desc>
</func>
+
+ <func>
+ <name>strong_rand_uniform() -> X</name>
+ <fsummary>Generate a random floating point number between 0.0 and 1.0</fsummary>
+ <type>
+ <v>X = float()</v>
+ </type>
+ <desc>
+ <p>Generates a random floating pointer number uniformly distributed
+ in the value range <c><![CDATA[X, 0.0 < X < 1.0.]]></c>
+ Uses a cryptographically secure prng seeded and periodically mixed with operating system
+ provided entropy. By default this is the <c>BN_rand_range</c> method from OpenSSL.</p>
+ <p>May throw exception <c>low_entropy</c> in case the random generator
+ failed due to lack of secure "randomness".</p>
+ <note><p>The generated values shall present no more than 51 bits of effective entropy.</p></note>
+ </desc>
+ </func>
+
+ <func>
+ <name>strong_rand_uniform(N) -> X</name>
+ <fsummary>Generate a random positive integer between 1 and N</fsummary>
+ <type>
+ <v>N = pos_integer()</v>
+ <v>X = 1..N</v>
+ </type>
+ <desc>
+ <p>Generates a a random positive integer uniformly distributed
+ in the value range <c><![CDATA[X, 1 =< X =< N.]]></c>
+ Uses a cryptographically secure prng seeded and periodically mixed with operating system
+ provided entropy. By default this is the <c>BN_rand_range</c> method from OpenSSL.</p>
+ <p>May throw exception <c>low_entropy</c> in case the random generator
+ failed due to lack of secure "randomness".</p>
+ </desc>
+ </func>
+
<func>
<name>stream_init(Type, Key) -> State</name>
<fsummary></fsummary>