From 18b861024ad542bd6df337dfb10a84e04173040f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 4 Oct 2022 15:03:28 +0100 Subject: [crypto] Add Ephemeral Diffie-Hellman key exchange algorithm Add an implementation of the Ephemeral Diffie-Hellman key exchange algorithm as defined in RFC2631, with test vectors taken from the NIST Cryptographic Toolkit. Signed-off-by: Michael Brown --- src/include/ipxe/dhe.h | 19 +++++++++++++++++++ src/include/ipxe/errfile.h | 1 + 2 files changed, 20 insertions(+) create mode 100644 src/include/ipxe/dhe.h (limited to 'src/include') diff --git a/src/include/ipxe/dhe.h b/src/include/ipxe/dhe.h new file mode 100644 index 000000000..3cd24a880 --- /dev/null +++ b/src/include/ipxe/dhe.h @@ -0,0 +1,19 @@ +#ifndef _IPXE_DHE_H +#define _IPXE_DHE_H + +/** @file + * + * Ephemeral Diffie-Hellman key exchange + * + */ + +FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); + +#include + +extern int dhe_key ( const void *modulus, size_t len, const void *generator, + size_t generator_len, const void *partner, + size_t partner_len, const void *private, + size_t private_len, void *public, void *shared ); + +#endif /* _IPXE_DHE_H */ diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h index 1fca74742..c3541e8a0 100644 --- a/src/include/ipxe/errfile.h +++ b/src/include/ipxe/errfile.h @@ -400,6 +400,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #define ERRFILE_linux_acpi ( ERRFILE_OTHER | 0x00570000 ) #define ERRFILE_dynkeymap ( ERRFILE_OTHER | 0x00580000 ) #define ERRFILE_pci_cmd ( ERRFILE_OTHER | 0x00590000 ) +#define ERRFILE_dhe ( ERRFILE_OTHER | 0x005a0000 ) /** @} */ -- cgit v1.2.3-55-g7522