Skip to content

Commit

Permalink
Merge pull request #576 from cryspen/ntt-panic-free
Browse files Browse the repository at this point in the history
Make ntt panic free
  • Loading branch information
karthikbhargavan authored Sep 29, 2024
2 parents 22f2b93 + de52651 commit f0bd4d2
Show file tree
Hide file tree
Showing 74 changed files with 3,673 additions and 2,178 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libcrux-ml-kem/c/code_gen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Charon: 28d543bfacc902ba9cc2a734b76baae9583892a4
Eurydice: 1a65dbf3758fe310833718c645a64266294a29ac
Karamel: 15d4bce74a2d43e34a64f48f8311b7d9bcb0e152
F*: 3063d19312f8ec3af5945f24ed3ebbb6b6cd9678
Libcrux: a089e8609d2bf2df5c165076a79e3fd30dbf87cf
Libcrux: 098de7d283a7867de9c3e5672d7b3c915ef9b2f1
38 changes: 19 additions & 19 deletions libcrux-ml-kem/c/internal/libcrux_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Eurydice: 1a65dbf3758fe310833718c645a64266294a29ac
* Karamel: 15d4bce74a2d43e34a64f48f8311b7d9bcb0e152
* F*: 3063d19312f8ec3af5945f24ed3ebbb6b6cd9678
* Libcrux: a089e8609d2bf2df5c165076a79e3fd30dbf87cf
* Libcrux: 098de7d283a7867de9c3e5672d7b3c915ef9b2f1
*/

