[openssh-commits] [openssh] 01/04: upstream: more debugging; behind DEBUG_SK

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Nov 27 11:03:18 AEDT 2019


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

djm pushed a commit to branch master
in repository openssh.

commit e0d38ae9bc8c0de421605b9021d8144e4d8ff22b
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Tue Nov 26 03:04:27 2019 +0000

    upstream: more debugging; behind DEBUG_SK
    
    OpenBSD-Commit-ID: a978896227118557505999ddefc1f4c839818b60
---
 ssh-ecdsa-sk.c   |  6 +++++-
 ssh-ed25519-sk.c | 23 ++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/ssh-ecdsa-sk.c b/ssh-ecdsa-sk.c
index b2f31ae2..40f0dc8c 100644
--- a/ssh-ecdsa-sk.c
+++ b/ssh-ecdsa-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-ecdsa-sk.c,v 1.4 2019/11/25 00:51:37 djm Exp $ */
+/* $OpenBSD: ssh-ecdsa-sk.c,v 1.5 2019/11/26 03:04:27 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2010 Damien Miller.  All rights reserved.
@@ -113,6 +113,8 @@ ssh_ecdsa_sk_verify(const struct sshkey *key,
 		goto out;
 	}
 #ifdef DEBUG_SK
+	fprintf(stderr, "%s: data: (len %zu)\n", __func__, datalen);
+	/* sshbuf_dump_data(data, datalen, stderr); */
 	fprintf(stderr, "%s: sig_r: %s\n", __func__, (tmp = BN_bn2hex(sig_r)));
 	free(tmp);
 	fprintf(stderr, "%s: sig_s: %s\n", __func__, (tmp = BN_bn2hex(sig_s)));
@@ -140,6 +142,8 @@ ssh_ecdsa_sk_verify(const struct sshkey *key,
 	    strlen(key->sk_application), apphash, sizeof(apphash))) != 0)
 		goto out;
 #ifdef DEBUG_SK
+	fprintf(stderr, "%s: hashed application:\n", __func__);
+	sshbuf_dump_data(apphash, sizeof(apphash), stderr);
 	fprintf(stderr, "%s: hashed message:\n", __func__);
 	sshbuf_dump_data(msghash, sizeof(msghash), stderr);
 #endif
diff --git a/ssh-ed25519-sk.c b/ssh-ed25519-sk.c
index d11fde6f..89bf479d 100644
--- a/ssh-ed25519-sk.c
+++ b/ssh-ed25519-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-ed25519-sk.c,v 1.3 2019/11/25 00:51:37 djm Exp $ */
+/* $OpenBSD: ssh-ed25519-sk.c,v 1.4 2019/11/26 03:04:27 djm Exp $ */
 /*
  * Copyright (c) 2019 Markus Friedl.  All rights reserved.
  *
@@ -14,6 +14,9 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+/* #define DEBUG_SK 1 */
+
 #define SSHKEY_INTERNAL
 #include <sys/types.h>
 #include <limits.h>
@@ -70,6 +73,14 @@ ssh_ed25519_sk_verify(const struct sshkey *key,
 		r = SSH_ERR_INVALID_FORMAT;
 		goto out;
 	}
+#ifdef DEBUG_SK
+	fprintf(stderr, "%s: data:\n", __func__);
+	/* sshbuf_dump_data(data, datalen, stderr); */
+	fprintf(stderr, "%s: sigblob:\n", __func__);
+	sshbuf_dump_data(sigblob, len, stderr);
+	fprintf(stderr, "%s: sig_flags = 0x%02x, sig_counter = %u\n",
+	    __func__, sig_flags, sig_counter);
+#endif
 	if (strcmp(sshkey_ssh_name_plain(key), ktype) != 0) {
 		r = SSH_ERR_KEY_TYPE_MISMATCH;
 		goto out;
@@ -89,6 +100,12 @@ ssh_ed25519_sk_verify(const struct sshkey *key,
 		r = SSH_ERR_INVALID_ARGUMENT;
 		goto out;
 	}
+#ifdef DEBUG_SK
+	fprintf(stderr, "%s: hashed application:\n", __func__);
+	sshbuf_dump_data(apphash, sizeof(apphash), stderr);
+	fprintf(stderr, "%s: hashed message:\n", __func__);
+	sshbuf_dump_data(msghash, sizeof(msghash), stderr);
+#endif
 	if ((details = calloc(1, sizeof(*details))) == NULL) {
 		r = SSH_ERR_ALLOC_FAIL;
 		goto out;
@@ -107,6 +124,10 @@ ssh_ed25519_sk_verify(const struct sshkey *key,
 		r = SSH_ERR_ALLOC_FAIL;
 		goto out;
 	}
+#ifdef DEBUG_SK
+	fprintf(stderr, "%s: signed buf:\n", __func__);
+	sshbuf_dump(encoded, stderr);
+#endif
 	sm = sshbuf_ptr(encoded);
 	smlen = sshbuf_len(encoded);
 	mlen = smlen;

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


More information about the openssh-commits mailing list