Skip to content

Commit

Permalink
refreshed C code
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikbhargavan committed Oct 30, 2024
1 parent 020cd93 commit 7f7e08c
Show file tree
Hide file tree
Showing 42 changed files with 1,977 additions and 2,037 deletions.
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: 098de7d283a7867de9c3e5672d7b3c915ef9b2f1
Libcrux: 020cd93ab7a1437ba4a4c626b1acbf9fa14525ad
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: 098de7d283a7867de9c3e5672d7b3c915ef9b2f1
* Libcrux: 020cd93ab7a1437ba4a4c626b1acbf9fa14525ad
*/

#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_af1(
libcrux_ml_kem_types_MlKemPublicKey_1f libcrux_ml_kem_types_from_5a_451(
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_781(
libcrux_ml_kem_mlkem1024_MlKem1024KeyPair libcrux_ml_kem_types_from_3a_f61(
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_e61(
libcrux_ml_kem_types_MlKemPrivateKey_95 libcrux_ml_kem_types_from_7f_8c1(
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_af0(
libcrux_ml_kem_types_MlKemPublicKey_15 libcrux_ml_kem_types_from_5a_450(
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_780(
libcrux_ml_kem_mlkem768_MlKem768KeyPair libcrux_ml_kem_types_from_3a_f60(
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_e60(
libcrux_ml_kem_types_MlKemPrivateKey_55 libcrux_ml_kem_types_from_7f_8c0(
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_af(
libcrux_ml_kem_types_MlKemPublicKey_be libcrux_ml_kem_types_from_5a_45(
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_78(
libcrux_ml_kem_types_MlKemKeyPair_cb libcrux_ml_kem_types_from_3a_f6(
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_e6(
libcrux_ml_kem_types_MlKemPrivateKey_5e libcrux_ml_kem_types_from_7f_8c(
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_121(
uint8_t *libcrux_ml_kem_types_as_slice_fd_d11(
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_7b1(
libcrux_ml_kem_mlkem768_MlKem768Ciphertext libcrux_ml_kem_types_from_01_3a1(
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_ae1(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_be1(
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_120(
uint8_t *libcrux_ml_kem_types_as_slice_fd_d10(
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_7b0(
libcrux_ml_kem_types_MlKemCiphertext_e8 libcrux_ml_kem_types_from_01_3a0(
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_ae0(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_be0(
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_12(
uint8_t *libcrux_ml_kem_types_as_slice_fd_d1(
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_7b(
libcrux_ml_kem_types_MlKemCiphertext_1f libcrux_ml_kem_types_from_01_3a(
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_ae(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_be(
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: 098de7d283a7867de9c3e5672d7b3c915ef9b2f1
* Libcrux: 020cd93ab7a1437ba4a4c626b1acbf9fa14525ad
*/

#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_4a1(uint8_t *public_key);
bool libcrux_ml_kem_ind_cca_validate_public_key_db1(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_e11(
bool libcrux_ml_kem_ind_cca_validate_private_key_a81(
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_d21(uint8_t randomness[64U]);
libcrux_ml_kem_ind_cca_generate_keypair_dd1(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_f41(
tuple_3c libcrux_ml_kem_ind_cca_encapsulate_791(
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_6f1(
void libcrux_ml_kem_ind_cca_decapsulate_cd1(
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_4a0(uint8_t *public_key);
bool libcrux_ml_kem_ind_cca_validate_public_key_db0(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_e10(
bool libcrux_ml_kem_ind_cca_validate_private_key_a80(
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_d20(uint8_t randomness[64U]);
libcrux_ml_kem_ind_cca_generate_keypair_dd0(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_f40(
tuple_21 libcrux_ml_kem_ind_cca_encapsulate_790(
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_6f0(
void libcrux_ml_kem_ind_cca_decapsulate_cd0(
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_4a(uint8_t *public_key);
bool libcrux_ml_kem_ind_cca_validate_public_key_db(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_e1(
bool libcrux_ml_kem_ind_cca_validate_private_key_a8(
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_d2(
libcrux_ml_kem_types_MlKemKeyPair_cb libcrux_ml_kem_ind_cca_generate_keypair_dd(
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_f4(
tuple_ec libcrux_ml_kem_ind_cca_encapsulate_79(
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_6f(
void libcrux_ml_kem_ind_cca_decapsulate_cd(
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 7f7e08c

Please sign in to comment.