summaryrefslogtreecommitdiff
path: root/kexsntrup761x25519.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2021-01-26 14:48:07 +1100
committerDarren Tucker <dtucker@dtucker.net>2021-01-26 14:48:07 +1100
commit48d0d7a4dd31154c4208ec39029d60646192f978 (patch)
tree5f1c1fbc167c418fff1fceed416e06b0562fbe39 /kexsntrup761x25519.c
parent37c70ea8d4f3664a88141bcdf0bf7a16bd5fd1ac (diff)
downloadopenssh-git-48d0d7a4dd31154c4208ec39029d60646192f978.tar.gz
Disable sntrup761 if compiler doesn't support VLAs.
The sntrup761 code sourced from supercop uses variable length arrays. Although widely supported, they are not part of the ANSI C89 spec so if the compiler does not support VLAs, disable the sntrup761x25519-sha512@openssh.com KEX method by replacing the kex functions with no-op ones similar to what we do in kexecdh.c. This should allow OpenSSH to build with a plain C89 compiler again. Spotted by tim@, ok djm@.
Diffstat (limited to 'kexsntrup761x25519.c')
-rw-r--r--kexsntrup761x25519.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/kexsntrup761x25519.c b/kexsntrup761x25519.c
index 3d5c6bdf..e3007fa2 100644
--- a/kexsntrup761x25519.c
+++ b/kexsntrup761x25519.c
@@ -25,6 +25,8 @@
#include "includes.h"
+#ifdef USE_SNTRUP761X25519
+
#include <sys/types.h>
#include <stdio.h>
@@ -217,3 +219,33 @@ kex_kem_sntrup761x25519_dec(struct kex *kex,
sshbuf_free(buf);
return r;
}
+
+#else
+
+#include "ssherr.h"
+
+struct kex;
+struct sshbuf;
+struct sshkey;
+
+int
+kex_kem_sntrup761x25519_keypair(struct kex *kex)
+{
+ return SSH_ERR_SIGN_ALG_UNSUPPORTED;
+}
+
+int
+kex_kem_sntrup761x25519_enc(struct kex *kex,
+ const struct sshbuf *client_blob, struct sshbuf **server_blobp,
+ struct sshbuf **shared_secretp)
+{
+ return SSH_ERR_SIGN_ALG_UNSUPPORTED;
+}
+
+int
+kex_kem_sntrup761x25519_dec(struct kex *kex,
+ const struct sshbuf *server_blob, struct sshbuf **shared_secretp)
+{
+ return SSH_ERR_SIGN_ALG_UNSUPPORTED;
+}
+#endif /* USE_SNTRUP761X25519 */