1//
2//  CommonRandomPriv.h
3//  CommonCrypto
4//
5//  Created by Richard Murphy on 6/11/12.
6//  Copyright (c) 2012 Platform Security. All rights reserved.
7//
8
9#ifndef CommonCrypto_CommonRandomPriv_h
10#define CommonCrypto_CommonRandomPriv_h
11
12#include <corecrypto/ccdrbg.h>
13#include <corecrypto/ccrng_CommonCrypto.h>
14#include <corecrypto/ccrng_system.h>
15
16/*
17 This is an internal structure used to represent the two types
18 of random number generators we're using.
19 */
20
21typedef struct drbgrng_t {
22    struct ccrng_CommonCrypto_state *rng_state;
23    struct ccdrbg_info *info;
24    struct ccdrbg_state *drbg_state;
25} drbg_rng;
26
27typedef struct devrandom_t {
28    struct ccrng_system_state *devrandom;
29    uint8_t *bytes;
30} devrandom_rng;
31
32typedef struct __CCRandom {
33    uint32_t rngtype;
34    union {
35        drbg_rng drbg;
36        devrandom_rng devrandom;
37    } state;
38    int status;
39} ccInternalRandom, *ccInternalRandomRef;
40
41
42#endif
43