Skip to content

Commit

Permalink
Update C extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Aug 27, 2024
1 parent 264dbfd commit 1def0c1
Show file tree
Hide file tree
Showing 42 changed files with 1,808 additions and 1,148 deletions.
8 changes: 4 additions & 4 deletions libcrux-ml-kem/c/code_gen.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This code was generated with the following revisions:
Charon: 962f26311ccdf09a6a3cfeacbccafba22bf3d405
Eurydice: e66abbc2119485abfafa17c1911bdbdada5b04f3
Karamel: 7862fdc3899b718d39ec98568f78ec40592a622a
Charon: 3f39fa18bb6efe2199d17b8f79b10d4127d24289
Eurydice: cd5c9e55b3c032977eccf22edd8a91b4b02e338e
Karamel: 2dfc25438318f1d832ad6d2d2b595cb870466fc3
F*: a32b316e521fa4f239b610ec8f1d15e78d62cbe8-dirty
Libcrux: 9a130a852767d2f8881c458e022bf35fec1f6afe
Libcrux: 919a6a57fe3548db83f6416d540116c2c8a9f2c1
3 changes: 3 additions & 0 deletions libcrux-ml-kem/c/eurydice_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ typedef struct {
#define core_array_equality___core__cmp__PartialEq__Array_U__N___for__Array_T__N____eq( \
sz, a1, a2, t, _, _ret_t) \
Eurydice_array_eq(sz, a1, a2, t, _)
#define core_array_equality___core__cmp__PartialEq__0___Slice_U____for__Array_T__N___3__eq( \
sz, a1, a2, t, _, _ret_t) \
Eurydice_array_eq(sz, a1, a2, t, _)

