CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
platform-entropy.hh
1#pragma once
2#include <interrupt.h>
4
5DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY(revokerInterruptEntropy,
6 InterruptName::EthernetReceiveInterrupt,
7 true,
8 false)
9
10/**
11 * A simple entropy source. This wraps a few weak entropy sources to seed a
12 * PRNG. It is absolutely not secure and should not be used for anything that
13 * depends on cryptographically secure random numbers! Unfortunately, there is
14 * nothing on the Arty A7 instantiation of CHERIoT SAFE that can be used as a
15 * secure entropy source.
16 */
17struct EntropySource : public TrivialInsecureEntropySource
18{
19 /// Constructor, tries to generate an independent sequence of random numbers
20 EntropySource()
21 {
22 reseed();
23 }
24
25 /// Reseed the PRNG
26 void reseed()
27 {
28 uint32_t interrupts =
29 *interrupt_futex_get(STATIC_SEALED_VALUE(revokerInterruptEntropy));
31 }
32};
33
35 "EntropySource must be an entropy source");
A simple entropy source.
Definition entropy.h:48
void reseed()
Reseed the PRNG.
Definition entropy.h:85
#define STATIC_SEALED_VALUE(name)
Returns a sealed capability to the named object created with DECLARE_STATIC_SEALED_VALUE.
Concept for an Entropy sources and a trivial, insecure implementation using xoroshiro PRNG.
This file describes the interfaces for compartments to wait for interrupts.
#define DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY( name, number, mayWait, mayComplete)
Helper macro to define an interrupt capability without a separate declaration.
Definition interrupt.h:109
const uint32_t * interrupt_futex_get(InterruptCapability interruptcapability)
Request the futex associated with an interrupt.