summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-sk.c
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2019-11-18 16:08:57 +0000
committernaddy <naddy@openbsd.org>2019-11-18 16:08:57 +0000
commitf8cd6cb19fd36b3a6307bffd8d321d6f1d993979 (patch)
treebe6f26a95a6064e427bd530d754b378441457542 /usr.bin/ssh/ssh-sk.c
parentsync (diff)
downloadwireguard-openbsd-f8cd6cb19fd36b3a6307bffd8d321d6f1d993979.tar.xz
wireguard-openbsd-f8cd6cb19fd36b3a6307bffd8d321d6f1d993979.zip
add the missing WITH_OPENSSL ifdefs after the ED25519-SK addition; ok djm@
Diffstat (limited to 'usr.bin/ssh/ssh-sk.c')
-rw-r--r--usr.bin/ssh/ssh-sk.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh-sk.c b/usr.bin/ssh/ssh-sk.c
index e303c540379..2bd099d13ac 100644
--- a/usr.bin/ssh/ssh-sk.c
+++ b/usr.bin/ssh/ssh-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-sk.c,v 1.14 2019/11/16 23:17:20 djm Exp $ */
+/* $OpenBSD: ssh-sk.c,v 1.15 2019/11/18 16:08:57 naddy Exp $ */
/*
* Copyright (c) 2019 Google LLC
*
@@ -23,8 +23,10 @@
#include <string.h>
#include <stdio.h>
+#ifdef WITH_OPENSSL
#include <openssl/objects.h>
#include <openssl/ec.h>
+#endif /* WITH_OPENSSL */
#include "log.h"
#include "misc.h"
@@ -155,6 +157,7 @@ sshsk_free_sign_response(struct sk_sign_response *r)
freezero(r, sizeof(*r));
};
+#ifdef WITH_OPENSSL
/* Assemble key from response */
static int
sshsk_ecdsa_assemble(struct sk_enroll_response *resp, struct sshkey **keyp)
@@ -209,6 +212,7 @@ sshsk_ecdsa_assemble(struct sk_enroll_response *resp, struct sshkey **keyp)
sshbuf_free(b);
return r;
}
+#endif /* WITH_OPENSSL */
static int
sshsk_ed25519_assemble(struct sk_enroll_response *resp, struct sshkey **keyp)
@@ -264,9 +268,11 @@ sshsk_enroll(int type, const char *provider_path, const char *application,
if (attest)
sshbuf_reset(attest);
switch (type) {
+#ifdef WITH_OPENSSL
case KEY_ECDSA_SK:
alg = SSH_SK_ECDSA;
break;
+#endif /* WITH_OPENSSL */
case KEY_ED25519_SK:
alg = SSH_SK_ED25519;
break;
@@ -322,10 +328,12 @@ sshsk_enroll(int type, const char *provider_path, const char *application,
goto out;
}
switch (type) {
+#ifdef WITH_OPENSSL
case KEY_ECDSA_SK:
if ((r = sshsk_ecdsa_assemble(resp, &key)) != 0)
goto out;
break;
+#endif /* WITH_OPENSSL */
case KEY_ED25519_SK:
if ((r = sshsk_ed25519_assemble(resp, &key)) != 0)
goto out;
@@ -374,6 +382,7 @@ sshsk_enroll(int type, const char *provider_path, const char *application,
return r;
}
+#ifdef WITH_OPENSSL
static int
sshsk_ecdsa_sig(struct sk_sign_response *resp, struct sshbuf *sig)
{
@@ -417,6 +426,7 @@ sshsk_ecdsa_sig(struct sk_sign_response *resp, struct sshbuf *sig)
sshbuf_free(inner_sig);
return r;
}
+#endif /* WITH_OPENSSL */
static int
sshsk_ed25519_sig(struct sk_sign_response *resp, struct sshbuf *sig)
@@ -466,9 +476,11 @@ sshsk_sign(const char *provider_path, const struct sshkey *key,
*lenp = 0;
type = sshkey_type_plain(key->type);
switch (type) {
+#ifdef WITH_OPENSSL
case KEY_ECDSA_SK:
alg = SSH_SK_ECDSA;
break;
+#endif /* WITH_OPENSSL */
case KEY_ED25519_SK:
alg = SSH_SK_ED25519;
break;
@@ -510,10 +522,12 @@ sshsk_sign(const char *provider_path, const struct sshkey *key,
goto out;
}
switch (type) {
+#ifdef WITH_OPENSSL
case KEY_ECDSA_SK:
if ((r = sshsk_ecdsa_sig(resp, sig)) != 0)
goto out;
break;
+#endif /* WITH_OPENSSL */
case KEY_ED25519_SK:
if ((r = sshsk_ed25519_sig(resp, sig)) != 0)
goto out;