]>
Commit | Line | Data |
---|---|---|
f427ee49 | 1 | /* Copyright (c) (2012,2015,2016,2019) Apple Inc. All rights reserved. |
fe8ab488 | 2 | * |
f427ee49 A |
3 | * corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which |
4 | * is contained in the License.txt file distributed with corecrypto) and only to | |
5 | * people who accept that license. IMPORTANT: Any license rights granted to you by | |
6 | * Apple Inc. (if any) are limited to internal use within your organization only on | |
7 | * devices and computers you own or control, for the sole purpose of verifying the | |
8 | * security characteristics and correct functioning of the Apple Software. You may | |
9 | * not, directly or indirectly, redistribute the Apple Software or any portions thereof. | |
fe8ab488 A |
10 | */ |
11 | ||
12 | #ifndef _CORECRYPTO_CCDRBG_IMPL_H_ | |
13 | #define _CORECRYPTO_CCDRBG_IMPL_H_ | |
14 | ||
15 | /* opaque drbg structure */ | |
16 | struct ccdrbg_state; | |
17 | ||
18 | struct ccdrbg_info { | |
3e170ce0 | 19 | /*! Size of the DRBG state in bytes **/ |
fe8ab488 A |
20 | size_t size; |
21 | ||
39037602 | 22 | /*! Instantiate the PRNG |
fe8ab488 A |
23 | @param prng The PRNG state |
24 | @param entropylen Length of entropy | |
25 | @param entropy Entropy bytes | |
26 | @param inlen Length of additional input | |
27 | @param in Additional input bytes | |
28 | @return 0 if successful | |
29 | */ | |
2a1bd2d3 | 30 | int (*CC_SPTR(ccdrbg_info, init))(const struct ccdrbg_info *info, struct ccdrbg_state *drbg, |
39037602 A |
31 | size_t entropyLength, const void* entropy, |
32 | size_t nonceLength, const void* nonce, | |
33 | size_t psLength, const void* ps); | |
fe8ab488 | 34 | |
3e170ce0 | 35 | /*! Add entropy to the PRNG |
fe8ab488 A |
36 | @param prng The PRNG state |
37 | @param entropylen Length of entropy | |
38 | @param entropy Entropy bytes | |
39 | @param inlen Length of additional input | |
40 | @param in Additional input bytes | |
41 | @return 0 if successful | |
42 | */ | |
2a1bd2d3 | 43 | int (*CC_SPTR(ccdrbg_info, reseed))(struct ccdrbg_state *prng, |
39037602 A |
44 | size_t entropylen, const void *entropy, |
45 | size_t inlen, const void *in); | |
fe8ab488 | 46 | |
3e170ce0 | 47 | /*! Read from the PRNG in a FIPS Testing compliant manor |
fe8ab488 A |
48 | @param prng The PRNG state to read from |
49 | @param out [out] Where to store the data | |
50 | @param outlen Length of data desired (octets) | |
51 | @param inlen Length of additional input | |
52 | @param in Additional input bytes | |
53 | @return 0 if successfull | |
54 | */ | |
2a1bd2d3 | 55 | int (*CC_SPTR(ccdrbg_info, generate))(struct ccdrbg_state *prng, |
39037602 A |
56 | size_t outlen, void *out, |
57 | size_t inlen, const void *in); | |
fe8ab488 | 58 | |
3e170ce0 | 59 | /*! Terminate a PRNG state |
fe8ab488 A |
60 | @param prng The PRNG state to terminate |
61 | */ | |
2a1bd2d3 | 62 | void (*CC_SPTR(ccdrbg_info, done))(struct ccdrbg_state *prng); |
fe8ab488 A |
63 | |
64 | /** private parameters */ | |
65 | const void *custom; | |
66 | }; | |
67 | ||
68 | ||
69 | ||
70 | #endif // _CORECRYPTO_CCDRBG_IMPL_H_ |