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 /sshkey.c | |
parent | dd8002fbe63d903ffea5be7b7f5fc2714acab4a0 (diff) |
upstream: make get_sigtype public as sshkey_get_sigtype(); ok
markus@
OpenBSD-Commit-ID: 01f8cdbec63350490d2249f41112c5780d1cfbb8
Diffstat (limited to 'sshkey.c')
-rw-r--r-- | sshkey.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.c,v 1.81 2019/07/16 13:18:39 djm Exp $ */ | 1 | /* $OpenBSD: sshkey.c,v 1.82 2019/09/03 08:31:20 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. |
@@ -90,7 +90,6 @@ int sshkey_private_serialize_opt(struct sshkey *key, | |||
90 | struct sshbuf *buf, enum sshkey_serialize_rep); | 90 | struct sshbuf *buf, enum sshkey_serialize_rep); |
91 | static int sshkey_from_blob_internal(struct sshbuf *buf, | 91 | static int sshkey_from_blob_internal(struct sshbuf *buf, |
92 | struct sshkey **keyp, int allow_cert); | 92 | struct sshkey **keyp, int allow_cert); |
93 | static int get_sigtype(const u_char *sig, size_t siglen, char **sigtypep); | ||
94 | 93 | ||
95 | /* Supported key types */ | 94 | /* Supported key types */ |
96 | struct keytype { | 95 | struct keytype { |
@@ -2200,7 +2199,8 @@ cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf) | |||
2200 | if ((ret = sshkey_verify(key->cert->signature_key, sig, slen, | 2199 | if ((ret = sshkey_verify(key->cert->signature_key, sig, slen, |
2201 | sshbuf_ptr(key->cert->certblob), signed_len, NULL, 0)) != 0) | 2200 | sshbuf_ptr(key->cert->certblob), signed_len, NULL, 0)) != 0) |
2202 | goto out; | 2201 | goto out; |
2203 | if ((ret = get_sigtype(sig, slen, &key->cert->signature_type)) != 0) | 2202 | if ((ret = sshkey_get_sigtype(sig, slen, |
2203 | &key->cert->signature_type)) != 0) | ||
2204 | goto out; | 2204 | goto out; |
2205 | 2205 | ||
2206 | /* Success */ | 2206 | /* Success */ |
@@ -2502,8 +2502,8 @@ sshkey_froms(struct sshbuf *buf, struct sshkey **keyp) | |||
2502 | return r; | 2502 | return r; |
2503 | } | 2503 | } |
2504 | 2504 | ||
2505 | static int | 2505 | int |
2506 | get_sigtype(const u_char *sig, size_t siglen, char **sigtypep) | 2506 | sshkey_get_sigtype(const u_char *sig, size_t siglen, char **sigtypep) |
2507 | { | 2507 | { |
2508 | int r; | 2508 | int r; |
2509 | struct sshbuf *b = NULL; | 2509 | struct sshbuf *b = NULL; |
@@ -2585,7 +2585,7 @@ sshkey_check_sigtype(const u_char *sig, size_t siglen, | |||
2585 | return 0; | 2585 | return 0; |
2586 | if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == NULL) | 2586 | if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == NULL) |
2587 | return SSH_ERR_INVALID_ARGUMENT; | 2587 | return SSH_ERR_INVALID_ARGUMENT; |
2588 | if ((r = get_sigtype(sig, siglen, &sigtype)) != 0) | 2588 | if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0) |
2589 | return r; | 2589 | return r; |
2590 | r = strcmp(expected_alg, sigtype) == 0; | 2590 | r = strcmp(expected_alg, sigtype) == 0; |
2591 | free(sigtype); | 2591 | free(sigtype); |
@@ -2861,7 +2861,7 @@ sshkey_certify_custom(struct sshkey *k, struct sshkey *ca, const char *alg, | |||
2861 | sshbuf_len(cert), alg, 0, signer_ctx)) != 0) | 2861 | sshbuf_len(cert), alg, 0, signer_ctx)) != 0) |
2862 | goto out; | 2862 | goto out; |
2863 | /* Check and update signature_type against what was actually used */ | 2863 | /* Check and update signature_type against what was actually used */ |
2864 | if ((ret = get_sigtype(sig_blob, sig_len, &sigtype)) != 0) | 2864 | if ((ret = sshkey_get_sigtype(sig_blob, sig_len, &sigtype)) != 0) |
2865 | goto out; | 2865 | goto out; |
2866 | if (alg != NULL && strcmp(alg, sigtype) != 0) { | 2866 | if (alg != NULL && strcmp(alg, sigtype) != 0) { |
2867 | ret = SSH_ERR_SIGN_ALG_UNSUPPORTED; | 2867 | ret = SSH_ERR_SIGN_ALG_UNSUPPORTED; |