Kyber#

Caution

Currently, crypto-condor uses test vectors for version 3.0 of Kyber, which is the latest release of the reference implementation. This version differs from the FIPS draft for ML-KEM. When the final is published, its test vectors will be integrated into crypto-condor.

In Kyber, the size of the public and private keys, the ciphertext, and shared secret [1] is fixed. These parameters are still provided to the CC function, but if the implementation you are testing doesn’t require them, that may be the reason why.

Parameter sets and object sizes (in bytes)#

Parameter set

Private key

Public Key

Ciphertext

Shared secret

512

1632

800

768

32

512_90s

1632

800

768

32

768

2400

1184

1088

32

768_90s

2400

1184

1088

32

1024

3168

1568

1568

32

1024_90s

3168

1568

1568

32

Encapsulate#

To test a function that encapsulates with Kyber, its name must conform to the following convention:

CC_Kyber_<param set>_encapsulate

Its signature must be:

void Kyber_encapsulate(
uint8_t *ct,
size_t ct_sz,
uint8_t *ss,
size_t ss_sz,
const uint8_t *pk,
size_t pk_sz,
)#
Parameters:
  • ct[Out] A buffer to store the resulting ciphertext.

  • ct_sz[In] The size of the ciphertext buffer.

  • ss[Out] A buffer to store the shared secret.

  • ss_sz[In] The size of the shared secret buffer.

  • pk[In] The public key.

  • pk_sz[In] The size of the public key.

Examples:

  • Kyber512:

void CC_Kyber_512_encapsulate(uint8_t *ct, size_t ct_sz,
                              uint8_t *ss, size_t ss_sz,
                              const uint8_t *pk, size_t pk_sz);
  • Kyber1024-90s:

void CC_Kyber_1024_90s_encapsulate(uint8_t *ct, size_t ct_sz,
                                   uint8_t *ss, size_t ss_sz,
                                   const uint8_t *pk, size_t pk_sz);

Decapsulate#

To test a function that decapsulates with Kyber, its name must conform to the following convention:

CC_Kyber_<param set>_decapsulate

Its signature must be:

int Kyber_decapsulate(
uint8_t *ss,
size_t ss_sz,
const uint8_t *ct,
size_t ct_sz,
const uint8_t *pk,
size_t pk_sz,
)#
Parameters:
  • ss[Out] A buffer to store the decapsulated shared secret.

  • ss_sz[In] The size of the shared secret buffer.

  • ct[In] The ciphertext to decapsulate.

  • ct_sz[In] The size of the ciphertext.

  • sk[In] The secret key.

  • sk_sz[In] The size of the secret key.

Examples:

  • Kyber512:

void CC_Kyber_512_decapsulate(uint8_t *ss, size_t ss_sz,
                              const uint8_t *ct, size_t ct_sz,
                              const uint8_t *sk, size_t sk_sz);
  • Kyber1024-90s:

void CC_Kyber_1024_90s_decapsulate(uint8_t *ss, size_t ss_sz,
                                   const uint8_t *ct, size_t ct_sz,
                                   const uint8_t *sk, size_t sk_sz);