[openssh-commits] [openssh] 03/10: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Dec 19 16:18:16 AEDT 2017


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

djm pushed a commit to branch master
in repository openssh.

commit 931c78dfd7fe30669681a59e536bbe66535f3ee9
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Mon Dec 18 02:22:29 2017 +0000

    upstream commit
    
    sshkey_sigtype() function to return the type of a
    signature; ok markus@
    
    OpenBSD-Commit-ID: d3772b065ad6eed97285589bfb544befed9032e8
---
 sshkey.c | 27 ++++++++++++++++++++++++++-
 sshkey.h |  3 ++-
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/sshkey.c b/sshkey.c
index 1e390420..19f26a11 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.57 2017/10/13 06:24:51 djm Exp $ */
+/* $OpenBSD: sshkey.c,v 1.58 2017/12/18 02:22:29 djm Exp $ */
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
  * Copyright (c) 2008 Alexander von Gernler.  All rights reserved.
@@ -2049,6 +2049,31 @@ sshkey_froms(struct sshbuf *buf, struct sshkey **keyp)
 	return r;
 }
 
+int
+sshkey_sigtype(const u_char *sig, size_t siglen, char **sigtypep)
+{
+	int r;
+	struct sshbuf *b = NULL;
+	char *sigtype = NULL;
+
+	if (sigtypep != NULL)
+		*sigtypep = NULL;
+	if ((b = sshbuf_from(sig, siglen)) == NULL)
+		return SSH_ERR_ALLOC_FAIL;
+	if ((r = sshbuf_get_cstring(b, &sigtype, NULL)) != 0)
+		goto out;
+	/* success */
+	if (sigtypep != NULL) {
+		*sigtypep = sigtype;
+		sigtype = NULL;
+	}
+	r = 0;
+ out:
+	free(sigtype);
+	sshbuf_free(b);
+	return r;
+}
+
 int
 sshkey_sign(const struct sshkey *key,
     u_char **sigp, size_t *lenp,
diff --git a/sshkey.h b/sshkey.h
index 9093eac5..b5346a92 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.h,v 1.21 2017/07/01 13:50:45 djm Exp $ */
+/* $OpenBSD: sshkey.h,v 1.22 2017/12/18 02:22:29 djm Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
@@ -174,6 +174,7 @@ int	 sshkey_puts(const struct sshkey *, struct sshbuf *);
 int	 sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *);
 int	 sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
 
+int	 sshkey_sigtype(const u_char *, size_t, char **);
 int	 sshkey_sign(const struct sshkey *, u_char **, size_t *,
     const u_char *, size_t, const char *, u_int);
 int	 sshkey_verify(const struct sshkey *, const u_char *, size_t,

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


More information about the openssh-commits mailing list