OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_RAND_UTIL_H_ | 5 #ifndef BASE_RAND_UTIL_H_ |
6 #define BASE_RAND_UTIL_H_ | 6 #define BASE_RAND_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
(...skipping 24 matching lines...) Expand all Loading... |
36 // Fills |output_length| bytes of |output| with cryptographically strong random | 36 // Fills |output_length| bytes of |output| with cryptographically strong random |
37 // data. | 37 // data. |
38 BASE_EXPORT void RandBytes(void* output, size_t output_length); | 38 BASE_EXPORT void RandBytes(void* output, size_t output_length); |
39 | 39 |
40 // Fills a string of length |length| with with cryptographically strong random | 40 // Fills a string of length |length| with with cryptographically strong random |
41 // data and returns it. |length| should be nonzero. | 41 // data and returns it. |length| should be nonzero. |
42 // | 42 // |
43 // Note that this is a variation of |RandBytes| with a different return type. | 43 // Note that this is a variation of |RandBytes| with a different return type. |
44 BASE_EXPORT std::string RandBytesAsString(size_t length); | 44 BASE_EXPORT std::string RandBytesAsString(size_t length); |
45 | 45 |
| 46 #ifdef OS_POSIX |
| 47 BASE_EXPORT int GetUrandomFD(); |
| 48 #endif |
| 49 |
46 } // namespace base | 50 } // namespace base |
47 | 51 |
48 #endif // BASE_RAND_UTIL_H_ | 52 #endif // BASE_RAND_UTIL_H_ |
OLD | NEW |