Skip to content
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

AEGIS Implementation #167

Merged
merged 6 commits into from
Apr 17, 2024
Merged

AEGIS Implementation #167

merged 6 commits into from
Apr 17, 2024

Conversation

paragonie-security
Copy link
Contributor

@paragonie-security paragonie-security commented Apr 16, 2024

Fixes #162 when merged.

RFC: https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead

  • Implement bitsliced AES
  • Implement AEGIS-128L
  • Implement AEGIS-256
  • Expose public APIs for AEGIS
  • Add compat tests for PHP 8.4+

Implement bitsliced AES

This is the first step towards implementing AEGIS-128L and AEGIS-256 in pure PHP, with the eventual hope of polyfilling those functions ahead of their landing in PHP 8.4's ext-sodium.

While we may be able to use a table look-up version of AES for the actual bulk data processing for AEGIS, we do at least want a bitsliced implementation of the AES round function for the Init() step.

This implementation is based heavily on the work of Thomas Pornin's BearSSL project.

See https://www.bearssl.org/constanttime.html#aes

Implement AEGIS-128L and AEGIS-256

We specified an aesRound method on ParagonIE_Sodium_Core_AES that uses our bitsliced AES implementation to perform one round with an arbitrary round key (rather than relying on the key schedule primitive).

The implementation follows the RFC draft, including the provided test vectors.

Expose public APIs for AEGIS

Pretty straightforward. Our typical boilerplate, reused.

Add compat tests for PHP 8.4+

Added a new test that will only run on PHP 8.4 to compare the public APIs.

This is the first step towards implementing AEGIS-128L and AEGIS-256 in pure PHP, with the eventual hope of polyfilling those functions ahead of their landing in PHP 8.4's ext-sodium.

While we *may* be able to use a table look-up version of AES for the actual bulk data processing for AEGIS, we do _at least_ want a bitsliced implementation of the AES round function for the Init() step.

This implementation is based heavily on the work of Thomas Pornin's BearSSL project.

See https://www.bearssl.org/constanttime.html#aes
@paragonie-security paragonie-security marked this pull request as ready for review April 17, 2024 07:45
@paragonie-security paragonie-security merged commit 40f4987 into master Apr 17, 2024
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AEAD - AEGIS-128L and AEGIS-256
1 participant