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 22 matching lines...) Expand all Loading... |
33 cryptographicallyRandomValues(&result, sizeof(result)); | 33 cryptographicallyRandomValues(&result, sizeof(result)); |
34 return result; | 34 return result; |
35 } | 35 } |
36 | 36 |
37 void cryptographicallyRandomValues(void* buffer, size_t length) { | 37 void cryptographicallyRandomValues(void* buffer, size_t length) { |
38 if (s_shouldUseAlwaysZeroRandomSourceForTesting) { | 38 if (s_shouldUseAlwaysZeroRandomSourceForTesting) { |
39 memset(buffer, '\0', length); | 39 memset(buffer, '\0', length); |
40 return; | 40 return; |
41 } | 41 } |
42 | 42 |
43 // This should really be crypto::RandBytes(), but WTF can't depend on crypto.
The implementation of | 43 // This should really be crypto::RandBytes(), but WTF can't depend on crypto. |
44 // crypto::RandBytes() is just calling base::RandBytes(), so both are actually
same. | 44 // The implementation of crypto::RandBytes() is just calling |
| 45 // base::RandBytes(), so both are actually same. |
45 base::RandBytes(buffer, length); | 46 base::RandBytes(buffer, length); |
46 } | 47 } |
47 | 48 |
48 } // namespace WTF | 49 } // namespace WTF |
OLD | NEW |