diff options
author | markus@openbsd.org <markus@openbsd.org> | 2019-11-12 19:33:08 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-13 08:54:09 +1100 |
commit | 2c55744a56de0ffc81fe445a1e7fc5cd308712b3 (patch) | |
tree | 349cdc436823354aca60031358a6030313b6002d /ssh-keygen.c | |
parent | fd1a3b5e38721b1d69aae2d9de1a1d9155dfa5c7 (diff) |
upstream: enable ed25519 support; ok djm
OpenBSD-Commit-ID: 1a399c5b3ef15bd8efb916110cf5a9e0b554ab7e
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r-- | ssh-keygen.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c index ac34f314b..030b3684e 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keygen.c,v 1.361 2019/11/08 03:54:02 djm Exp $ */ | 1 | /* $OpenBSD: ssh-keygen.c,v 1.362 2019/11/12 19:33:08 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 |
@@ -287,6 +287,10 @@ ask_filename(struct passwd *pw, const char *prompt) | |||
287 | case KEY_ED25519_CERT: | 287 | case KEY_ED25519_CERT: |
288 | name = _PATH_SSH_CLIENT_ID_ED25519; | 288 | name = _PATH_SSH_CLIENT_ID_ED25519; |
289 | break; | 289 | break; |
290 | case KEY_ED25519_SK: | ||
291 | case KEY_ED25519_SK_CERT: | ||
292 | name = _PATH_SSH_CLIENT_ID_ED25519_SK; | ||
293 | break; | ||
290 | case KEY_XMSS: | 294 | case KEY_XMSS: |
291 | case KEY_XMSS_CERT: | 295 | case KEY_XMSS_CERT: |
292 | name = _PATH_SSH_CLIENT_ID_XMSS; | 296 | name = _PATH_SSH_CLIENT_ID_XMSS; |
@@ -3255,16 +3259,23 @@ main(int argc, char **argv) | |||
3255 | printf("Generating public/private %s key pair.\n", | 3259 | printf("Generating public/private %s key pair.\n", |
3256 | key_type_name); | 3260 | key_type_name); |
3257 | if (type == KEY_ECDSA_SK) { | 3261 | if (type == KEY_ECDSA_SK) { |
3262 | switch (type) { | ||
3263 | case KEY_ECDSA_SK: | ||
3264 | case KEY_ED25519_SK: | ||
3258 | #ifndef ENABLE_SK | 3265 | #ifndef ENABLE_SK |
3259 | fatal("Security key support was disabled at compile time"); | 3266 | fatal("Security key support was disabled at compile time"); |
3260 | #else /* ENABLE_SK */ | 3267 | #else /* ENABLE_SK */ |
3261 | if (sshsk_enroll(sk_provider, | 3268 | if (sshsk_enroll(type, sk_provider, |
3262 | cert_key_id == NULL ? "ssh:" : cert_key_id, | 3269 | cert_key_id == NULL ? "ssh:" : cert_key_id, |
3263 | sk_flags, NULL, &private, NULL) != 0) | 3270 | sk_flags, NULL, &private, NULL) != 0) |
3264 | exit(1); /* error message already printed */ | 3271 | exit(1); /* error message already printed */ |
3272 | break; | ||
3265 | #endif /* ENABLE_SK */ | 3273 | #endif /* ENABLE_SK */ |
3266 | } else if ((r = sshkey_generate(type, bits, &private)) != 0) | 3274 | default: |
3267 | fatal("sshkey_generate failed"); | 3275 | if ((r = sshkey_generate(type, bits, &private)) != 0) |
3276 | fatal("sshkey_generate failed"); | ||
3277 | break; | ||
3278 | } | ||
3268 | if ((r = sshkey_from_private(private, &public)) != 0) | 3279 | if ((r = sshkey_from_private(private, &public)) != 0) |
3269 | fatal("sshkey_from_private failed: %s\n", ssh_err(r)); | 3280 | fatal("sshkey_from_private failed: %s\n", ssh_err(r)); |
3270 | 3281 | ||