diff options
Diffstat (limited to 'sshkey.c')
-rw-r--r-- | sshkey.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.c,v 1.57 2017/10/13 06:24:51 djm Exp $ */ | 1 | /* $OpenBSD: sshkey.c,v 1.58 2017/12/18 02:22:29 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Alexander von Gernler. All rights reserved. | 4 | * Copyright (c) 2008 Alexander von Gernler. All rights reserved. |
@@ -2050,6 +2050,31 @@ sshkey_froms(struct sshbuf *buf, struct sshkey **keyp) | |||
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | int | 2052 | int |
2053 | sshkey_sigtype(const u_char *sig, size_t siglen, char **sigtypep) | ||
2054 | { | ||
2055 | int r; | ||
2056 | struct sshbuf *b = NULL; | ||
2057 | char *sigtype = NULL; | ||
2058 | |||
2059 | if (sigtypep != NULL) | ||
2060 | *sigtypep = NULL; | ||
2061 | if ((b = sshbuf_from(sig, siglen)) == NULL) | ||
2062 | return SSH_ERR_ALLOC_FAIL; | ||
2063 | if ((r = sshbuf_get_cstring(b, &sigtype, NULL)) != 0) | ||
2064 | goto out; | ||
2065 | /* success */ | ||
2066 | if (sigtypep != NULL) { | ||
2067 | *sigtypep = sigtype; | ||
2068 | sigtype = NULL; | ||
2069 | } | ||
2070 | r = 0; | ||
2071 | out: | ||
2072 | free(sigtype); | ||
2073 | sshbuf_free(b); | ||
2074 | return r; | ||
2075 | } | ||
2076 | |||
2077 | int | ||
2053 | sshkey_sign(const struct sshkey *key, | 2078 | sshkey_sign(const struct sshkey *key, |
2054 | u_char **sigp, size_t *lenp, | 2079 | u_char **sigp, size_t *lenp, |
2055 | const u_char *data, size_t datalen, const char *alg, u_int compat) | 2080 | const u_char *data, size_t datalen, const char *alg, u_int compat) |