/* * SPDX-FileCopyrightText: 2025 Cryspen Sarl * * SPDX-License-Identifier: MIT or Apache-2.0 * * This code was generated with the following revisions: * Charon: 667d2fc98984ff7f3df989c2367e6c1fa4a000e7 * Eurydice: 2381cbc416ef2ad0b561c362c500bc84f36b6785 * Karamel: 80f5435f2fc505973c469a4afcc8d875cddd0d8b * F*: 71d8221589d4d438af3706d89cb653cf53e18aab * Libcrux: 68dfed5a4a9e40277f62828471c029afed1ecdcc */ #ifndef internal_libcrux_mlkem_portable_H #define internal_libcrux_mlkem_portable_H #include "eurydice_glue.h" #if defined(__cplusplus) extern "C" { #endif #include "../libcrux_mlkem_portable.h" #include "libcrux_core.h" /** A monomorphic instance of libcrux_ml_kem.polynomial.PolynomialRingElement with types libcrux_ml_kem_vector_portable_vector_type_PortableVector */ typedef struct libcrux_ml_kem_polynomial_PolynomialRingElement_1d_s { libcrux_ml_kem_vector_portable_vector_type_PortableVector coefficients[16U]; } libcrux_ml_kem_polynomial_PolynomialRingElement_1d; /** 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_portable_vector_type_PortableVector with const generics - K= 4 - PUBLIC_KEY_SIZE= 1568 */ bool libcrux_ml_kem_ind_cca_validate_public_key_ff(uint8_t *public_key); /** Validate an ML-KEM private key. This implements the Hash check in 7.3 3. */ /** A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key_only with types libcrux_ml_kem_hash_functions_portable_PortableHash[[$4size_t]] with const generics - K= 4 - SECRET_KEY_SIZE= 3168 */ bool libcrux_ml_kem_ind_cca_validate_private_key_only_60( libcrux_ml_kem_types_MlKemPrivateKey_83 *private_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_portable_PortableHash[[$4size_t]] with const generics - K= 4 - SECRET_KEY_SIZE= 3168 - CIPHERTEXT_SIZE= 1568 */ bool libcrux_ml_kem_ind_cca_validate_private_key_b5( libcrux_ml_kem_types_MlKemPrivateKey_83 *private_key, libcrux_ml_kem_types_MlKemCiphertext_64 *_ciphertext); /** Packed API Generate a key pair. Depending on the `Vector` and `Hasher` used, this requires different hardware features */ /** A monomorphic instance of libcrux_ml_kem.ind_cca.generate_keypair with types libcrux_ml_kem_vector_portable_vector_type_PortableVector, libcrux_ml_kem_hash_functions_portable_PortableHash[[$4size_t]], libcrux_ml_kem_variant_MlKem with const generics - K= 4 - CPA_PRIVATE_KEY_SIZE= 1536 - PRIVATE_KEY_SIZE= 3168 - PUBLIC_KEY_SIZE= 1568 - ETA1= 2 - ETA1_RANDOMNESS_SIZE= 128 */ libcrux_ml_kem_mlkem1024_MlKem1024KeyPair libcrux_ml_kem_ind_cca_generate_keypair_150(uint8_t *randomness); /** A monomorphic instance of libcrux_ml_kem.ind_cca.encapsulate with types libcrux_ml_kem_vector_portable_vector_type_PortableVector, libcrux_ml_kem_hash_functions_portable_PortableHash[[$4size_t]], libcrux_ml_kem_variant_MlKem with const generics - K= 4 - CIPHERTEXT_SIZE= 1568 - PUBLIC_KEY_SIZE= 1568 - T_AS_NTT_ENCODED_SIZE= 1536 - C1_SIZE= 1408 - C2_SIZE= 160 - VECTOR_U_COMPRESSION_FACTOR= 11 - VECTOR_V_COMPRESSION_FACTOR= 5 - C1_BLOCK_SIZE= 352 - ETA1= 2 - ETA1_RANDOMNESS_SIZE= 128 - ETA2= 2 - ETA2_RANDOMNESS_SIZE= 128 */ tuple_fa libcrux_ml_kem_ind_cca_encapsulate_ca0( libcrux_ml_kem_types_MlKemPublicKey_64 *public_key, uint8_t *randomness); /** This code verifies on some machines, runs out of memory on others */ /** A monomorphic instance of libcrux_ml_kem.ind_cca.decapsulate with types libcrux_ml_kem_vector_portable_vector_type_PortableVector, libcrux_ml_kem_hash_functions_portable_PortableHash[[$4size_t]], libcrux_ml_kem_variant_MlKem with const generics - K= 4 - SECRET_KEY_SIZE= 3168 - CPA_SECRET_KEY_SIZE= 1536 - PUBLIC_KEY_SIZE= 1568 - CIPHERTEXT_SIZE= 1568 - T_AS_NTT_ENCODED_SIZE= 1536 - C1_SIZE= 1408 - C2_SIZE= 160 - VECTOR_U_COMPRESSION_FACTOR= 11 - VECTOR_V_COMPRESSION_FACTOR= 5 - C1_BLOCK_SIZE= 352 - ETA1= 2 - ETA1_RANDOMNESS_SIZE= 128 - ETA2= 2 - ETA2_RANDOMNESS_SIZE= 128 - IMPLICIT_REJECTION_HASH_INPUT_SIZE= 1600 */ void libcrux_ml_kem_ind_cca_decapsulate_620( libcrux_ml_kem_types_MlKemPrivateKey_83 *private_key, libcrux_ml_kem_types_MlKemCiphertext_64 *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_portable_vector_type_PortableVector with const generics - K= 3 - PUBLIC_KEY_SIZE= 1184 */ bool libcrux_ml_kem_ind_cca_validate_public_key_89(uint8_t *public_key); /** Validate an ML-KEM private key. This implements the Hash check in 7.3 3. */ /** A monomorphic instance of libcrux_ml_kem.ind_cca.validate_private_key_only with types libcrux_ml_kem_hash_functions_portable_PortableHash[[$3size_t]] with const generics - K= 3 - SECRET_KEY_SIZE= 2400 */ bool libcrux_ml_kem_ind_cca_validate_private_key_only_d6( libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_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_portable_PortableHash[[$3size_t]] with const generics - K= 3 - SECRET_KEY_SIZE= 2400 - CIPHERTEXT_SIZE= 1088 */ bool libcrux_ml_kem_ind_cca_validate_private_key_37( libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_key, libcrux_ml_kem_mlkem768_MlKem768Ciphertext *_ciphertext); /** Packed API Generate a key pair. Depending on the `Vector` and `Hasher` used, this requires different hardware features */ /** A monomorphic instance of libcrux_ml_kem.ind_cca.generate_keypair with types libcrux_ml_kem_vector_portable_vector_type_PortableVector, libcrux_ml_kem_hash_functions_portable_PortableHash[[$3size_t]], libcrux_ml_kem_variant_MlKem with const generics - K= 3 - CPA_PRIVATE_KEY_SIZE= 1152 - PRIVATE_KEY_SIZE= 2400 - PUBLIC_KEY_SIZE= 1184 - ETA1= 2 - ETA1_RANDOMNESS_SIZE= 128 */ libcrux_ml_kem_mlkem768_MlKem768KeyPair libcrux_ml_kem_ind_cca_generate_keypair_15(uint8_t *randomness); /** A monomorphic instance of libcrux_ml_kem.ind_cca.encapsulate with types libcrux_ml_kem_vector_portable_vector_type_PortableVector, libcrux_ml_kem_hash_functions_portable_PortableHash[[$3size_t]], libcrux_ml_kem_variant_MlKem with const generics - K= 3 - CIPHERTEXT_SIZE= 1088 - PUBLIC_KEY_SIZE= 1184 - T_AS_NTT_ENCODED_SIZE= 1152 - C1_SIZE= 960 - C2_SIZE= 128 - VECTOR_U_COMPRESSION_FACTOR= 10 - VECTOR_V_COMPRESSION_FACTOR= 4 - C1_BLOCK_SIZE= 320 - ETA1= 2 - ETA1_RANDOMNESS_SIZE= 128 - ETA2= 2 - ETA2_RANDOMNESS_SIZE= 128 */ tuple_c2 libcrux_ml_kem_ind_cca_encapsulate_ca( libcrux_ml_kem_types_MlKemPublicKey_30 *public_key, uint8_t *randomness); /** This code verifies on some machines, runs out of memory on others */ /** A monomorphic instance of libcrux_ml_kem.ind_cca.decapsulate with types libcrux_ml_kem_vector_portable_vector_type_PortableVector, libcrux_ml_kem_hash_functions_portable_PortableHash[[$3size_t]], libcrux_ml_kem_variant_MlKem with const generics - K= 3 - SECRET_KEY_SIZE= 2400 - CPA_SECRET_KEY_SIZE= 1152 - PUBLIC_KEY_SIZE= 1184 - CIPHERTEXT_SIZE= 1088 - T_AS_NTT_ENCODED_SIZE= 1152 - C1_SIZE= 960 - C2_SIZE= 128 - VECTOR_U_COMPRESSION_FACTOR= 10 - VECTOR_V_COMPRESSION_FACTOR= 4 - C1_BLOCK_SIZE= 320 - ETA1= 2 - ETA1_RANDOMNESS_SIZE= 128 - ETA2= 2 - ETA2_RANDOMNESS_SIZE= 128 - IMPLICIT_REJECTION_HASH_INPUT_SIZE= 1120 */ void libcrux_ml_kem_ind_cca_decapsulate_62( libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_key, libcrux_ml_kem_mlkem768_MlKem768Ciphertext *ciphertext, uint8_t ret[32U]); #if defined(__cplusplus) } #endif #define internal_libcrux_mlkem_portable_H_DEFINED #endif /* internal_libcrux_mlkem_portable_H */