summaryrefslogtreecommitdiffstats
path: root/include/linux/hw_random.h
Commit message (Collapse)AuthorAgeFilesLines
* hw_random: add BCM2835 RNG driverAhmad Fatoum2024-03-151-0/+5
| | | | | | | | | To enable proper hardening with stack protector, add support for the BCM2835 RNG. This has been tested on a Raspberry Pi 3B. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240313105631.686778-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hw_random: add struct hwrng::priv memberAhmad Fatoum2024-03-151-0/+1
| | | | | | | | | | | A number of Linux hw_random drivers use container_of to arrive at the driver private data, but some others use the priv member of struct hwrng. A unsigned long worth of extra malloc space doesn't hurt, so add the same member to barebox too. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240313105631.686778-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: random: make linux/hw_random.h header self-containedAhmad Fatoum2023-09-121-0/+1
| | | | | | | | | struct hwrng defined in the file embeds a struct device, so inclusion of the header defining it is in order. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911121731.2661717-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-2/+2
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: random: add hwrng_get_crypto_bytesAhmad Fatoum2022-10-111-1/+5
| | | | | | | | | | | We already have get_crypto_bytes to get access to hardware generated randomness. barebox as EFI loader would provide a handle for each HWRNG, so add a hwrng_get_crypto_bytes function that can be used to implement the load-side protocol. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221010061122.2084009-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* virtio: implement remove callbacksAhmad Fatoum2021-10-021-0/+2
| | | | | | | | | | | | | | | | | | | | | virtio parent device drivers (e.g. PCI and MMIO) create child devices and free them on remove. The virtio drivers for the child devices (e.g. block and console) however don't unregister with their respective subsystems in the remove callbacks. So these subsystems may have stale pointers pointing at removed devices. This is especially problematic for the console driver, because the virtio console device_d will be removed, but the console itself remains registered leading to a use-after-free as soon as printf is invoked for the previously active console. This leads to a crash when typing reset in https://www.barebox.org/jsbarebox/?graphic=0 Fix this for all virtio drivers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210916093458.21102-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: add simple hw_random implementationSteffen Trumtrar2017-03-301-0/+47
Add a simple hw_random implementation based on code from Linux v4.5-rc5. All the entropypool initialization stuff is left out and the obsolete data_read/data_present calls are omitted. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>