1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <lib/rng/trusty_rng.h>
20 #include <lk/compiler.h>
21 #include <stddef.h>
22 #include <stdint.h>
23 
24 __BEGIN_CDECLS
25 
26 /*
27  * These function abstract device-specific details of HWRNG and must be defined
28  * per platform.
29  */
30 
31 /*
32  * hwrng_dev_init() - initialize HWRNG devices
33  *
34  * Return: NO_ERROR on success, a negative error code otherwise.
35  */
36 int hwrng_dev_init(void);
37 
38 /*
39  * trusty_rng_hw_rand() - get hardware-generated random data. Function
40  * definition located in trusty_rng.h.
41  * @buf: buffer to be filled up
42  * @buf_len: requested amount of random data
43  *
44  * Return: NO_ERROR on success, a negative error code otherwise.
45  *
46  * int trusty_rng_hw_rand(uint8_t* data, size_t len);
47  */
48 
49 __END_CDECLS
50