]> git.saurik.com Git - apple/xnu.git/blame - EXTERNAL_HEADERS/corecrypto/ccrng.h
xnu-3789.1.32.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / ccrng.h
CommitLineData
316670eb
A
1/*
2 * ccrng.h
3 * corecrypto
4 *
3e170ce0
A
5 * Created on 12/13/2010
6 *
7 * Copyright (c) 2010,2011,2013,2014,2015 Apple Inc. All rights reserved.
316670eb
A
8 *
9 */
10
316670eb
A
11#ifndef _CORECRYPTO_CCRNG_H_
12#define _CORECRYPTO_CCRNG_H_
13
14#include <stdint.h>
15
39037602
A
16#include <corecrypto/cc.h>
17
18#define CC_ERR_DEVICE -100
19#define CC_ERR_INTERUPTS -101
20#define CC_ERR_CRYPTO_CONFIG -102
21#define CC_ERR_PERMS -103
22#define CC_ERR_PARAMETER -104
23#define CC_ERR_MEMORY -105
24#define CC_ERR_FILEDESC -106
25#define CC_ERR_OUT_OF_ENTROPY -107
26#define CC_ERR_INTERNAL -108
27#define CC_ERR_ATFORK -109
28#define CC_ERR_OVERFLOW -110
fe8ab488 29
316670eb 30#define CCRNG_STATE_COMMON \
39037602
A
31 int (*generate)(struct ccrng_state *rng, size_t outlen, void *out);
32
33/* Get a pointer to a ccrng has never been simpler! Just call this */
34struct ccrng_state *ccrng(int *error);
316670eb
A
35
36/* default state structure - do not instantiate, instead use the specific one you need */
37struct ccrng_state {
38 CCRNG_STATE_COMMON
39};
40
41#define ccrng_generate(ctx, outlen, out) ((ctx)->generate((ctx), (outlen), (out)))
42
43#endif /* _CORECRYPTO_CCRNG_H_ */