libssh 0.11.0
The SSH library
Loading...
Searching...
No Matches
mlkem768.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2025 by Red Hat, Inc.
5 *
6 * Author: Sahana Prasad <sahana@redhat.com>
7 * Author: Claude (Anthropic)
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef MLKEM768_H_
25#define MLKEM768_H_
26
27#include "config.h"
28
29/* ML-KEM768 key and ciphertext sizes as defined in FIPS 203 */
30#define MLKEM768_PUBLICKEY_SIZE 1184
31#define MLKEM768_SECRETKEY_SIZE 2400
32#define MLKEM768_CIPHERTEXT_SIZE 1088
33#define MLKEM768_SHARED_SECRET_SIZE 32
34
35/* Hybrid ML-KEM768x25519 combined sizes */
36#define MLKEM768X25519_CLIENT_PUBKEY_SIZE \
37 (MLKEM768_PUBLICKEY_SIZE + CURVE25519_PUBKEY_SIZE)
38#define MLKEM768X25519_SERVER_RESPONSE_SIZE \
39 (MLKEM768_CIPHERTEXT_SIZE + CURVE25519_PUBKEY_SIZE)
40#define MLKEM768X25519_SHARED_SECRET_SIZE \
41 (MLKEM768_SHARED_SECRET_SIZE + CURVE25519_PUBKEY_SIZE)
42
43typedef unsigned char ssh_mlkem768_pubkey[MLKEM768_PUBLICKEY_SIZE];
44typedef unsigned char ssh_mlkem768_privkey[MLKEM768_SECRETKEY_SIZE];
45typedef unsigned char ssh_mlkem768_ciphertext[MLKEM768_CIPHERTEXT_SIZE];
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* ML-KEM768x25519 key exchange functions */
52int ssh_client_mlkem768x25519_init(ssh_session session);
53void ssh_client_mlkem768x25519_remove_callbacks(ssh_session session);
54
55#ifdef WITH_SERVER
56void ssh_server_mlkem768x25519_init(ssh_session session);
57#endif /* WITH_SERVER */
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif /* MLKEM768_H_ */