The project is meant to showcase the Hybrid Post-Quantum capabilities of an MQTTs client using TLS 1.3 and the mbedtls library.
For info or comments, contact us at hello@securitypattern.com
The TLS handshake has been agumented with Hybrid PQ capabilities by introducing a new KEM and a new signature mechanism.
These are, respectively X25519-MLKEM768 and Ed25519-MLDSA.
The functions responsible for the KEM can be found in qubip.c:
HybridKeyKEM *hybrid_key_gen();
void hybrid_key_free(HybridKeyKEM *);
The signature and signature verification functions are implemented in the already present mbedtls file pk_wrap.c that get called several times during the TLS handshake.
static int ed25519_mlds44_sign_wrap(mbedtls_pk_context *pk,
mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t sig_size, size_t *sig_len,
int (*f_rng)(void*, unsigned char*, size_t), void *p_rng);
static int ed25519_mlds44_verify_wrap(mbedtls_pk_context *pk,
mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len,
const unsigned char *sig, size_t sig_len);
Furthermore, the certificate parsing functionalities have been expanded to include support for Hybrid PQ certificates in file pk_parse.c
A few examples of Hybrid PQ certificates have been hardcoded in file MQTTInterface.c
The ID definitions for the Hybrid mechanism are as follows:
#define MBEDTLS_SSL_IANA_TLS_GROUP_MLKEM768 0x11ec
#define MBEDTLS_TLS1_3_SIG_ED25519_MLDSA44 0x090a
#define MBEDTLS_TLS1_3_SIG_ED25519_MLDSA65 0x090b
as shown in file ssl.h