-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/ukswrand: Add Fortuna PRNG #1412
Draft
Alex-deVis
wants to merge
45
commits into
unikraft:staging
Choose a base branch
from
Alex-deVis:add-fortuna
base: staging
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
Add unmodified files from the freeBSD implementation. This commit shoul be adapted and removed at some point as it does not compile.
I haven't found an equivalent in Unikraft and couldn't determine what is its purpose in FreeBSD.
Remove machine/endian.h as it has no equivalent in Unikraft. Remove typedefs covered by stdint.h: uint8_t, uint16_t, uint32_t, uint64_t.
So far this only contains the files required for chacha20. I opted for this approach to avoid name conflicts with the current chacha implmentation.
The first covers uint8_t and uint32_t types and the second covers the definition of NULL.
This contains a test file and a Makefile for it. They should be adapted in the future.
Do not add the sources for sha*_arm64.c in the Makefile.uk yet.
Keep the internal directory organisation from FreeBSD in the fortuna-utils directory. Hence, move sha2, chacha20, and rijndael to fortuna-utils/crypto.
Remove files that are not referrenced by any of the other files so far.
Initially, I assumed there will be fewer dependencies so I opted to change the file structure of fortuna. I was wrong, moving everything back into place.
Required for EINVAL error code and uint*_t types
KASSERT gets a condition and a message. For now, ignore the message and only call assert on the condition.
I could not find an implmentation for explicit_bzero in the freeBSD source. Use a stub for the moment and leave a TODO to replace it later.
Use uk_early_initcall() to cover the init function. This approach lacks the initialisation of data however.
This header contains struct harvest_event. In case of freebsd src it is included from the unit_test.h when _KERNEL is not defined.
It conditionally adds the random_entropy_source enum required by fortuna.c.
github-actions
bot
added
area/lib
Internal Unikraft Microlibrary
lang/c
Issues or PRs to do with C/C++
lib/nolibc
Only neccessary subset of libc functionality
lib/ukswrand
labels
May 10, 2024
Add comments on how to handle SYSINIT not passing the data argument to the initialization function.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/lib
Internal Unikraft Microlibrary
lang/c
Issues or PRs to do with C/C++
lib/nolibc
Only neccessary subset of libc functionality
lib/ukswrand
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
Description of changes
This PR aims to integrate the FreeBSD implementation of Fortuna into Unikraft as a replacement for ChaCha20. The source code of the algorithm spans multiple files, thus a similar file hierarchy must be created to avoid striving away from the source implementation. These dependencies are stored in
ukswrand/fortuna-utils
.