#ifndef __internal_libcrux_core_H
Expand Down Expand Up @@ -69,7 +69,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_5a
with const generics
- SIZE= 1568
*/
libcrux_ml_kem_types_MlKemPublicKey_1f libcrux_ml_kem_types_from_5a_671(
libcrux_ml_kem_types_MlKemPublicKey_1f libcrux_ml_kem_types_from_5a_af1(
uint8_t value[1568U]);

/**
Expand All @@ -82,7 +82,7 @@ with const generics
- PRIVATE_KEY_SIZE= 3168
- PUBLIC_KEY_SIZE= 1568
*/
libcrux_ml_kem_mlkem1024_MlKem1024KeyPair libcrux_ml_kem_types_from_3a_ee1(
libcrux_ml_kem_mlkem1024_MlKem1024KeyPair libcrux_ml_kem_types_from_3a_781(
libcrux_ml_kem_types_MlKemPrivateKey_95 sk,
libcrux_ml_kem_types_MlKemPublicKey_1f pk);

Expand All @@ -95,7 +95,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_7f
with const generics
- SIZE= 3168
*/
libcrux_ml_kem_types_MlKemPrivateKey_95 libcrux_ml_kem_types_from_7f_af1(
libcrux_ml_kem_types_MlKemPrivateKey_95 libcrux_ml_kem_types_from_7f_e61(
uint8_t value[3168U]);

/**
Expand All @@ -107,7 +107,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_5a
with const generics
- SIZE= 1184
*/
libcrux_ml_kem_types_MlKemPublicKey_15 libcrux_ml_kem_types_from_5a_670(
libcrux_ml_kem_types_MlKemPublicKey_15 libcrux_ml_kem_types_from_5a_af0(
uint8_t value[1184U]);

/**
Expand All @@ -120,7 +120,7 @@ with const generics
- PRIVATE_KEY_SIZE= 2400
- PUBLIC_KEY_SIZE= 1184
*/
libcrux_ml_kem_mlkem768_MlKem768KeyPair libcrux_ml_kem_types_from_3a_ee0(
libcrux_ml_kem_mlkem768_MlKem768KeyPair libcrux_ml_kem_types_from_3a_780(
libcrux_ml_kem_types_MlKemPrivateKey_55 sk,
libcrux_ml_kem_types_MlKemPublicKey_15 pk);

Expand All @@ -133,7 +133,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_7f
with const generics
- SIZE= 2400
*/
libcrux_ml_kem_types_MlKemPrivateKey_55 libcrux_ml_kem_types_from_7f_af0(
libcrux_ml_kem_types_MlKemPrivateKey_55 libcrux_ml_kem_types_from_7f_e60(
uint8_t value[2400U]);

/**
Expand All @@ -145,7 +145,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_5a
with const generics
- SIZE= 800
*/
libcrux_ml_kem_types_MlKemPublicKey_be libcrux_ml_kem_types_from_5a_67(
libcrux_ml_kem_types_MlKemPublicKey_be libcrux_ml_kem_types_from_5a_af(
uint8_t value[800U]);

/**
Expand All @@ -158,7 +158,7 @@ with const generics
- PRIVATE_KEY_SIZE= 1632
- PUBLIC_KEY_SIZE= 800
*/
libcrux_ml_kem_types_MlKemKeyPair_cb libcrux_ml_kem_types_from_3a_ee(
libcrux_ml_kem_types_MlKemKeyPair_cb libcrux_ml_kem_types_from_3a_78(
libcrux_ml_kem_types_MlKemPrivateKey_5e sk,
libcrux_ml_kem_types_MlKemPublicKey_be pk);

Expand All @@ -171,7 +171,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_7f
with const generics
- SIZE= 1632
*/
libcrux_ml_kem_types_MlKemPrivateKey_5e libcrux_ml_kem_types_from_7f_af(
libcrux_ml_kem_types_MlKemPrivateKey_5e libcrux_ml_kem_types_from_7f_e6(
uint8_t value[1632U]);

/**
Expand All @@ -182,7 +182,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_slice_fd
with const generics
- SIZE= 1184
*/
uint8_t *libcrux_ml_kem_types_as_slice_fd_fe1(
uint8_t *libcrux_ml_kem_types_as_slice_fd_121(
libcrux_ml_kem_types_MlKemPublicKey_15 *self);

/**
Expand All @@ -194,7 +194,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_01
with const generics
- SIZE= 1088
*/
libcrux_ml_kem_mlkem768_MlKem768Ciphertext libcrux_ml_kem_types_from_01_451(
libcrux_ml_kem_mlkem768_MlKem768Ciphertext libcrux_ml_kem_types_from_01_7b1(
uint8_t value[1088U]);

/**
Expand All @@ -206,7 +206,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_ref_00
with const generics
- SIZE= 1088
*/
Eurydice_slice libcrux_ml_kem_types_as_ref_00_401(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_ae1(
libcrux_ml_kem_mlkem768_MlKem768Ciphertext *self);

/**
Expand All @@ -228,7 +228,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_slice_fd
with const generics
- SIZE= 800
*/
uint8_t *libcrux_ml_kem_types_as_slice_fd_fe0(
uint8_t *libcrux_ml_kem_types_as_slice_fd_120(
libcrux_ml_kem_types_MlKemPublicKey_be *self);

/**
Expand All @@ -240,7 +240,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_01
with const generics
- SIZE= 768
*/
libcrux_ml_kem_types_MlKemCiphertext_e8 libcrux_ml_kem_types_from_01_450(
libcrux_ml_kem_types_MlKemCiphertext_e8 libcrux_ml_kem_types_from_01_7b0(
uint8_t value[768U]);

/**
Expand All @@ -252,7 +252,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_ref_00
with const generics
- SIZE= 768
*/
Eurydice_slice libcrux_ml_kem_types_as_ref_00_400(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_ae0(
libcrux_ml_kem_types_MlKemCiphertext_e8 *self);

/**
Expand All @@ -274,7 +274,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_slice_fd
with const generics
- SIZE= 1568
*/
uint8_t *libcrux_ml_kem_types_as_slice_fd_fe(
uint8_t *libcrux_ml_kem_types_as_slice_fd_12(
libcrux_ml_kem_types_MlKemPublicKey_1f *self);

/**
Expand Down Expand Up @@ -321,7 +321,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_01
with const generics
- SIZE= 1568
*/
libcrux_ml_kem_types_MlKemCiphertext_1f libcrux_ml_kem_types_from_01_45(
libcrux_ml_kem_types_MlKemCiphertext_1f libcrux_ml_kem_types_from_01_7b(
uint8_t value[1568U]);

/**
Expand All @@ -344,7 +344,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_ref_00
with const generics
- SIZE= 1568
*/
Eurydice_slice libcrux_ml_kem_types_as_ref_00_40(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_ae(
libcrux_ml_kem_types_MlKemCiphertext_1f *self);

/**
Expand Down
32 changes: 16 additions & 16 deletions libcrux-ml-kem/c/internal/libcrux_mlkem_avx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Eurydice: 1a65dbf3758fe310833718c645a64266294a29ac
* Karamel: 15d4bce74a2d43e34a64f48f8311b7d9bcb0e152
* F*: 3063d19312f8ec3af5945f24ed3ebbb6b6cd9678
* Libcrux: a089e8609d2bf2df5c165076a79e3fd30dbf87cf
* Libcrux: 098de7d283a7867de9c3e5672d7b3c915ef9b2f1
*/

#ifndef __internal_libcrux_mlkem_avx2_H
Expand Down Expand Up @@ -41,7 +41,7 @@ with const generics
- RANKED_BYTES_PER_RING_ELEMENT= 1152
- PUBLIC_KEY_SIZE= 1184
*/
bool libcrux_ml_kem_ind_cca_validate_public_key_521(uint8_t *public_key);
bool libcrux_ml_kem_ind_cca_validate_public_key_4a1(uint8_t *public_key);

/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key
Expand All @@ -51,7 +51,7 @@ with const generics
- SECRET_KEY_SIZE= 2400
- CIPHERTEXT_SIZE= 1088
*/
bool libcrux_ml_kem_ind_cca_validate_private_key_701(
bool libcrux_ml_kem_ind_cca_validate_private_key_e11(
libcrux_ml_kem_types_MlKemPrivateKey_55 *private_key,
libcrux_ml_kem_mlkem768_MlKem768Ciphertext *_ciphertext);

Expand All @@ -69,7 +69,7 @@ with const generics
- ETA1_RANDOMNESS_SIZE= 128
*/
libcrux_ml_kem_mlkem768_MlKem768KeyPair
libcrux_ml_kem_ind_cca_generate_keypair_0b1(uint8_t randomness[64U]);
libcrux_ml_kem_ind_cca_generate_keypair_d21(uint8_t randomness[64U]);

/**
A monomorphic instance of libcrux_ml_kem.ind_cca.encapsulate
Expand All @@ -90,7 +90,7 @@ with const generics
- ETA2= 2
- ETA2_RANDOMNESS_SIZE= 128
*/
tuple_3c libcrux_ml_kem_ind_cca_encapsulate_a11(
tuple_3c libcrux_ml_kem_ind_cca_encapsulate_f41(
libcrux_ml_kem_types_MlKemPublicKey_15 *public_key,
uint8_t randomness[32U]);

Expand All @@ -116,7 +116,7 @@ with const generics
- ETA2_RANDOMNESS_SIZE= 128
- IMPLICIT_REJECTION_HASH_INPUT_SIZE= 1120
*/
void libcrux_ml_kem_ind_cca_decapsulate_7f1(
void libcrux_ml_kem_ind_cca_decapsulate_6f1(
libcrux_ml_kem_types_MlKemPrivateKey_55 *private_key,
libcrux_ml_kem_mlkem768_MlKem768Ciphertext *ciphertext, uint8_t ret[32U]);

Expand All @@ -128,7 +128,7 @@ with const generics
- RANKED_BYTES_PER_RING_ELEMENT= 1536
- PUBLIC_KEY_SIZE= 1568
*/
bool libcrux_ml_kem_ind_cca_validate_public_key_520(uint8_t *public_key);
bool libcrux_ml_kem_ind_cca_validate_public_key_4a0(uint8_t *public_key);

/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key
Expand All @@ -138,7 +138,7 @@ with const generics
- SECRET_KEY_SIZE= 3168
- CIPHERTEXT_SIZE= 1568
*/
bool libcrux_ml_kem_ind_cca_validate_private_key_700(
bool libcrux_ml_kem_ind_cca_validate_private_key_e10(
libcrux_ml_kem_types_MlKemPrivateKey_95 *private_key,
libcrux_ml_kem_types_MlKemCiphertext_1f *_ciphertext);

Expand All @@ -156,7 +156,7 @@ with const generics
- ETA1_RANDOMNESS_SIZE= 128
*/
libcrux_ml_kem_mlkem1024_MlKem1024KeyPair
libcrux_ml_kem_ind_cca_generate_keypair_0b0(uint8_t randomness[64U]);
libcrux_ml_kem_ind_cca_generate_keypair_d20(uint8_t randomness[64U]);

/**
A monomorphic instance of libcrux_ml_kem.ind_cca.encapsulate
Expand All @@ -177,7 +177,7 @@ with const generics
- ETA2= 2
- ETA2_RANDOMNESS_SIZE= 128
*/
tuple_21 libcrux_ml_kem_ind_cca_encapsulate_a10(
tuple_21 libcrux_ml_kem_ind_cca_encapsulate_f40(
libcrux_ml_kem_types_MlKemPublicKey_1f *public_key,
uint8_t randomness[32U]);

Expand All @@ -203,7 +203,7 @@ with const generics
- ETA2_RANDOMNESS_SIZE= 128
- IMPLICIT_REJECTION_HASH_INPUT_SIZE= 1600
*/
void libcrux_ml_kem_ind_cca_decapsulate_7f0(
void libcrux_ml_kem_ind_cca_decapsulate_6f0(
libcrux_ml_kem_types_MlKemPrivateKey_95 *private_key,
libcrux_ml_kem_types_MlKemCiphertext_1f *ciphertext, uint8_t ret[32U]);

Expand All @@ -215,7 +215,7 @@ with const generics
- RANKED_BYTES_PER_RING_ELEMENT= 768
- PUBLIC_KEY_SIZE= 800
*/
bool libcrux_ml_kem_ind_cca_validate_public_key_52(uint8_t *public_key);
bool libcrux_ml_kem_ind_cca_validate_public_key_4a(uint8_t *public_key);

/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key
Expand All @@ -225,7 +225,7 @@ with const generics
- SECRET_KEY_SIZE= 1632
- CIPHERTEXT_SIZE= 768
*/
bool libcrux_ml_kem_ind_cca_validate_private_key_70(
bool libcrux_ml_kem_ind_cca_validate_private_key_e1(
libcrux_ml_kem_types_MlKemPrivateKey_5e *private_key,
libcrux_ml_kem_types_MlKemCiphertext_e8 *_ciphertext);

Expand All @@ -242,7 +242,7 @@ with const generics
- ETA1= 3
- ETA1_RANDOMNESS_SIZE= 192
*/
libcrux_ml_kem_types_MlKemKeyPair_cb libcrux_ml_kem_ind_cca_generate_keypair_0b(
libcrux_ml_kem_types_MlKemKeyPair_cb libcrux_ml_kem_ind_cca_generate_keypair_d2(
uint8_t randomness[64U]);

/**
Expand All @@ -264,7 +264,7 @@ with const generics
- ETA2= 2
- ETA2_RANDOMNESS_SIZE= 128
*/
tuple_ec libcrux_ml_kem_ind_cca_encapsulate_a1(
tuple_ec libcrux_ml_kem_ind_cca_encapsulate_f4(
libcrux_ml_kem_types_MlKemPublicKey_be *public_key,
uint8_t randomness[32U]);

Expand All @@ -290,7 +290,7 @@ with const generics
- ETA2_RANDOMNESS_SIZE= 128
- IMPLICIT_REJECTION_HASH_INPUT_SIZE= 800
*/
void libcrux_ml_kem_ind_cca_decapsulate_7f(
void libcrux_ml_kem_ind_cca_decapsulate_6f(
libcrux_ml_kem_types_MlKemPrivateKey_5e *private_key,
libcrux_ml_kem_types_MlKemCiphertext_e8 *ciphertext, uint8_t ret[32U]);

Expand Down
Loading

0 comments on commit f0bd4d2

Please sign in to comment.