OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 1996, David Mazieres <dm@uun.org> | 2 * Copyright (c) 1996, David Mazieres <dm@uun.org> |
3 * Copyright (c) 2008, Damien Miller <djm@openbsd.org> | 3 * Copyright (c) 2008, Damien Miller <djm@openbsd.org> |
4 * | 4 * |
5 * Permission to use, copy, modify, and distribute this software for any | 5 * Permission to use, copy, modify, and distribute this software for any |
6 * purpose with or without fee is hereby granted, provided that the above | 6 * purpose with or without fee is hereby granted, provided that the above |
7 * copyright notice and this permission notice appear in all copies. | 7 * copyright notice and this permission notice appear in all copies. |
8 * | 8 * |
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "CryptographicallyRandomNumber.h" | 31 #include "CryptographicallyRandomNumber.h" |
32 | 32 |
33 #include "OSRandomSource.h" | 33 #include "OSRandomSource.h" |
34 #include "StdLibExtras.h" | 34 #include "StdLibExtras.h" |
35 #include "ThreadingPrimitives.h" | 35 #include "ThreadingPrimitives.h" |
36 | 36 |
37 namespace WTF { | 37 namespace WTF { |
38 | 38 |
39 #if USE(OS_RANDOMNESS) | |
40 | |
41 namespace { | 39 namespace { |
42 | 40 |
43 class ARC4Stream { | 41 class ARC4Stream { |
44 public: | 42 public: |
45 ARC4Stream(); | 43 ARC4Stream(); |
46 | 44 |
47 uint8_t i; | 45 uint8_t i; |
48 uint8_t j; | 46 uint8_t j; |
49 uint8_t s[256]; | 47 uint8_t s[256]; |
50 }; | 48 }; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 uint32_t cryptographicallyRandomNumber() | 167 uint32_t cryptographicallyRandomNumber() |
170 { | 168 { |
171 return sharedRandomNumberGenerator().randomNumber(); | 169 return sharedRandomNumberGenerator().randomNumber(); |
172 } | 170 } |
173 | 171 |
174 void cryptographicallyRandomValues(void* buffer, size_t length) | 172 void cryptographicallyRandomValues(void* buffer, size_t length) |
175 { | 173 { |
176 sharedRandomNumberGenerator().randomValues(buffer, length); | 174 sharedRandomNumberGenerator().randomValues(buffer, length); |
177 } | 175 } |
178 | 176 |
179 #endif | |
180 | |
181 } | 177 } |
OLD | NEW |