mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
lx_kit: add random dummy back end
This back end can be used in place of the existing jitterentropy based on in case random is not strictly needed by the component but one wants to use the available 'shadow/drivers/char/random.c' implementation. Issue genodelabs/genode-allwinner#21.
This commit is contained in:
parent
943c9809ed
commit
adf0b893e8
50
repos/dde_linux/src/lib/lx_emul/random_dummy.cc
Normal file
50
repos/dde_linux/src/lib/lx_emul/random_dummy.cc
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* \brief Dummy source of randomness in lx_emul
|
||||
* \author Josef Soentgen
|
||||
* \date 2023-06-13
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* base/include */
|
||||
#include <base/log.h>
|
||||
#include <base/fixed_stdint.h>
|
||||
#include <util/string.h>
|
||||
|
||||
/* dde_linux/src/include */
|
||||
#include <lx_emul/random.h>
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
void lx_emul_random_gen_bytes(void *dst,
|
||||
unsigned long nr_of_bytes)
|
||||
{
|
||||
/* validate arguments */
|
||||
if (dst == nullptr || nr_of_bytes == 0) {
|
||||
error(__func__, " called with invalid args!");
|
||||
return;
|
||||
}
|
||||
|
||||
warning(__func__, ": dummy implementation used, filling buffer with 0s");
|
||||
memset(dst, 0, nr_of_bytes);
|
||||
}
|
||||
|
||||
|
||||
genode_uint32_t lx_emul_random_gen_u32()
|
||||
{
|
||||
warning(__func__, ": dummy implementation used, returning 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
genode_uint64_t lx_emul_random_gen_u64()
|
||||
{
|
||||
warning(__func__, ": dummy implementation used, returning 0");
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user