]>
git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/corecrypto/ccdrbg_impl.h
5 * Created on 01/03/2012
7 * Copyright (c) 2012,2015 Apple Inc. All rights reserved.
11 #ifndef _CORECRYPTO_CCDRBG_IMPL_H_
12 #define _CORECRYPTO_CCDRBG_IMPL_H_
14 /* opaque drbg structure */
18 /*! Size of the DRBG state in bytes **/
21 /*! Instantiate the PRNG
22 @param prng The PRNG state
23 @param entropylen Length of entropy
24 @param entropy Entropy bytes
25 @param inlen Length of additional input
26 @param in Additional input bytes
27 @return 0 if successful
29 int (*init
)(const struct ccdrbg_info
*info
, struct ccdrbg_state
*drbg
,
30 size_t entropyLength
, const void* entropy
,
31 size_t nonceLength
, const void* nonce
,
32 size_t psLength
, const void* ps
);
34 /*! Add entropy to the PRNG
35 @param prng The PRNG state
36 @param entropylen Length of entropy
37 @param entropy Entropy bytes
38 @param inlen Length of additional input
39 @param in Additional input bytes
40 @return 0 if successful
42 int (*reseed
)(struct ccdrbg_state
*prng
,
43 size_t entropylen
, const void *entropy
,
44 size_t inlen
, const void *in
);
46 /*! Read from the PRNG in a FIPS Testing compliant manor
47 @param prng The PRNG state to read from
48 @param out [out] Where to store the data
49 @param outlen Length of data desired (octets)
50 @param inlen Length of additional input
51 @param in Additional input bytes
52 @return 0 if successfull
54 int (*generate
)(struct ccdrbg_state
*prng
,
55 size_t outlen
, void *out
,
56 size_t inlen
, const void *in
);
58 /*! Terminate a PRNG state
59 @param prng The PRNG state to terminate
61 void (*done
)(struct ccdrbg_state
*prng
);
63 /** private parameters */
69 #endif // _CORECRYPTO_CCDRBG_IMPL_H_