tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

libcrux_mlkem768_portable.h (2257B)


      1 /*
      2 * SPDX-FileCopyrightText: 2025 Cryspen Sarl <info@cryspen.com>
      3 *
      4 * SPDX-License-Identifier: MIT or Apache-2.0
      5 *
      6 * This code was generated with the following revisions:
      7 * Charon: 667d2fc98984ff7f3df989c2367e6c1fa4a000e7
      8 * Eurydice: 2381cbc416ef2ad0b561c362c500bc84f36b6785
      9 * Karamel: 80f5435f2fc505973c469a4afcc8d875cddd0d8b
     10 * F*: 71d8221589d4d438af3706d89cb653cf53e18aab
     11 * Libcrux: 68dfed5a4a9e40277f62828471c029afed1ecdcc
     12 */
     13 
     14 #ifndef libcrux_mlkem768_portable_H
     15 #define libcrux_mlkem768_portable_H
     16 
     17 #include "eurydice_glue.h"
     18 
     19 #if defined(__cplusplus)
     20 extern "C" {
     21 #endif
     22 
     23 #include "libcrux_core.h"
     24 
     25 /**
     26 Decapsulate ML-KEM 768
     27 
     28 Generates an [`MlKemSharedSecret`].
     29 The input is a reference to an [`MlKem768PrivateKey`] and an
     30 [`MlKem768Ciphertext`].
     31 */
     32 void libcrux_ml_kem_mlkem768_portable_decapsulate(
     33    libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_key,
     34    libcrux_ml_kem_mlkem768_MlKem768Ciphertext *ciphertext, uint8_t ret[32U]);
     35 
     36 /**
     37 Encapsulate ML-KEM 768
     38 
     39 Generates an ([`MlKem768Ciphertext`], [`MlKemSharedSecret`]) tuple.
     40 The input is a reference to an [`MlKem768PublicKey`] and [`SHARED_SECRET_SIZE`]
     41 bytes of `randomness`.
     42 */
     43 tuple_c2 libcrux_ml_kem_mlkem768_portable_encapsulate(
     44    libcrux_ml_kem_types_MlKemPublicKey_30 *public_key,
     45    uint8_t randomness[32U]);
     46 
     47 /**
     48 Generate ML-KEM 768 Key Pair
     49 */
     50 libcrux_ml_kem_mlkem768_MlKem768KeyPair
     51 libcrux_ml_kem_mlkem768_portable_generate_key_pair(uint8_t randomness[64U]);
     52 
     53 /**
     54 Validate a private key.
     55 
     56 Returns `true` if valid, and `false` otherwise.
     57 */
     58 bool libcrux_ml_kem_mlkem768_portable_validate_private_key(
     59    libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_key,
     60    libcrux_ml_kem_mlkem768_MlKem768Ciphertext *ciphertext);
     61 
     62 /**
     63 Validate the private key only.
     64 
     65 Returns `true` if valid, and `false` otherwise.
     66 */
     67 bool libcrux_ml_kem_mlkem768_portable_validate_private_key_only(
     68    libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_key);
     69 
     70 /**
     71 Validate a public key.
     72 
     73 Returns `true` if valid, and `false` otherwise.
     74 */
     75 bool libcrux_ml_kem_mlkem768_portable_validate_public_key(
     76    libcrux_ml_kem_types_MlKemPublicKey_30 *public_key);
     77 
     78 #if defined(__cplusplus)
     79 }
     80 #endif
     81 
     82 #define libcrux_mlkem768_portable_H_DEFINED
     83 #endif /* libcrux_mlkem768_portable_H */