]>
git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/corecrypto/ccdrbg_impl.h
efa1ef9ba3af24cc932c8c80dec3441e0f739993
5 * Created by James Murphy on 12/9/11.
6 * Copyright (c) 2011 Apple Inc. All rights reserved.
10 #ifndef _CORECRYPTO_CCDRBG_IMPL_H_
11 #define _CORECRYPTO_CCDRBG_IMPL_H_
13 /* opaque drbg structure */
17 /** Size of the DRBG state in bytes **/
20 /** Instantiate the PRNG
21 @param prng The PRNG state
22 @param entropylen Length of entropy
23 @param entropy Entropy bytes
24 @param inlen Length of additional input
25 @param in Additional input bytes
26 @return 0 if successful
28 int (*init
)(const struct ccdrbg_info
*info
, struct ccdrbg_state
*drbg
,
29 unsigned long entropyLength
, const void* entropy
,
30 unsigned long nonceLength
, const void* nonce
,
31 unsigned long psLength
, const void* ps
);
33 /** Add entropy to the PRNG
34 @param prng The PRNG state
35 @param entropylen Length of entropy
36 @param entropy Entropy bytes
37 @param inlen Length of additional input
38 @param in Additional input bytes
39 @return 0 if successful
41 int (*reseed
)(struct ccdrbg_state
*prng
,
42 unsigned long entropylen
, const void *entropy
,
43 unsigned long inlen
, const void *in
);
45 /** Read from the PRNG in a FIPS Testing compliant manor
46 @param prng The PRNG state to read from
47 @param out [out] Where to store the data
48 @param outlen Length of data desired (octets)
49 @param inlen Length of additional input
50 @param in Additional input bytes
51 @return 0 if successfull
53 int (*generate
)(struct ccdrbg_state
*prng
,
54 unsigned long outlen
, void *out
,
55 unsigned long inlen
, const void *in
);
57 /** Terminate a PRNG state
58 @param prng The PRNG state to terminate
60 void (*done
)(struct ccdrbg_state
*prng
);
62 /** private parameters */
68 #endif // _CORECRYPTO_CCDRBG_IMPL_H_