CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
platform
sunburst
platform-entropy.hh
1
#pragma once
2
#include <
interrupt.h
>
3
#include <
platform/concepts/entropy.h
>
4
5
DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY
(ethernetInterruptEntropy,
6
InterruptName::EthernetInterrupt,
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 Sonata instantiation of CHERIoT SAFE that can be used as a
15
* secure entropy source.
16
*/
17
struct 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
(ethernetInterruptEntropy));
30
TrivialInsecureEntropySource::reseed
(interrupts);
31
}
32
};
33
34
static_assert
(
IsEntropySource<EntropySource>
,
35
"EntropySource must be an entropy source"
);
TrivialInsecureEntropySource
A simple entropy source.
Definition
entropy.h:48
TrivialInsecureEntropySource::reseed
void reseed()
Reseed the PRNG.
Definition
entropy.h:85
STATIC_SEALED_VALUE
#define STATIC_SEALED_VALUE(name)
Returns a sealed capability to the named object created with DECLARE_STATIC_SEALED_VALUE.
Definition
compartment-macros.h:360
IsEntropySource
Definition
entropy.h:13
entropy.h
Concept for an Entropy sources and a trivial, insecure implementation using xoroshiro PRNG.
interrupt.h
This file describes the interfaces for compartments to wait for interrupts.
DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY
#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
interrupt_futex_get
const uint32_t * interrupt_futex_get(InterruptCapability interruptcapability)
Request the futex associated with an interrupt.
Generated by
1.18.0