diff options
-rw-r--r-- | sshconnect2.c | 9 | ||||
-rw-r--r-- | sshkey.c | 8 | ||||
-rw-r--r-- | sshkey.h | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index ff3b0bede..db95cb214 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.273 2018/07/03 13:07:58 djm Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.274 2018/07/03 13:20:25 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -996,7 +996,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, struct ssh *ssh) | |||
996 | static char * | 996 | static char * |
997 | key_sig_algorithm(struct ssh *ssh, const struct sshkey *key) | 997 | key_sig_algorithm(struct ssh *ssh, const struct sshkey *key) |
998 | { | 998 | { |
999 | char *allowed, *oallowed, *cp, *alg = NULL; | 999 | char *allowed, *oallowed, *cp, *tmp, *alg = NULL; |
1000 | 1000 | ||
1001 | /* | 1001 | /* |
1002 | * The signature algorithm will only differ from the key algorithm | 1002 | * The signature algorithm will only differ from the key algorithm |
@@ -1020,7 +1020,10 @@ key_sig_algorithm(struct ssh *ssh, const struct sshkey *key) | |||
1020 | while ((cp = strsep(&allowed, ",")) != NULL) { | 1020 | while ((cp = strsep(&allowed, ",")) != NULL) { |
1021 | if (sshkey_type_from_name(cp) != key->type) | 1021 | if (sshkey_type_from_name(cp) != key->type) |
1022 | continue; | 1022 | continue; |
1023 | alg = match_list(cp, ssh->kex->server_sig_algs, NULL); | 1023 | tmp = match_list(sshkey_sigalg_by_name(cp), ssh->kex->server_sig_algs, NULL); |
1024 | if (tmp != NULL) | ||
1025 | alg = xstrdup(cp); | ||
1026 | free(tmp); | ||
1024 | if (alg != NULL) | 1027 | if (alg != NULL) |
1025 | break; | 1028 | break; |
1026 | } | 1029 | } |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.c,v 1.65 2018/07/03 11:39:54 djm Exp $ */ | 1 | /* $OpenBSD: sshkey.c,v 1.66 2018/07/03 13:20:25 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. |
@@ -2244,8 +2244,8 @@ get_sigtype(const u_char *sig, size_t siglen, char **sigtypep) | |||
2244 | /* | 2244 | /* |
2245 | * Returns the expected signature algorithm for a given public key algorithm. | 2245 | * Returns the expected signature algorithm for a given public key algorithm. |
2246 | */ | 2246 | */ |
2247 | static const char * | 2247 | const char * |
2248 | sigalg_by_name(const char *name) | 2248 | sshkey_sigalg_by_name(const char *name) |
2249 | { | 2249 | { |
2250 | const struct keytype *kt; | 2250 | const struct keytype *kt; |
2251 | 2251 | ||
@@ -2276,7 +2276,7 @@ sshkey_check_sigtype(const u_char *sig, size_t siglen, | |||
2276 | 2276 | ||
2277 | if (requested_alg == NULL) | 2277 | if (requested_alg == NULL) |
2278 | return 0; | 2278 | return 0; |
2279 | if ((expected_alg = sigalg_by_name(requested_alg)) == NULL) | 2279 | if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == NULL) |
2280 | return SSH_ERR_INVALID_ARGUMENT; | 2280 | return SSH_ERR_INVALID_ARGUMENT; |
2281 | if ((r = get_sigtype(sig, siglen, &sigtype)) != 0) | 2281 | if ((r = get_sigtype(sig, siglen, &sigtype)) != 0) |
2282 | return r; | 2282 | return r; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.h,v 1.25 2018/07/03 11:39:54 djm Exp $ */ | 1 | /* $OpenBSD: sshkey.h,v 1.26 2018/07/03 13:20:25 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -196,6 +196,7 @@ int sshkey_sign(const struct sshkey *, u_char **, size_t *, | |||
196 | int sshkey_verify(const struct sshkey *, const u_char *, size_t, | 196 | int sshkey_verify(const struct sshkey *, const u_char *, size_t, |
197 | const u_char *, size_t, const char *, u_int); | 197 | const u_char *, size_t, const char *, u_int); |
198 | int sshkey_check_sigtype(const u_char *, size_t, const char *); | 198 | int sshkey_check_sigtype(const u_char *, size_t, const char *); |
199 | const char *sshkey_sigalg_by_name(const char *); | ||
199 | 200 | ||
200 | /* for debug */ | 201 | /* for debug */ |
201 | void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *); | 202 | void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *); |