summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-05-02 09:36:42 +0000
committerDamien Miller <djm@mindrot.org>2016-05-02 20:35:05 +1000
commit57464e3934ba53ad8590ee3ccd840f693407fc1e (patch)
treea87cc5d5de85e4ea3b735d8bff2dbc9f4b35f2dc /ssh-keygen.c
parent1a31d02b2411c4718de58ce796dbb7b5e14db93e (diff)
upstream commit
support SHA256 and SHA512 RSA signatures in certificates; ok markus@ Upstream-ID: b45be2f2ce8cacd794dc5730edaabc90e5eb434a
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 079f10321..0bd5fc93a 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.289 2016/05/02 08:49:03 djm Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.290 2016/05/02 09:36:42 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1599,6 +1599,12 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1599 ca = load_identity(tmp); 1599 ca = load_identity(tmp);
1600 free(tmp); 1600 free(tmp);
1601 1601
1602 if (key_type_name != NULL &&
1603 sshkey_type_from_name(key_type_name) != ca->type) {
1604 fatal("CA key type %s doesn't match specified %s",
1605 sshkey_ssh_name(ca), key_type_name);
1606 }
1607
1602 for (i = 0; i < argc; i++) { 1608 for (i = 0; i < argc; i++) {
1603 /* Split list of principals */ 1609 /* Split list of principals */
1604 n = 0; 1610 n = 0;
@@ -1640,8 +1646,8 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1640 &public->cert->signature_key)) != 0) 1646 &public->cert->signature_key)) != 0)
1641 fatal("key_from_private (ca key): %s", ssh_err(r)); 1647 fatal("key_from_private (ca key): %s", ssh_err(r));
1642 1648
1643 if (sshkey_certify(public, ca) != 0) 1649 if ((r = sshkey_certify(public, ca, key_type_name)) != 0)
1644 fatal("Couldn't not certify key %s", tmp); 1650 fatal("Couldn't certify key %s: %s", tmp, ssh_err(r));
1645 1651
1646 if ((cp = strrchr(tmp, '.')) != NULL && strcmp(cp, ".pub") == 0) 1652 if ((cp = strrchr(tmp, '.')) != NULL && strcmp(cp, ".pub") == 0)
1647 *cp = '\0'; 1653 *cp = '\0';