forked from genodelabs/genode
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vfs/xoroshiro: add PRNG plugin using Xoroshiro128+
This plugin provides a PRNG based on the Xoroshiro128+ algorithm that reseeds itself after a specific amount of state was consumed. For more detailed information please take a look at its README in 'repos/os/src/lib/vfs/xoroshiro/README'. Fixes genodelabs#5407.
- Loading branch information
Showing
8 changed files
with
422 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
build { lib/vfs_xoroshiro lib/vfs_jitterentropy } | ||
|
||
create_boot_directory | ||
|
||
import_from_depot \ | ||
[depot_user]/src/[base_src] \ | ||
[depot_user]/src/coreutils \ | ||
[depot_user]/src/init \ | ||
[depot_user]/src/fs_rom \ | ||
[depot_user]/src/libc \ | ||
[depot_user]/src/vfs \ | ||
[depot_user]/src/posix | ||
|
||
install_config { | ||
<config verbose="yes"> | ||
<parent-provides> | ||
<service name="ROM"/> | ||
<service name="LOG"/> | ||
<service name="RM"/> | ||
<service name="CPU"/> | ||
<service name="PD"/> | ||
<service name="IRQ"/> | ||
<service name="IO_MEM"/> | ||
<service name="IO_PORT"/> | ||
</parent-provides> | ||
|
||
<default-route> | ||
<any-service> <parent/> </any-service> | ||
</default-route> | ||
<default caps="100"/> | ||
|
||
<start name="timer"> | ||
<resource name="RAM" quantum="1M"/> | ||
<provides><service name="Timer"/></provides> | ||
</start> | ||
|
||
<start name="vfs"> | ||
<resource name="RAM" quantum="4M"/> | ||
<provides><service name="File_system"/></provides> | ||
<config> | ||
<vfs> | ||
<ram/> | ||
<tar name="coreutils.tar" /> | ||
</vfs> | ||
<default-policy root="/" writeable="yes"/> | ||
</config> | ||
</start> | ||
|
||
<start name="vfs_rom"> | ||
<resource name="RAM" quantum="10M"/> | ||
<binary name="fs_rom"/> | ||
<provides> <service name="ROM"/> </provides> | ||
<config/> | ||
<route> | ||
<service name="File_system"> <child name="vfs"/> </service> | ||
<any-service> <parent/> </any-service> | ||
</route> | ||
</start> | ||
|
||
<start name="/bin/dd" caps="500"> | ||
<resource name="RAM" quantum="16M"/> | ||
<config> | ||
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" | ||
rtc="/dev/null"/> | ||
<vfs> | ||
<dir name="dev"> | ||
<log/> | ||
<null/> | ||
<jitterentropy name="entropy"/> | ||
<xoroshiro name="random" seed_file="/dev/entropy"/> | ||
</dir> | ||
</vfs> | ||
<arg value="dd"/> | ||
<arg value="if=/dev/random"/> | ||
<arg value="of=/dev/null"/> | ||
<arg value="bs=1M"/> | ||
<arg value="count=128"/> | ||
</config> | ||
<route> | ||
<service name="File_system"> <child name="vfs"/> </service> | ||
<service name="ROM" label_suffix=".lib.so"> <parent/> </service> | ||
<service name="ROM" label_last="/bin/dd"> <child name="vfs_rom"/> </service> | ||
<any-service> <parent/> <any-child/> </any-service> | ||
</route> | ||
</start> | ||
|
||
</config> | ||
} | ||
|
||
build_boot_image [build_artifacts] | ||
|
||
append qemu_args " -nographic " | ||
|
||
run_genode_until "child .* exited with exit value 0.*\n" 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
VFS_DIR := $(REP_DIR)/src/lib/vfs/xoroshiro | ||
|
||
SRC_CC := vfs.cc | ||
|
||
# for base/internal/xoroshiro.h | ||
REP_INC_DIR += src/include/base/internal | ||
|
||
LD_OPT += --version-script=$(VFS_DIR)/symbol.map | ||
|
||
SHARED_LIB := yes | ||
|
||
vpath %.cc $(VFS_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
MIRROR_FROM_REP_DIR := src/lib/vfs/xoroshiro lib/mk/vfs_xoroshiro.mk | ||
|
||
content: $(MIRROR_FROM_REP_DIR) LICENSE | ||
|
||
$(MIRROR_FROM_REP_DIR): | ||
$(mirror_from_rep_dir) | ||
|
||
MIRROR_FROM_BASE_DIR := src/include/base/internal/xoroshiro.h | ||
|
||
content: $(MIRROR_FROM_BASE_DIR) | ||
|
||
$(MIRROR_FROM_BASE_DIR): | ||
mkdir -p $(dir $@) | ||
cp -r $(addprefix $(GENODE_DIR)/repos/base/,$@) $(dir $@) | ||
|
||
LICENSE: | ||
cp $(GENODE_DIR)/LICENSE $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2024-12-16 af40f4293fa0bc3a44ff27b6a174d37a0ecce3eb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
base | ||
os | ||
vfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The VFS xoroshiro plugin provides a PRNG based on the Xoroshiro12+ | ||
algorithm. It is seeded initially and reseeded regularly after a fixed | ||
amount of bytes, around 1 MiB, were produced by reading a seed file. | ||
|
||
The plugin supports the following configuration options: | ||
|
||
* :name: sets the file-name under which the plugins exposes itself | ||
to the VFS, the default is 'xoroshiro'. | ||
|
||
* :seed_file: specifies the file in the VFS that is read to reseed | ||
the PRNG, the default is '/dev/entropy'. | ||
|
||
The following examplary config snippets illustrates its usage: | ||
|
||
! <vfs> | ||
! <dir name="dev"> | ||
! <jitterentropy name="entropy"/> | ||
! <xoroshiro name="random"/> | ||
! </dir> | ||
! </vfs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
global: | ||
|
||
vfs_file_system_factory; | ||
|
||
local: | ||
|
||
*; | ||
}; |
Oops, something went wrong.