[openssh-commits] [openssh] 02/03: upstream: move check_sk_options() up so we can use it earlier

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Dec 3 10:27:55 AEDT 2021


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit ca709e27c41c90f4565b17282c48dca7756e083c
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Thu Dec 2 22:40:05 2021 +0000

    upstream: move check_sk_options() up so we can use it earlier
    
    OpenBSD-Commit-ID: 67fe98ba1c846d22035279782c4664c1865763b4
---
 sk-usbhid.c | 86 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/sk-usbhid.c b/sk-usbhid.c
index bfa1d1ed..89196c8b 100644
--- a/sk-usbhid.c
+++ b/sk-usbhid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sk-usbhid.c,v 1.34 2021/11/03 22:00:56 deraadt Exp $ */
+/* $OpenBSD: sk-usbhid.c,v 1.35 2021/12/02 22:40:05 djm Exp $ */
 /*
  * Copyright (c) 2019 Markus Friedl
  * Copyright (c) 2020 Pedro Martelletto
@@ -386,6 +386,48 @@ sk_try(const struct sk_usbhid *sk, const char *application,
 	return r != FIDO_OK ? -1 : 0;
 }
 
+static int
+check_sk_options(fido_dev_t *dev, const char *opt, int *ret)
+{
+	fido_cbor_info_t *info;
+	char * const *name;
+	const bool *value;
+	size_t len, i;
+	int r;
+
+	*ret = -1;
+
+	if (!fido_dev_is_fido2(dev)) {
+		skdebug(__func__, "device is not fido2");
+		return 0;
+	}
+	if ((info = fido_cbor_info_new()) == NULL) {
+		skdebug(__func__, "fido_cbor_info_new failed");
+		return -1;
+	}
+	if ((r = fido_dev_get_cbor_info(dev, info)) != FIDO_OK) {
+		skdebug(__func__, "fido_dev_get_cbor_info: %s", fido_strerr(r));
+		fido_cbor_info_free(&info);
+		return -1;
+	}
+	name = fido_cbor_info_options_name_ptr(info);
+	value = fido_cbor_info_options_value_ptr(info);
+	len = fido_cbor_info_options_len(info);
+	for (i = 0; i < len; i++) {
+		if (!strcmp(name[i], opt)) {
+			*ret = value[i];
+			break;
+		}
+	}
+	fido_cbor_info_free(&info);
+	if (*ret == -1)
+		skdebug(__func__, "option %s is unknown", opt);
+	else
+		skdebug(__func__, "option %s is %s", opt, *ret ? "on" : "off");
+
+	return 0;
+}
+
 static struct sk_usbhid *
 sk_select_by_cred(const fido_dev_info_t *devlist, size_t ndevs,
     const char *application, const uint8_t *key_handle, size_t key_handle_len)
@@ -504,48 +546,6 @@ sk_probe(const char *application, const uint8_t *key_handle,
 	return sk;
 }
 
-static int
-check_sk_options(fido_dev_t *dev, const char *opt, int *ret)
-{
-	fido_cbor_info_t *info;
-	char * const *name;
-	const bool *value;
-	size_t len, i;
-	int r;
-
-	*ret = -1;
-
-	if (!fido_dev_is_fido2(dev)) {
-		skdebug(__func__, "device is not fido2");
-		return 0;
-	}
-	if ((info = fido_cbor_info_new()) == NULL) {
-		skdebug(__func__, "fido_cbor_info_new failed");
-		return -1;
-	}
-	if ((r = fido_dev_get_cbor_info(dev, info)) != FIDO_OK) {
-		skdebug(__func__, "fido_dev_get_cbor_info: %s", fido_strerr(r));
-		fido_cbor_info_free(&info);
-		return -1;
-	}
-	name = fido_cbor_info_options_name_ptr(info);
-	value = fido_cbor_info_options_value_ptr(info);
-	len = fido_cbor_info_options_len(info);
-	for (i = 0; i < len; i++) {
-		if (!strcmp(name[i], opt)) {
-			*ret = value[i];
-			break;
-		}
-	}
-	fido_cbor_info_free(&info);
-	if (*ret == -1)
-		skdebug(__func__, "option %s is unknown", opt);
-	else
-		skdebug(__func__, "option %s is %s", opt, *ret ? "on" : "off");
-
-	return 0;
-}
-
 #ifdef WITH_OPENSSL
 /*
  * The key returned via fido_cred_pubkey_ptr() is in affine coordinates,

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list