From 0719ed46d29b0e57cb9128f5396ff894b7456766 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 29 Aug 2026 12:08:29 +0200 Subject: lib: Improve hybrid KEX support The algorithm was inferred from the key length. That will not always work as SecP256r1MLKEM768 private key is 2432 bytes, exactly like an X25519MLKEM768 one. Raw OAP kex payloads now lead with the algorithm NID in network byte order, so a peer reads the algorithm from the wire instead of guessing it from the payload length. Test if the KEX is hybrid KEM with kex_nid_is_hybrid() based on the NID range. The configured algorithm is passed to the raw key loaders. The public key loader imports the key to validate it, so a corrupt or mismatched file is reported at load time. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- sec.conf.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sec.conf.in') diff --git a/sec.conf.in b/sec.conf.in index 4796b72d..4115c850 100644 --- a/sec.conf.in +++ b/sec.conf.in @@ -137,7 +137,7 @@ # # File formats: # - Pure ML-KEM: PEM format (.pem extension) -# - Hybrid KEMs: Raw bytes (.raw extension) +# - Hybrid KEMs: Raw key bytes (.raw extension), for the kex= algorithm # # Examples: # --------- -- cgit v1.2.3