summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2018-02-23 15:58:37 +0000
committerDamien Miller <djm@mindrot.org>2018-02-26 11:40:41 +1100
commit1b11ea7c58cd5c59838b5fa574cd456d6047b2d4 (patch)
tree7e96cb41b5234b9d327f7c8f41392f09aed0994e /ssh-keygen.c
parent7d330a1ac02076de98cfc8fda05353d57b603755 (diff)
upstream: Add experimental support for PQC XMSS keys (Extended
Hash-Based Signatures) The code is not compiled in by default (see WITH_XMSS in Makefile.inc) Joint work with stefan-lukas_gazdag at genua.eu See https://tools.ietf.org/html/draft-irtf-cfrg-xmss-hash-based-signatures-12 ok djm@ OpenBSD-Commit-ID: ef3eccb96762a5d6f135d7daeef608df7776a7ac
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 9812c0d2a..d80930eeb 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.312 2018/02/10 05:48:46 djm Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.313 2018/02/23 15:58:38 markus 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
@@ -275,6 +275,10 @@ ask_filename(struct passwd *pw, const char *prompt)
275 case KEY_ED25519_CERT: 275 case KEY_ED25519_CERT:
276 name = _PATH_SSH_CLIENT_ID_ED25519; 276 name = _PATH_SSH_CLIENT_ID_ED25519;
277 break; 277 break;
278 case KEY_XMSS:
279 case KEY_XMSS_CERT:
280 name = _PATH_SSH_CLIENT_ID_XMSS;
281 break;
278 default: 282 default:
279 fatal("bad key type"); 283 fatal("bad key type");
280 } 284 }
@@ -969,6 +973,9 @@ do_gen_all_hostkeys(struct passwd *pw)
969#endif /* OPENSSL_HAS_ECC */ 973#endif /* OPENSSL_HAS_ECC */
970#endif /* WITH_OPENSSL */ 974#endif /* WITH_OPENSSL */
971 { "ed25519", "ED25519",_PATH_HOST_ED25519_KEY_FILE }, 975 { "ed25519", "ED25519",_PATH_HOST_ED25519_KEY_FILE },
976#ifdef WITH_XMSS
977 { "xmss", "XMSS",_PATH_HOST_XMSS_KEY_FILE },
978#endif /* WITH_XMSS */
972 { NULL, NULL, NULL } 979 { NULL, NULL, NULL }
973 }; 980 };
974 981
@@ -1455,7 +1462,8 @@ do_change_comment(struct passwd *pw)
1455 } 1462 }
1456 } 1463 }
1457 1464
1458 if (private->type != KEY_ED25519 && !use_new_format) { 1465 if (private->type != KEY_ED25519 && private->type != KEY_XMSS &&
1466 !use_new_format) {
1459 error("Comments are only supported for keys stored in " 1467 error("Comments are only supported for keys stored in "
1460 "the new format (-o)."); 1468 "the new format (-o).");
1461 explicit_bzero(passphrase, strlen(passphrase)); 1469 explicit_bzero(passphrase, strlen(passphrase));
@@ -1705,7 +1713,8 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1705 fatal("%s: unable to open \"%s\": %s", 1713 fatal("%s: unable to open \"%s\": %s",
1706 __func__, tmp, ssh_err(r)); 1714 __func__, tmp, ssh_err(r));
1707 if (public->type != KEY_RSA && public->type != KEY_DSA && 1715 if (public->type != KEY_RSA && public->type != KEY_DSA &&
1708 public->type != KEY_ECDSA && public->type != KEY_ED25519) 1716 public->type != KEY_ECDSA && public->type != KEY_ED25519 &&
1717 public->type != KEY_XMSS)
1709 fatal("%s: key \"%s\" type %s cannot be certified", 1718 fatal("%s: key \"%s\" type %s cannot be certified",
1710 __func__, tmp, sshkey_type(public)); 1719 __func__, tmp, sshkey_type(public));
1711 1720
@@ -2405,7 +2414,7 @@ main(int argc, char **argv)
2405 gen_all_hostkeys = 1; 2414 gen_all_hostkeys = 1;
2406 break; 2415 break;
2407 case 'b': 2416 case 'b':
2408 bits = (u_int32_t)strtonum(optarg, 256, 32768, &errstr); 2417 bits = (u_int32_t)strtonum(optarg, 10, 32768, &errstr);
2409 if (errstr) 2418 if (errstr)
2410 fatal("Bits has bad value %s (%s)", 2419 fatal("Bits has bad value %s (%s)",
2411 optarg, errstr); 2420 optarg, errstr);
@@ -2683,6 +2692,8 @@ main(int argc, char **argv)
2683 _PATH_HOST_ECDSA_KEY_FILE, rr_hostname); 2692 _PATH_HOST_ECDSA_KEY_FILE, rr_hostname);
2684 n += do_print_resource_record(pw, 2693 n += do_print_resource_record(pw,
2685 _PATH_HOST_ED25519_KEY_FILE, rr_hostname); 2694 _PATH_HOST_ED25519_KEY_FILE, rr_hostname);
2695 n += do_print_resource_record(pw,
2696 _PATH_HOST_XMSS_KEY_FILE, rr_hostname);
2686 if (n == 0) 2697 if (n == 0)
2687 fatal("no keys found."); 2698 fatal("no keys found.");
2688 exit(0); 2699 exit(0);