#define Eurydice_slice_split_at(slice, mid, element_type, ret_t) \
(CLITERAL(ret_t){ \
Expand Down
26 changes: 13 additions & 13 deletions libcrux-ml-kem/c/internal/libcrux_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* SPDX-License-Identifier: MIT or Apache-2.0
*
* This code was generated with the following revisions:
* Charon: 962f26311ccdf09a6a3cfeacbccafba22bf3d405
* Eurydice: e66abbc2119485abfafa17c1911bdbdada5b04f3
* Karamel: 7862fdc3899b718d39ec98568f78ec40592a622a
* Charon: 3f39fa18bb6efe2199d17b8f79b10d4127d24289
* Eurydice: cd5c9e55b3c032977eccf22edd8a91b4b02e338e
* Karamel: 2dfc25438318f1d832ad6d2d2b595cb870466fc3
* F*: a32b316e521fa4f239b610ec8f1d15e78d62cbe8-dirty
* Libcrux: 9a130a852767d2f8881c458e022bf35fec1f6afe
* Libcrux: 919a6a57fe3548db83f6416d540116c2c8a9f2c1
*/

#ifndef __internal_libcrux_core_H
Expand Down Expand Up @@ -110,7 +110,7 @@ A monomorphic instance of libcrux_ml_kem.types.from_01
with const generics
- SIZE= 1568
*/
libcrux_ml_kem_mlkem1024_MlKem1024Ciphertext libcrux_ml_kem_types_from_01_a91(
libcrux_ml_kem_mlkem1024_MlKem1024Ciphertext libcrux_ml_kem_types_from_01_e91(
uint8_t value[1568U]);

/**
Expand All @@ -124,7 +124,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_slice_cb
with const generics
- SIZE= 1568
*/
uint8_t *libcrux_ml_kem_types_as_slice_cb_f11(
uint8_t *libcrux_ml_kem_types_as_slice_cb_5c1(
libcrux_ml_kem_types_MlKemPublicKey_1f *self);

/**
Expand All @@ -136,7 +136,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_a61(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_f11(
libcrux_ml_kem_mlkem1024_MlKem1024Ciphertext *self);

/**
Expand Down Expand Up @@ -200,7 +200,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_a90(
libcrux_ml_kem_mlkem768_MlKem768Ciphertext libcrux_ml_kem_types_from_01_e90(
uint8_t value[1088U]);

/**
Expand All @@ -214,7 +214,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_slice_cb
with const generics
- SIZE= 1184
*/
uint8_t *libcrux_ml_kem_types_as_slice_cb_f10(
uint8_t *libcrux_ml_kem_types_as_slice_cb_5c0(
libcrux_ml_kem_types_MlKemPublicKey_15 *self);

/**
Expand All @@ -226,7 +226,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_a60(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_f10(
libcrux_ml_kem_mlkem768_MlKem768Ciphertext *self);

/**
Expand Down Expand Up @@ -313,7 +313,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_a9(
libcrux_ml_kem_types_MlKemCiphertext_e8 libcrux_ml_kem_types_from_01_e9(
uint8_t value[768U]);

/**
Expand All @@ -327,7 +327,7 @@ A monomorphic instance of libcrux_ml_kem.types.as_slice_cb
with const generics
- SIZE= 800
*/
uint8_t *libcrux_ml_kem_types_as_slice_cb_f1(
uint8_t *libcrux_ml_kem_types_as_slice_cb_5c(
libcrux_ml_kem_types_MlKemPublicKey_be *self);

/**
Expand Down Expand Up @@ -361,7 +361,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_a6(
Eurydice_slice libcrux_ml_kem_types_as_ref_00_f1(
libcrux_ml_kem_types_MlKemCiphertext_e8 *self);

/**
Expand Down
98 changes: 88 additions & 10 deletions libcrux-ml-kem/c/internal/libcrux_mlkem_avx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* SPDX-License-Identifier: MIT or Apache-2.0
*
* This code was generated with the following revisions:
* Charon: 962f26311ccdf09a6a3cfeacbccafba22bf3d405
* Eurydice: e66abbc2119485abfafa17c1911bdbdada5b04f3
* Karamel: 7862fdc3899b718d39ec98568f78ec40592a622a
* Charon: 3f39fa18bb6efe2199d17b8f79b10d4127d24289
* Eurydice: cd5c9e55b3c032977eccf22edd8a91b4b02e338e
* Karamel: 2dfc25438318f1d832ad6d2d2b595cb870466fc3
* F*: a32b316e521fa4f239b610ec8f1d15e78d62cbe8-dirty
* Libcrux: 9a130a852767d2f8881c458e022bf35fec1f6afe
* Libcrux: 919a6a57fe3548db83f6416d540116c2c8a9f2c1
*/

#ifndef __internal_libcrux_mlkem_avx2_H
Expand All @@ -33,6 +33,13 @@ typedef struct libcrux_ml_kem_polynomial_PolynomialRingElement_d2_s {
__m256i coefficients[16U];
} libcrux_ml_kem_polynomial_PolynomialRingElement_d2;

/**
Validate an ML-KEM public key.
This implements the Modulus check in 7.2 2.
Note that the size check in 7.2 1 is covered by the `PUBLIC_KEY_SIZE` in the
`public_key` type.
*/
/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_public_key
with types libcrux_ml_kem_vector_avx2_SIMD256Vector
Expand All @@ -43,6 +50,25 @@ with const generics
*/
bool libcrux_ml_kem_ind_cca_validate_public_key_0a1(uint8_t *public_key);

/**
Validate an ML-KEM private key.
This implements the Hash check in 7.3 3.
Note that the size checks in 7.2 1 and 2 are covered by the `SECRET_KEY_SIZE`
and `CIPHERTEXT_SIZE` in the `private_key` and `ciphertext` types.
*/
/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key
with types libcrux_ml_kem_hash_functions_avx2_Simd256Hash
with const generics
- K= 3
- SECRET_KEY_SIZE= 2400
- CIPHERTEXT_SIZE= 1088
*/
bool libcrux_ml_kem_ind_cca_validate_private_key_1d1(
libcrux_ml_kem_types_MlKemPrivateKey_55 *private_key,
libcrux_ml_kem_mlkem768_MlKem768Ciphertext *_ciphertext);

/**
Packed API
Expand Down Expand Up @@ -86,7 +112,7 @@ with const generics
- ETA2= 2
- ETA2_RANDOMNESS_SIZE= 128
*/
tuple_3c libcrux_ml_kem_ind_cca_encapsulate_d21(
tuple_3c libcrux_ml_kem_ind_cca_encapsulate_961(
libcrux_ml_kem_types_MlKemPublicKey_15 *public_key,
uint8_t randomness[32U]);

Expand All @@ -112,10 +138,17 @@ with const generics
- ETA2_RANDOMNESS_SIZE= 128
- IMPLICIT_REJECTION_HASH_INPUT_SIZE= 1120
*/
void libcrux_ml_kem_ind_cca_decapsulate_421(
void libcrux_ml_kem_ind_cca_decapsulate_141(
libcrux_ml_kem_types_MlKemPrivateKey_55 *private_key,
libcrux_ml_kem_mlkem768_MlKem768Ciphertext *ciphertext, uint8_t ret[32U]);

/**
Validate an ML-KEM public key.
This implements the Modulus check in 7.2 2.
Note that the size check in 7.2 1 is covered by the `PUBLIC_KEY_SIZE` in the
`public_key` type.
*/
/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_public_key
with types libcrux_ml_kem_vector_avx2_SIMD256Vector
Expand All @@ -126,6 +159,25 @@ with const generics
*/
bool libcrux_ml_kem_ind_cca_validate_public_key_0a0(uint8_t *public_key);

/**
Validate an ML-KEM private key.
This implements the Hash check in 7.3 3.
Note that the size checks in 7.2 1 and 2 are covered by the `SECRET_KEY_SIZE`
and `CIPHERTEXT_SIZE` in the `private_key` and `ciphertext` types.
*/
/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key
with types libcrux_ml_kem_hash_functions_avx2_Simd256Hash
with const generics
- K= 4
- SECRET_KEY_SIZE= 3168
- CIPHERTEXT_SIZE= 1568
*/
bool libcrux_ml_kem_ind_cca_validate_private_key_1d0(
libcrux_ml_kem_types_MlKemPrivateKey_95 *private_key,
libcrux_ml_kem_mlkem1024_MlKem1024Ciphertext *_ciphertext);

/**
Packed API
Expand Down Expand Up @@ -169,7 +221,7 @@ with const generics
- ETA2= 2
- ETA2_RANDOMNESS_SIZE= 128
*/
tuple_21 libcrux_ml_kem_ind_cca_encapsulate_d20(
tuple_21 libcrux_ml_kem_ind_cca_encapsulate_960(
libcrux_ml_kem_types_MlKemPublicKey_1f *public_key,
uint8_t randomness[32U]);

Expand All @@ -195,10 +247,17 @@ with const generics
- ETA2_RANDOMNESS_SIZE= 128
- IMPLICIT_REJECTION_HASH_INPUT_SIZE= 1600
*/
void libcrux_ml_kem_ind_cca_decapsulate_420(
void libcrux_ml_kem_ind_cca_decapsulate_140(
libcrux_ml_kem_types_MlKemPrivateKey_95 *private_key,
libcrux_ml_kem_mlkem1024_MlKem1024Ciphertext *ciphertext, uint8_t ret[32U]);

/**
Validate an ML-KEM public key.
This implements the Modulus check in 7.2 2.
Note that the size check in 7.2 1 is covered by the `PUBLIC_KEY_SIZE` in the
`public_key` type.
*/
/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_public_key
with types libcrux_ml_kem_vector_avx2_SIMD256Vector
Expand All @@ -209,6 +268,25 @@ with const generics
*/
bool libcrux_ml_kem_ind_cca_validate_public_key_0a(uint8_t *public_key);

/**
Validate an ML-KEM private key.
This implements the Hash check in 7.3 3.
Note that the size checks in 7.2 1 and 2 are covered by the `SECRET_KEY_SIZE`
and `CIPHERTEXT_SIZE` in the `private_key` and `ciphertext` types.
*/
/**
A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key
with types libcrux_ml_kem_hash_functions_avx2_Simd256Hash
with const generics
- K= 2
- SECRET_KEY_SIZE= 1632
- CIPHERTEXT_SIZE= 768
*/
bool libcrux_ml_kem_ind_cca_validate_private_key_1d(
libcrux_ml_kem_types_MlKemPrivateKey_5e *private_key,
libcrux_ml_kem_types_MlKemCiphertext_e8 *_ciphertext);

/**
Packed API
Expand Down Expand Up @@ -252,7 +330,7 @@ with const generics
- ETA2= 2
- ETA2_RANDOMNESS_SIZE= 128
*/
tuple_ec libcrux_ml_kem_ind_cca_encapsulate_d2(
tuple_ec libcrux_ml_kem_ind_cca_encapsulate_96(
libcrux_ml_kem_types_MlKemPublicKey_be *public_key,
uint8_t randomness[32U]);

Expand All @@ -278,7 +356,7 @@ with const generics
- ETA2_RANDOMNESS_SIZE= 128
- IMPLICIT_REJECTION_HASH_INPUT_SIZE= 800
*/
void libcrux_ml_kem_ind_cca_decapsulate_42(
void libcrux_ml_kem_ind_cca_decapsulate_14(
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 1def0c1

Please sign in to comment.