aboutsummaryrefslogtreecommitdiff
path: root/components/service/crypto/provider/mbedcrypto/entropy_source/mock/mock_entropy_source.c
blob: f7644817072206f337bf5b0d0bb116e2c3caaa49 (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
/*
 * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
#include <mbedtls/entropy_poll.h>
#include <stdint.h>

/*
 * A mock entropy source without any hardware dependencies.  Should not be
 * used in production deployments.
 */
int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen)
{
    ((void) data);
    ((void) output);
    *olen = 0;

    if (len < sizeof(unsigned char) )
        return (0);

    *olen = sizeof(unsigned char);

    return (0);
}