blob: 56e90545da784e8604e06f1429b464bc57d04385 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <platform/interface/entropy.h>
/*
* A platform entropy driver that provides a mock implementation that
* always returns a fixed value. Intended for test purposes only.
*/
static int mock_poll(void *context, unsigned char *output, size_t nbyte, size_t *len)
{
(void)context;
(void)output;
*len = 0;
if (nbyte < sizeof(unsigned char) )
return 0;
*len = sizeof(unsigned char);
return 0;
}
int ts_plat_entropy_create(struct ts_plat_entropy_driver *driver, void *config)
{
static const struct ts_plat_entropy_iface iface = { .poll = mock_poll };
(void)config;
driver->context = NULL;
driver->iface = &iface;
return 0;
}
void ts_plat_entropy_destroy(struct ts_plat_entropy_driver *driver)
{
(void)driver;
}
|