OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * NaCl Service Runtime. Secure RNG. Global singleton. | 8 * NaCl Service Runtime. Secure RNG. Global singleton. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_GLOBAL_SECURE_RANDOM_H_ | 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_GLOBAL_SECURE_RANDOM_H_ |
12 #define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_GLOBAL_SECURE_RANDOM_H_ | 12 #define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_GLOBAL_SECURE_RANDOM_H_ |
13 | 13 |
14 #include "native_client/src/shared/platform/nacl_secure_random.h" | 14 #include "native_client/src/shared/platform/nacl_secure_random.h" |
15 #include "native_client/src/shared/platform/nacl_sync.h" | 15 #include "native_client/src/shared/platform/nacl_sync.h" |
16 | 16 |
17 void NaClGlobalSecureRngInit(void); | 17 void NaClGlobalSecureRngInit(void); |
18 | 18 |
19 void NaClGlobalSecureRngSwitchRngForTesting(struct NaClSecureRng *); | 19 void NaClGlobalSecureRngSwitchRngForTesting(struct NaClSecureRng *); |
20 | 20 |
21 void NaClGlobalSecureRngFini(void); | 21 void NaClGlobalSecureRngFini(void); |
22 | 22 |
23 int32_t NaClGlobalSecureRngUniform(int32_t range_max); | 23 int32_t NaClGlobalSecureRngUniform(int32_t range_max); |
24 | 24 |
25 uint32_t NaClGlobalSecureRngUint32(void); | 25 uint32_t NaClGlobalSecureRngUint32(void); |
26 | 26 |
| 27 void NaClGlobalSecureRngGenerateBytes(uint8_t *buf, size_t buf_size); |
| 28 |
27 /* | 29 /* |
28 * Generate a random alpha-numeric name for a socket, a semaphore or some | 30 * Generate a random alpha-numeric name for a socket, a semaphore or some |
29 * other device. | 31 * other device. |
30 */ | 32 */ |
31 void NaClGenerateRandomPath(char *path, int length); | 33 void NaClGenerateRandomPath(char *path, int length); |
32 | 34 |
33 #endif /* NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_GLOBAL_SECURE_RANDOM_H_ */ | 35 #endif /* NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_GLOBAL_SECURE_RANDOM_H_ */ |
OLD | NEW |