summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hidden
diff options
context:
space:
mode:
authorbeck <>2024-12-13 00:03:57 +0000
committerbeck <>2024-12-13 00:03:57 +0000
commited3c5d3a4797d4b1d8f9769cfc43f8e686a59621 (patch)
treea9ff1c725db56dbeb46224505b3dd6fd05a21777 /src/lib/libcrypto/hidden
parentfd906c7b27573203602764309c3cf5faaefdf573 (diff)
downloadopenbsd-ed3c5d3a4797d4b1d8f9769cfc43f8e686a59621.tar.gz
openbsd-ed3c5d3a4797d4b1d8f9769cfc43f8e686a59621.tar.bz2
openbsd-ed3c5d3a4797d4b1d8f9769cfc43f8e686a59621.zip
Add ML-KEM 768 from BoringSSL
Changes include conversion from C++, basic KNF, then adaptation to use our sha3 functions for sha3 and shake instead of the BorinSSL version. This Adds units tests to run against BoringSSL and NIST test vectors. The future public API is the same as Boring's - but is not yet exposed pending making bytesring.h public (which will happen separately) and a minor bump Currently this will just ensure we build and run regress. ok tb@ to get it into the tree and massage from there.
Diffstat (limited to 'src/lib/libcrypto/hidden')
-rw-r--r--src/lib/libcrypto/hidden/openssl/mlkem.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/libcrypto/hidden/openssl/mlkem.h b/src/lib/libcrypto/hidden/openssl/mlkem.h
new file mode 100644
index 0000000000..01ac28cffd
--- /dev/null
+++ b/src/lib/libcrypto/hidden/openssl/mlkem.h
@@ -0,0 +1,40 @@
1/* $OpenBSD: mlkem.h,v 1.1 2024/12/13 00:03:57 beck Exp $ */
2/*
3 * Copyright (c) 2024 Bob Beck <beck@obtuse.com>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _LIBCRYPTO_MLKEM_H
19#define _LIBCRYPTO_MLKEM_H
20
21#ifndef _MSC_VER
22#include_next <openssl/mlkem.h>
23#else
24#include "../include/openssl/mlkem.h"
25#endif
26#include "crypto_namespace.h"
27
28/* Undo when making public */
29#ifdef LIBRESSL_HAS_MLKEM
30LCRYPTO_USED(MLKEM768_generate_key);
31LCRYPTO_USED(MLKEM768_public_from_private);
32LCRYPTO_USED(MLKEM768_encap);
33LCRYPTO_USED(MLKEM768_decap);
34LCRYPTO_USED(MLKEM768_marshal_public_key);
35LCRYPTO_USED(MLKEM768_parse_public_key);
36LCRYPTO_USED(MLKEM768_private_key_from_seed);
37LCRYPTO_USED(MLKEM768_parse_private_key);
38#endif
39
40#endif /* _LIBCRYPTO_MLKEM_H */