tor-browser

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

kyber.h (1931B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef KYBER_UTIL_H
      6 #define KYBER_UTIL_H
      7 
      8 #define KYBER768_PUBLIC_KEY_BYTES 1184U
      9 #define KYBER768_PRIVATE_KEY_BYTES 2400U
     10 #define KYBER768_CIPHERTEXT_BYTES 1088U
     11 
     12 #define MLKEM1024_PUBLIC_KEY_BYTES 1568U
     13 #define MLKEM1024_PRIVATE_KEY_BYTES 3168U
     14 #define MLKEM1024_CIPHERTEXT_BYTES 1568U
     15 
     16 #define KYBER_SHARED_SECRET_BYTES 32U
     17 #define KYBER_KEYPAIR_COIN_BYTES 64U
     18 #define KYBER_ENC_COIN_BYTES 32U
     19 
     20 #define MAX_ML_KEM_CIPHER_LENGTH MLKEM1024_CIPHERTEXT_BYTES
     21 #define MAX_ML_KEM_PRIVATE_KEY_LENGTH MLKEM1024_PRIVATE_KEY_BYTES
     22 #define MAX_ML_KEM_PUBLIC_KEY_LENGTH MLKEM1024_PUBLIC_KEY_BYTES
     23 
     24 typedef enum {
     25    params_kyber_invalid,
     26 
     27    /*
     28     * The Kyber768 parameters specified in version 3.02 of the NIST submission
     29     * https://pq-crystals.org/kyber/data/kyber-specification-round3-20210804.pdf
     30     */
     31    params_kyber768_round3,
     32 
     33    /*
     34     * Identical to params_kyber768_round3 except that this parameter set allows
     35     * the use of a seed in `Kyber_Encapsulate` for testing.
     36     */
     37    params_kyber768_round3_test_mode,
     38 
     39    /*
     40     * The ML-KEM parameters specified in FIPS 203.
     41     * https://csrc.nist.gov/pubs/fips/203/final
     42     */
     43    params_ml_kem768,
     44 
     45    /*
     46     * Identical to params_ml_kem768 except that this parameter set allows
     47     * the use of a seed in `Kyber_Encapsulate` for testing.
     48     */
     49    params_ml_kem768_test_mode,
     50 
     51    /*
     52     * The ML-KEM parameters specified in FIPS 203.
     53     * https://csrc.nist.gov/pubs/fips/203/final
     54     */
     55    params_ml_kem1024,
     56 
     57    /*
     58     * Identical to params_ml_kem1024 except that this parameter set allows
     59     * the use of a seed in `Kyber_Encapsulate` for testing.
     60     */
     61    params_ml_kem1024_test_mode,
     62 
     63 } KyberParams;
     64 
     65 #endif /* KYBER_UTIL_H */