Skip to content

aead aes constructs added #854

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

Merged
merged 2 commits into from
May 6, 2025
Merged

Conversation

gonatienza
Copy link
Contributor

Hey @reaperhulk,

Included low level bindings for newer APIs for AEAD AES-based constructs (crypto_aead_aegis* from 1.0.19), plus old crypto_aead_aes256gcm*.

size_t crypto_aead_aegis256_keybytes(void);
size_t crypto_aead_aegis256_nsecbytes(void);
size_t crypto_aead_aegis256_npubbytes(void);
size_t crypto_aead_aegis256_abytes(void);
size_t crypto_aead_aegis256_messagebytes_max(void);

size_t crypto_aead_aegis128l_keybytes(void);
size_t crypto_aead_aegis128l_nsecbytes(void);
size_t crypto_aead_aegis128l_npubbytes(void);
size_t crypto_aead_aegis128l_abytes(void);
size_t crypto_aead_aegis128l_messagebytes_max(void);

size_t crypto_aead_aes256gcm_keybytes(void);
size_t crypto_aead_aes256gcm_nsecbytes(void);
size_t crypto_aead_aes256gcm_npubbytes(void);
size_t crypto_aead_aes256gcm_abytes(void);
size_t crypto_aead_aes256gcm_messagebytes_max(void);

int crypto_aead_aegis256_encrypt(unsigned char *c,
                                 unsigned long long *clen_p,
                                 const unsigned char *m,
                                 unsigned long long mlen,
                                 const unsigned char *ad,
                                 unsigned long long adlen,
                                 const unsigned char *nsec,
                                 const unsigned char *npub,
                                 const unsigned char *k);

int crypto_aead_aegis256_decrypt(unsigned char *m,
                                 unsigned long long *mlen_p,
                                 unsigned char *nsec,
                                 const unsigned char *c,
                                 unsigned long long clen,
                                 const unsigned char *ad,
                                 unsigned long long adlen,
                                 const unsigned char *npub,
                                 const unsigned char *k);

int crypto_aead_aegis128l_encrypt(unsigned char *c,
                                  unsigned long long *clen_p,
                                  const unsigned char *m,
                                  unsigned long long mlen,
                                  const unsigned char *ad,
                                  unsigned long long adlen,
                                  const unsigned char *nsec,
                                  const unsigned char *npub,
                                  const unsigned char *k);

int crypto_aead_aegis128l_decrypt(unsigned char *m,
                                  unsigned long long *mlen_p,
                                  unsigned char *nsec,
                                  const unsigned char *c,
                                  unsigned long long clen,
                                  const unsigned char *ad,
                                  unsigned long long adlen,
                                  const unsigned char *npub,
                                  const unsigned char *k);

int crypto_aead_aes256gcm_is_available(void);

int crypto_aead_aes256gcm_encrypt(unsigned char *c,
                                  unsigned long long *clen_p,
                                  const unsigned char *m,
                                  unsigned long long mlen,
                                  const unsigned char *ad,
                                  unsigned long long adlen,
                                  const unsigned char *nsec,
                                  const unsigned char *npub,
                                  const unsigned char *k);

int crypto_aead_aes256gcm_decrypt(unsigned char *m,
                                  unsigned long long *mlen_p,
                                  unsigned char *nsec,
                                  const unsigned char *c,
                                  unsigned long long clen,
                                  const unsigned char *ad,
                                  unsigned long long adlen,
                                  const unsigned char *npub,
                                  const unsigned char *k);

With crypto_aead_aegis* (with AES-NI) I noticed a decent performance bump compared with related AES GCM based constructs from cryptography.

Would be a nice addition for the next release, keeping up to date with the latest libsodium versions.

@gonatienza gonatienza marked this pull request as draft February 5, 2025 20:44
@gonatienza gonatienza marked this pull request as ready for review February 5, 2025 20:45
@gonatienza gonatienza force-pushed the AEAD-AES-CONSTRUCTS branch 2 times, most recently from d1e66bf to aea5975 Compare February 5, 2025 21:19
@gonatienza
Copy link
Contributor Author

Hi @reaperhulk, just making sure you got this one.

@reaperhulk reaperhulk merged commit c1d6caf into pyca:main May 6, 2025
34 checks passed
@reaperhulk
Copy link
Member

Thanks for your patience here, life things have me operating with very limited bandwidth for open source right now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants