]> git.saurik.com Git - apple/xnu.git/blame - EXTERNAL_HEADERS/corecrypto/ccrng_system.h
xnu-4903.270.47.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / ccrng_system.h
CommitLineData
316670eb
A
1/*
2 * ccrng_system.h
3 * corecrypto
4 *
3e170ce0
A
5 * Created on 12/13/2010
6 *
7 * Copyright (c) 2010,2013,2014,2015 Apple Inc. All rights reserved.
316670eb
A
8 *
9 */
10
11#ifndef _CORECRYPTO_CCRNG_SYSTEM_H_
12#define _CORECRYPTO_CCRNG_SYSTEM_H_
13
14#include <corecrypto/ccrng.h>
15
16struct ccrng_system_state {
17 CCRNG_STATE_COMMON
18 int fd;
19};
20
39037602
A
21/*!
22 @function ccrng_system_init - DEPRECATED
23 @abstract Default ccrng.
24 Please transition to ccrng() which is easier to use and with provide the fastest, most secure option
25
26 @param rng Structure containing the state of the RNG, must remain allocated as
27 long as the rng is used.
28 @result 0 iff successful
29
30 @discussion
31 This RNG require call to "init" AND "done", otherwise it may leak a file descriptor.
32 */
33
34// Initialize ccrng
35// Deprecated, if you need a rng, just call the function ccrng()
316670eb
A
36int ccrng_system_init(struct ccrng_system_state *rng);
37
3e170ce0
A
38// Close the system RNG
39// Mandatory step to avoid leaking file descriptor
fe8ab488
A
40void ccrng_system_done(struct ccrng_system_state *rng);
41
316670eb 42#endif /* _CORECRYPTO_CCRNG_SYSTEM_H_ */