Conversation
Add an implementation in 8051 assembler for the generation of a ChaCha20 keystream and an encryption function using the keystream in C. A test function using the example from RFC7539 is provided in chacha20_test. Keys, nonce, and block counter and the pointers to the input plaintext, its length and the output pointer are provided via a struct chacha20, which also holds the working state of the ChaCha20 algorithm
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add an implementation in 8051 assembler for the generation of a ChaCha20 keystream and an encryption function using the keystream in C.
A test function using the example from RFC7539 is provided in chacha20_test.
Keys, nonce, and block counter and the pointers to the input plaintext, its length and the output pointer are provided via a struct chacha20, which also holds the working state of the ChaCha20 algorithm.
ChaCha20 can be used together with Poly1305 in the Authenticated Encryption with Associated Data (AEAD) implementation CHACHA20POLY1305, which is used e.g. in Wireguard and in TLS, which both Firefox and Chrome support it. In a next step, Poly1305 will be implemented, an 8-bit implementation exists. The final step for use in Wireguard/TLS, will require an implementation for DiffieHellman key exchange using Curve25519, for which an 8-bit microcontroller implementation also exists.
To test, call
chacha20_test()inrtlplayground.cThe output will be:
Currently, no applications are provided, but the code could be used to encrypt e.g. the password.