PQLR
Postquantum Crypto Library by QAPP
ml_kem.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <pqlr/common/pqlr.h>
4 #include <pqlr/common/api.h>
5 
6 #include <stdint.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif // __cplusplus
11 
48 typedef enum {
54 
60 typedef struct ml_kem_st* ml_kem_t;
61 
74 
83 
94 
105 
115 
125 
138 
146 
165  const ml_kem_t ml_kem, uint8_t* public_key, uint8_t* secret_key);
166 
189  const ml_kem_t ml_kem,
190  const uint8_t* public_key,
191  uint8_t* ciphertext,
192  uint8_t* session_key);
193 
216  const ml_kem_t ml_kem,
217  const uint8_t* secret_key,
218  const uint8_t* ciphertext,
219  uint8_t* session_key);
220 
221 #ifdef __cplusplus
222 } // extern "C"
223 #endif //__cplusplus
224 
#define PQLR_API
Definition: api.h:22
struct pqlr_st * pqlr_t
Pqlr instance handle. Pqlr represents basic library and it's algorithms configuration....
Definition: pqlr.h:26
PQLR_API ml_kem_t ml_kem_duplicate(const ml_kem_t ml_kem)
Duplicates context of ML-KEM instance.
ml_kem_parameterset_t
Possible ML-KEM parameters sets.
Definition: ml_kem.h:48
PQLR_API void ml_kem_keygen(const ml_kem_t ml_kem, uint8_t *public_key, uint8_t *secret_key)
Initial step of key distribution. Generates a key pair for key distribution initiator.
PQLR_API uint32_t ml_kem_get_ciphertext_length(ml_kem_t ml_kem)
Obtains ciphertext length for the current ML-KEM instance.
PQLR_API uint32_t ml_kem_get_initiator_public_length(ml_kem_t ml_kem)
Obtains initiator's public key length for the current ML-KEM instance.
PQLR_API void ml_kem_free(ml_kem_t ml_kem)
Frees ML-KEM instance and all corresponding resources.
PQLR_API ml_kem_t ml_kem_new(ml_kem_parameterset_t parameterset)
Creates ML-KEM instance initialized by parameterset.
struct ml_kem_st * ml_kem_t
ML-KEM algorithm instance handle.
Definition: ml_kem.h:60
PQLR_API uint32_t ml_kem_get_initiator_secret_length(ml_kem_t ml_kem)
Obtains initiator's secret key length for the current ML-KEM instance.
PQLR_API void ml_kem_key_encap(const ml_kem_t ml_kem, const uint8_t *public_key, uint8_t *ciphertext, uint8_t *session_key)
Key encapsulation.
PQLR_API pqlr_t ml_kem_to_pqlr(ml_kem_t ml_kem)
Gets pqlr instance linked to this ML-KEM instance.
PQLR_API uint32_t ml_kem_get_shared_secret_length(ml_kem_t ml_kem)
Obtains shared secret length for the current ML-KEM instance.
PQLR_API void ml_kem_key_decap(const ml_kem_t ml_kem, const uint8_t *secret_key, const uint8_t *ciphertext, uint8_t *session_key)
Key decapsulation.
@ ml_kem_512
Definition: ml_kem.h:49
@ ml_kem_768
Definition: ml_kem.h:50
@ ml_kem_1024
Definition: ml_kem.h:51
@ ml_kem_last
Definition: ml_kem.h:52