mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-06-24 08:48:18 +00:00
don't build ML-KEM/ML-DSA code with <C99 compilers
This commit is contained in:
@@ -996,8 +996,9 @@ struct winsize {
|
|||||||
*/
|
*/
|
||||||
#if defined(VARIABLE_LENGTH_ARRAYS) && defined(VARIABLE_DECLARATION_AFTER_CODE)
|
#if defined(VARIABLE_LENGTH_ARRAYS) && defined(VARIABLE_DECLARATION_AFTER_CODE)
|
||||||
# define USE_SNTRUP761X25519 1
|
# define USE_SNTRUP761X25519 1
|
||||||
/* The ML-KEM768 implementation also uses C89 features */
|
/* The ML-KEM768 and ML-DSA implementations also uses C89 features */
|
||||||
# define USE_MLKEM768X25519 1
|
# define USE_MLKEM768X25519 1
|
||||||
|
# define USE_MLDSA 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_DECL_INFINITY) && HAVE_DECL_INFINITY == 0
|
#if defined(HAVE_DECL_INFINITY) && HAVE_DECL_INFINITY == 0
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
|
#if defined(USE_MLDSA) || defined(USE_MLKEM768X25519)
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -425,3 +427,4 @@ sha3_512(uint8_t digest[64], const uint8_t *data, size_t len)
|
|||||||
Eurydice_mut_borrow_slice_u8 output = { digest, 64 };
|
Eurydice_mut_borrow_slice_u8 output = { digest, 64 };
|
||||||
libcrux_sha3_portable_sha512(output, input);
|
libcrux_sha3_portable_sha512(output, input);
|
||||||
}
|
}
|
||||||
|
#endif /* defined(USE_MLDSA) || defined(USE_MLKEM768X25519) */
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
|
#ifdef USE_MLDSA
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -143,3 +145,4 @@ mldsa_tests(void)
|
|||||||
free_kats(kats, nkats);
|
free_kats(kats, nkats);
|
||||||
TEST_DONE();
|
TEST_DONE();
|
||||||
}
|
}
|
||||||
|
#endif /* USE_MLDSA */
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
|
#ifdef USE_MLDSA
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -192,3 +194,4 @@ mldsa_eddsa_tests(void)
|
|||||||
sshbuf_free(b_s);
|
sshbuf_free(b_s);
|
||||||
sshbuf_free(b_sWithContext);
|
sshbuf_free(b_sWithContext);
|
||||||
}
|
}
|
||||||
|
#endif /* USE_MLDSA */
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
|
#ifdef USE_MLKEM768X25519
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -167,3 +169,4 @@ mlkem_tests(void)
|
|||||||
}
|
}
|
||||||
TEST_DONE();
|
TEST_DONE();
|
||||||
}
|
}
|
||||||
|
#endif /* USE_MLKEM768X25519 */
|
||||||
|
|||||||
@@ -103,10 +103,16 @@ get_json_string(struct sshbuf *content, const char *key, int consume)
|
|||||||
void
|
void
|
||||||
tests(void)
|
tests(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_MLDSA
|
||||||
mldsa_tests();
|
mldsa_tests();
|
||||||
|
#endif
|
||||||
|
#ifdef USE_MLKEM768X25519
|
||||||
mlkem_tests();
|
mlkem_tests();
|
||||||
|
#endif
|
||||||
ed25519_tests();
|
ed25519_tests();
|
||||||
|
#ifdef USE_MLDSA
|
||||||
mldsa_eddsa_tests();
|
mldsa_eddsa_tests();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
|
#ifdef USE_MLDSA
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -501,3 +503,4 @@ const struct sshkey_impl sshkey_mldsa44_ed25519_cert_impl = {
|
|||||||
/* .keybits = */ 256,
|
/* .keybits = */ 256,
|
||||||
/* .funcs = */ &sshkey_mldsa44_ed25519_funcs,
|
/* .funcs = */ &sshkey_mldsa44_ed25519_funcs,
|
||||||
};
|
};
|
||||||
|
#endif /* USE_MLDSA */
|
||||||
|
|||||||
4
sshkey.c
4
sshkey.c
@@ -90,8 +90,10 @@ extern const struct sshkey_impl sshkey_ed25519_impl;
|
|||||||
extern const struct sshkey_impl sshkey_ed25519_cert_impl;
|
extern const struct sshkey_impl sshkey_ed25519_cert_impl;
|
||||||
extern const struct sshkey_impl sshkey_ed25519_sk_impl;
|
extern const struct sshkey_impl sshkey_ed25519_sk_impl;
|
||||||
extern const struct sshkey_impl sshkey_ed25519_sk_cert_impl;
|
extern const struct sshkey_impl sshkey_ed25519_sk_cert_impl;
|
||||||
|
#ifdef USE_MLDSA
|
||||||
extern const struct sshkey_impl sshkey_mldsa44_ed25519_impl;
|
extern const struct sshkey_impl sshkey_mldsa44_ed25519_impl;
|
||||||
extern const struct sshkey_impl sshkey_mldsa44_ed25519_cert_impl;
|
extern const struct sshkey_impl sshkey_mldsa44_ed25519_cert_impl;
|
||||||
|
#endif /* USE_MLDSA */
|
||||||
#ifdef WITH_OPENSSL
|
#ifdef WITH_OPENSSL
|
||||||
# ifdef OPENSSL_HAS_ECC
|
# ifdef OPENSSL_HAS_ECC
|
||||||
# ifdef ENABLE_SK
|
# ifdef ENABLE_SK
|
||||||
@@ -124,8 +126,10 @@ const struct sshkey_impl * const keyimpls[] = {
|
|||||||
&sshkey_ed25519_sk_impl,
|
&sshkey_ed25519_sk_impl,
|
||||||
&sshkey_ed25519_sk_cert_impl,
|
&sshkey_ed25519_sk_cert_impl,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_MLDSA
|
||||||
&sshkey_mldsa44_ed25519_impl,
|
&sshkey_mldsa44_ed25519_impl,
|
||||||
&sshkey_mldsa44_ed25519_cert_impl,
|
&sshkey_mldsa44_ed25519_cert_impl,
|
||||||
|
#endif /* USE_MLDSA */
|
||||||
#ifdef WITH_OPENSSL
|
#ifdef WITH_OPENSSL
|
||||||
# ifdef OPENSSL_HAS_ECC
|
# ifdef OPENSSL_HAS_ECC
|
||||||
&sshkey_ecdsa_nistp256_impl,
|
&sshkey_ecdsa_nistp256_impl,
|
||||||
|
|||||||
Reference in New Issue
Block a user