]>
Commit | Line | Data |
---|---|---|
fe8ab488 A |
1 | /* |
2 | * ccdrbg_impl.h | |
3 | * corecrypto | |
4 | * | |
3e170ce0 A |
5 | * Created on 01/03/2012 |
6 | * | |
7 | * Copyright (c) 2012,2015 Apple Inc. All rights reserved. | |
fe8ab488 A |
8 | * |
9 | */ | |
10 | ||
11 | #ifndef _CORECRYPTO_CCDRBG_IMPL_H_ | |
12 | #define _CORECRYPTO_CCDRBG_IMPL_H_ | |
13 | ||
14 | /* opaque drbg structure */ | |
15 | struct ccdrbg_state; | |
16 | ||
17 | struct ccdrbg_info { | |
3e170ce0 | 18 | /*! Size of the DRBG state in bytes **/ |
fe8ab488 A |
19 | size_t size; |
20 | ||
39037602 | 21 | /*! Instantiate the PRNG |
fe8ab488 A |
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 | |
28 | */ | |
29 | int (*init)(const struct ccdrbg_info *info, struct ccdrbg_state *drbg, | |
39037602 A |
30 | size_t entropyLength, const void* entropy, |
31 | size_t nonceLength, const void* nonce, | |
32 | size_t psLength, const void* ps); | |
fe8ab488 | 33 | |
3e170ce0 | 34 | /*! Add entropy to the PRNG |
fe8ab488 A |
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 | |
41 | */ | |
42 | int (*reseed)(struct ccdrbg_state *prng, | |
39037602 A |
43 | size_t entropylen, const void *entropy, |
44 | size_t inlen, const void *in); | |
fe8ab488 | 45 | |
3e170ce0 | 46 | /*! Read from the PRNG in a FIPS Testing compliant manor |
fe8ab488 A |
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 | |
53 | */ | |
54 | int (*generate)(struct ccdrbg_state *prng, | |
39037602 A |
55 | size_t outlen, void *out, |
56 | size_t inlen, const void *in); | |
fe8ab488 | 57 | |
3e170ce0 | 58 | /*! Terminate a PRNG state |
fe8ab488 A |
59 | @param prng The PRNG state to terminate |
60 | */ | |
61 | void (*done)(struct ccdrbg_state *prng); | |
62 | ||
63 | /** private parameters */ | |
64 | const void *custom; | |
65 | }; | |
66 | ||
67 | ||
68 | ||
69 | #endif // _CORECRYPTO_CCDRBG_IMPL_H_ |