xref: /aosp_15_r20/external/rappor/doc/randomness.md (revision 2abb31345f6c95944768b5222a9a5ed3fc68cc00)
1*2abb3134SXin LiGenerating Random Bits for RAPPOR
2*2abb3134SXin Li=================================
3*2abb3134SXin Li
4*2abb3134SXin LiTo ensure privacy, an application using RAPPOR must generate random bits in an
5*2abb3134SXin Liunpredictable manner.  In other words, an adversary that can predict the
6*2abb3134SXin Lisequence of random bits used can determine the true values being reported.
7*2abb3134SXin Li
8*2abb3134SXin LiGenerating random numbers is highly platform-specific -- even
9*2abb3134SXin Lilanguage-specific.  So, libraries implementing RAPPOR should be parameterized
10*2abb3134SXin Liby an interface to generate random bits.  (This can be thought of as
11*2abb3134SXin Li"dependency injection".)
12*2abb3134SXin Li
13*2abb3134SXin Li<!-- TODO: details on the interfaces, once we have them in more than one
14*2abb3134SXin Li     language -->
15*2abb3134SXin Li
16*2abb3134SXin Li
17*2abb3134SXin LiFor now, we have collected some useful links.
18*2abb3134SXin Li
19*2abb3134SXin LiLinux
20*2abb3134SXin Li-----
21*2abb3134SXin Li
22*2abb3134SXin Li* [Myths about /dev/urandom](http://www.2uo.de/myths-about-urandom/) -- Nice
23*2abb3134SXin Li  article explaining implementation aspects of `/dev/urandom` and `/dev/random`
24*2abb3134SXin Li  on Linux.  (Summary: just use `/dev/urandom`, with caveats explained)
25*2abb3134SXin Li
26*2abb3134SXin Li* [LWN on getrandom](http://lwn.net/Articles/606141/)
27*2abb3134SXin Li  ([patch](http://lwn.net/Articles/605828/)) -- A very recent addition to the
28*2abb3134SXin Li  Linux kernel.  As of this writing (11/2014), it's safe to say that very few
29*2abb3134SXin Li  applications use it.  The relevant change, involving an issue mentioned in
30*2abb3134SXin Li  the first link, involves the situation at system boot, when there is little
31*2abb3134SXin Li  entropy available.
32*2abb3134SXin Li
33*2abb3134SXin Li
34*2abb3134SXin Li<!-- TODO: other platforms.  Chrome uses /dev/urandom on Linux.  What about
35*2abb3134SXin Li     other platforms?  -->
36*2abb3134SXin Li
37*2abb3134SXin Li<!-- TODO: when we have a C/C++ client, explain provide sample implementation
38*2abb3134SXin Li     using simple C functions -->
39