1 /* 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. 3 * Use of this source code is governed by a BSD-style license that can be 4 * found in the LICENSE file. 5 */ 6 7 #ifndef _NATIVE_CLIENT_SRC_UNTRUSTED_NACL_NACL_RANDOM_H_ 8 #define _NATIVE_CLIENT_SRC_UNTRUSTED_NACL_NACL_RANDOM_H_ 1 9 10 #include <stddef.h> /* size_t */ 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * nacl_secure_random_init() is deprecated. Calling it before calling 18 * nacl_secure_random() is no longer required. It always returns 0, 19 * indicating success. 20 */ 21 extern int nacl_secure_random_init(void); 22 23 /** 24 * @nacl 25 * Obtain secure random bytes (note: non-blocking). 26 * @param dest Destination address. 27 * @param bytes Number of bytes to write to dest. 28 * @param bytes_written Pointer to a size_t which will hold the number of 29 * bytes written to dest. 30 * @return Returns zero on success, or a non-zero error number on failure. 31 */ 32 extern int nacl_secure_random(void *dest, size_t bytes, size_t *bytes_written); 33 34 #ifdef __cplusplus 35 } 36 #endif 37 38 #endif /* _NATIVE_CLIENT_SRC_UNTRUSTED_NACL_NACL_RANDOM_H_ */ 39