summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-rsa.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2016-09-12 23:39:34 +0000
committerdjm <djm@openbsd.org>2016-09-12 23:39:34 +0000
commit2859dac22373b3741595acdb911a0e8dcff3346a (patch)
tree8acef1a1ff9d0c9f600a7c2b2ee9454e5f5efa4d /usr.bin/ssh/ssh-rsa.c
parentlist all supported signature algorithms in the server-sig-algs (diff)
downloadwireguard-openbsd-2859dac22373b3741595acdb911a0e8dcff3346a.tar.xz
wireguard-openbsd-2859dac22373b3741595acdb911a0e8dcff3346a.zip
handle certs in rsa_hash_alg_from_ident(), saving an unnecessary
special case elsewhere.
Diffstat (limited to 'usr.bin/ssh/ssh-rsa.c')
-rw-r--r--usr.bin/ssh/ssh-rsa.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh-rsa.c b/usr.bin/ssh/ssh-rsa.c
index 8c64235e465..ed881edaab0 100644
--- a/usr.bin/ssh/ssh-rsa.c
+++ b/usr.bin/ssh/ssh-rsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-rsa.c,v 1.59 2016/04/21 06:08:02 djm Exp $ */
+/* $OpenBSD: ssh-rsa.c,v 1.60 2016/09/12 23:39:34 djm Exp $ */
/*
* Copyright (c) 2000, 2003 Markus Friedl <markus@openbsd.org>
*
@@ -48,7 +48,8 @@ rsa_hash_alg_ident(int hash_alg)
static int
rsa_hash_alg_from_ident(const char *ident)
{
- if (strcmp(ident, "ssh-rsa") == 0)
+ if (strcmp(ident, "ssh-rsa") == 0 ||
+ strcmp(ident, "ssh-rsa-cert-v01@openssh.com") == 0)
return SSH_DIGEST_SHA1;
if (strcmp(ident, "rsa-sha2-256") == 0)
return SSH_DIGEST_SHA256;
@@ -88,8 +89,7 @@ ssh_rsa_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
if (sigp != NULL)
*sigp = NULL;
- if (alg_ident == NULL || strlen(alg_ident) == 0 ||
- strncmp(alg_ident, "ssh-rsa-cert", strlen("ssh-rsa-cert")) == 0)
+ if (alg_ident == NULL || strlen(alg_ident) == 0)
hash_alg = SSH_DIGEST_SHA1;
else
hash_alg = rsa_hash_alg_from_ident(alg_ident);