1 #ifndef PARAMS_H 2 #define PARAMS_H 3 4 #ifndef KYBER_K 5 #define KYBER_K 3 /* Change this for different security strengths */ 6 #endif 7 8 //#define KYBER_90S /* Uncomment this if you want the 90S variant */ 9 10 /* Don't change parameters below this line */ 11 #if (KYBER_K == 2) 12 #ifdef KYBER_90S 13 #define KYBER_NAMESPACE(s) pqcrystals_kyber512_90s_ref_##s 14 #else 15 #define KYBER_NAMESPACE(s) pqcrystals_kyber512_ref_##s 16 #endif 17 #elif (KYBER_K == 3) 18 #ifdef KYBER_90S 19 #define KYBER_NAMESPACE(s) pqcrystals_kyber768_90s_ref_##s 20 #else 21 #define KYBER_NAMESPACE(s) pqcrystals_kyber768_ref_##s 22 #endif 23 #elif (KYBER_K == 4) 24 #ifdef KYBER_90S 25 #define KYBER_NAMESPACE(s) pqcrystals_kyber1024_90s_ref_##s 26 #else 27 #define KYBER_NAMESPACE(s) pqcrystals_kyber1024_ref_##s 28 #endif 29 #else 30 #error "KYBER_K must be in {2,3,4}" 31 #endif 32 33 #define KYBER_N 256 34 #define KYBER_Q 3329 35 36 #define KYBER_SYMBYTES 32 /* size in bytes of hashes, and seeds */ 37 #define KYBER_SSBYTES 32 /* size in bytes of shared key */ 38 39 #define KYBER_POLYBYTES 384 40 #define KYBER_POLYVECBYTES (KYBER_K * KYBER_POLYBYTES) 41 42 #if KYBER_K == 2 43 #define KYBER_ETA1 3 44 #define KYBER_POLYCOMPRESSEDBYTES 128 45 #define KYBER_POLYVECCOMPRESSEDBYTES (KYBER_K * 320) 46 #elif KYBER_K == 3 47 #define KYBER_ETA1 2 48 #define KYBER_POLYCOMPRESSEDBYTES 128 49 #define KYBER_POLYVECCOMPRESSEDBYTES (KYBER_K * 320) 50 #elif KYBER_K == 4 51 #define KYBER_ETA1 2 52 #define KYBER_POLYCOMPRESSEDBYTES 160 53 #define KYBER_POLYVECCOMPRESSEDBYTES (KYBER_K * 352) 54 #endif 55 56 #define KYBER_ETA2 2 57 58 #define KYBER_INDCPA_MSGBYTES (KYBER_SYMBYTES) 59 #define KYBER_INDCPA_PUBLICKEYBYTES (KYBER_POLYVECBYTES + KYBER_SYMBYTES) 60 #define KYBER_INDCPA_SECRETKEYBYTES (KYBER_POLYVECBYTES) 61 #define KYBER_INDCPA_BYTES (KYBER_POLYVECCOMPRESSEDBYTES + KYBER_POLYCOMPRESSEDBYTES) 62 63 #define KYBER_PUBLICKEYBYTES (KYBER_INDCPA_PUBLICKEYBYTES) 64 /* 32 bytes of additional space to save H(pk) */ 65 #define KYBER_SECRETKEYBYTES (KYBER_INDCPA_SECRETKEYBYTES + KYBER_INDCPA_PUBLICKEYBYTES + 2*KYBER_SYMBYTES) 66 #define KYBER_CIPHERTEXTBYTES (KYBER_INDCPA_BYTES) 67 68 #endif 69