diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-09-03 08:31:20 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-09-03 18:39:31 +1000 |
commit | f8df0413f0a057b6a3d3dd7bd8bc7c5d80911d3a (patch) | |
tree | 185ec8001d13cf5e20531a25df53968d33cf9b29 | |
parent | dd8002fbe63d903ffea5be7b7f5fc2714acab4a0 (diff) |
upstream: make get_sigtype public as sshkey_get_sigtype(); ok
markus@
OpenBSD-Commit-ID: 01f8cdbec63350490d2249f41112c5780d1cfbb8
-rw-r--r-- | sshkey.c | 14 | ||||
-rw-r--r-- | sshkey.h | 3 |
2 files changed, 9 insertions, 8 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.c,v 1.81 2019/07/16 13:18:39 djm Exp $ */ +/* $OpenBSD: sshkey.c,v 1.82 2019/09/03 08:31:20 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved. @@ -90,7 +90,6 @@ int sshkey_private_serialize_opt(struct sshkey *key, struct sshbuf *buf, enum sshkey_serialize_rep); static int sshkey_from_blob_internal(struct sshbuf *buf, struct sshkey **keyp, int allow_cert); -static int get_sigtype(const u_char *sig, size_t siglen, char **sigtypep); /* Supported key types */ struct keytype { @@ -2200,7 +2199,8 @@ cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf) if ((ret = sshkey_verify(key->cert->signature_key, sig, slen, sshbuf_ptr(key->cert->certblob), signed_len, NULL, 0)) != 0) goto out; - if ((ret = get_sigtype(sig, slen, &key->cert->signature_type)) != 0) + if ((ret = sshkey_get_sigtype(sig, slen, + &key->cert->signature_type)) != 0) goto out; /* Success */ @@ -2502,8 +2502,8 @@ sshkey_froms(struct sshbuf *buf, struct sshkey **keyp) return r; } -static int -get_sigtype(const u_char *sig, size_t siglen, char **sigtypep) +int +sshkey_get_sigtype(const u_char *sig, size_t siglen, char **sigtypep) { int r; struct sshbuf *b = NULL; @@ -2585,7 +2585,7 @@ sshkey_check_sigtype(const u_char *sig, size_t siglen, return 0; if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == NULL) return SSH_ERR_INVALID_ARGUMENT; - if ((r = get_sigtype(sig, siglen, &sigtype)) != 0) + if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0) return r; r = strcmp(expected_alg, sigtype) == 0; free(sigtype); @@ -2861,7 +2861,7 @@ sshkey_certify_custom(struct sshkey *k, struct sshkey *ca, const char *alg, sshbuf_len(cert), alg, 0, signer_ctx)) != 0) goto out; /* Check and update signature_type against what was actually used */ - if ((ret = get_sigtype(sig_blob, sig_len, &sigtype)) != 0) + if ((ret = sshkey_get_sigtype(sig_blob, sig_len, &sigtype)) != 0) goto out; if (alg != NULL && strcmp(alg, sigtype) != 0) { ret = SSH_ERR_SIGN_ALG_UNSUPPORTED; @@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.h,v 1.33 2019/07/15 13:16:29 djm Exp $ */ +/* $OpenBSD: sshkey.h,v 1.34 2019/09/03 08:31:20 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. @@ -214,6 +214,7 @@ int sshkey_verify(const struct sshkey *, const u_char *, size_t, const u_char *, size_t, const char *, u_int); int sshkey_check_sigtype(const u_char *, size_t, const char *); const char *sshkey_sigalg_by_name(const char *); +int sshkey_get_sigtype(const u_char *, size_t, char **); /* for debug */ void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *); |