2 * Copyright 2008 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.
8 * NaCl Service Runtime. Secure RNG abstraction. Base class.
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_SECURE_RANDOM_BASE_H_
12 #define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_SECURE_RANDOM_BASE_H_
14 #include "native_client/src/include/portability.h"
16 #include "native_client/src/include/nacl_base.h"
20 struct NaClSecureRngIf; /* fwd: base interface class */
22 struct NaClSecureRngIfVtbl {
23 void (*Dtor)(struct NaClSecureRngIf *self);
25 * Generates a uniform random 8-bit byte (uint8_t).
27 uint8_t (*GenByte)(struct NaClSecureRngIf *self);
29 * Generates a uniform random 32-bit unsigned int.
31 uint32_t (*GenUint32)(struct NaClSecureRngIf *self);
33 * Generate an uniformly random number in [0, range_max). May invoke
34 * the provided generator multiple times.
36 void (*GenBytes)(struct NaClSecureRngIf *self,
39 uint32_t (*Uniform)(struct NaClSecureRngIf *self,
43 struct NaClSecureRngIf {
44 struct NaClSecureRngIfVtbl const *vtbl;
49 #endif /* NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_SECURE_RANDOM_BASE_H_ */