1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (C) 2018, ARM Limited 4 * Copyright (C) 2019, Linaro Limited 5 */ 6 7 #ifndef MBED_HELPERS_H 8 #define MBED_HELPERS_H 9 10 #include <crypto/crypto.h> 11 #include <mbedtls/ctr_drbg.h> 12 13 static inline int mbd_rand(void *rng_state __unused, unsigned char *output, 14 size_t len) 15 { 16 if (crypto_rng_read(output, len)) 17 return MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED; 18 return 0; 19 } 20 21 #endif /*MBED_HELPERS_H*/ 22