summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh-keygen.c
AgeCommit message (Collapse)Author
2024-12-04don't screw up ssh-keygen -l output when the file contains CRDamien Miller
characters; GHPR236 bz3385, fix from Dmitry Belyavskiy
2024-10-18allow "-" as output file for moduli screeningDamien Miller
based on GHPR393
2024-09-15include pathname in some of the ssh-keygen passphrase prompts. HelpsDamien Miller
the user know what's going on when ssh-keygen is invoked via other tools. Requested in GHPR503
2024-09-04be more strict in parsing key type names. Only allow shortnames (e.gDamien Miller
"rsa") in user-interface code and require full SSH protocol names (e.g. "ssh-rsa") everywhere else. Prompted by bz3725; ok markus@
2024-08-15Convert RSA and ECDSA key to the libcrypto EVP_PKEY API. DSA remainsDamien Miller
unconverted as it will be removed within six months. Based on patches originally from Dmitry Belyavskiy, but significantly reworked based on feedback from Bob Beck, Joel Sing and especially Theo Buehler (apologies to anyone I've missed). ok tb@
2024-01-11make DSA key support compile-time optional, defaulting to onDamien Miller
ok markus@
2023-09-04Generate Ed25519 keys when invoked without argumentsJob Snijders
Ed25519 public keys are very convenient due to their small size. OpenSSH has supported Ed25519 since version 6.5 (January 2014). OK djm@ markus@ sthen@ deraadt@
2023-07-17remove vestigal support for KRL signaturesDamien Miller
When the KRL format was originally defined, it included support for signing of KRL objects. However, the code to sign KRLs and verify KRL signatues was never completed in OpenSSH. Now, some years later, we have SSHSIG support in ssh-keygen that is more general, well tested and actually works. So this removes the semi-finished KRL signing/verification support from OpenSSH and refactors the remaining code to realise the benefit - primarily, we no longer need to perform multiple parsing passes over KRL objects. ok markus@
2023-07-14add defence-in-depth checks for some unreachable integer overflowsDamien Miller
reported by Yair Mizrahi @ JFrog; feedback/ok millert@
2023-06-20reset comment=NULL for each key in do_fingerprint(); fixes "no comment"Damien Miller
not showing on when running `ssh-keygen -l` on multiple keys where one has a comment and other following keys do not. Patch from Markus Kuhn via GHPR407, bz3580
2023-04-12fix double wordsJonathan Gray
ok dtucker@
2023-03-08use RSA/SHA256 when testing usability of private key;Damien Miller
based on fix in bz3546 by Dmitry Belyavskiy; with/ok dtucker
2023-03-05Fix mem and FILE leaks in moduli screening.Darren Tucker
If multiple -Ocheckpoint= options are passed, the earlier ones would be overwritten and leaked. If we use an input file that wasn't stdin, close that. From Coverity CIDs 291884 and 291894.
2023-03-05Plug mem leak in moduli checkpoint option parsing.Darren Tucker
From Coverity CID 291894.
2023-02-28Explicitly ignore return from fchmod similar to other calls toDarren Tucker
prevent warning.
2023-02-10let ssh-keygen and ssh-keyscan accept -Ohashalg=sha1|sha256 whenDamien Miller
outputting SSHFP fingerprints to allow algorithm selection. bz3493 ok dtucker@
2022-12-04userspace: remove vestigial '?' cases from top-level getopt(3) loopsScott Soule Cheloha
getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@
2022-11-07fix parsing of hex cert expiry time; was checking whether theDamien Miller
start time began with "0x", not the expiry time. from Ed Maste
2022-08-11allow certificate validity intervals, sshsig verification times andDamien Miller
authorized_keys expiry-time options to accept dates in the UTC time zone in addition to the default of interpreting them in the system time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed with a 'Z' character. Also allow certificate validity intervals to be specified in raw seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This is intended for use by regress tests and other tools that call ssh-keygen as part of a CA workflow. bz3468 ok dtucker
2022-08-05don't prompt for FIDO passphrase before attempting to enroll theDamien Miller
credential, just let the enroll operating fail and we'll attempt to get a PIN anyway. Might avoid some unneccessary PIN prompts. Part of GHPR#302 from Corinna Vinschen; ok dtucker@
2022-07-20ssh-keygen: fix touch prompt, pin retries;Damien Miller
part of GHPR329 from Pedro Martelletto
2022-07-20when enrolling a resident key on a security token, check if aDamien Miller
credential with matching application and user ID strings already exists. if so, prompt the user for confirmation before overwriting the credential. patch from Pedro Martelletto via GHPR329 NB. cranks SSH_SK_VERSION_MAJOR, so any third-party FIDO middleware implementations will need to adjust
2022-07-20pull passphrase reading and confirmation into a separate functionDamien Miller
so it can be used for FIDO2 PINs; no functional change
2022-06-03ssh-keygen -A: do not generate DSA keys by default. Based on github PR#303Darren Tucker
from jsegitz with man page text from jmc@, ok markus@ djm@
2022-05-31ssh-keygen: implement "verify-required" certificate optionChristian Weisgerber
This was already documented when support for user-verified FIDO keys was added, but the ssh-keygen(1) code was missing. ok djm@
2022-05-09Allow existing -U (use agent) flag to work with "-Y sign" operations,Damien Miller
where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@
2022-05-08improve error message when 'ssh-keygen -Y sign' is unable to load aDamien Miller
private key; bz3429, reported by Adam Szkoda ok dtucker@
2022-03-18helpful commentDamien Miller
2022-03-18ssh-keygen -Y check-novalidate requires namespace or SEGV will ensue.Damien Miller
Patch from Mateusz Adamowski via GHPR#307
2022-02-01mark const string array contents const too, i.e.Damien Miller
static const char *array => static const char * const array from Mike Frysinger
2022-01-05add a comment so I don't make this mistake againDamien Miller
2022-01-05fix cut-and-pasto in error messageDamien Miller
2022-01-05allow selection of hash at sshsig signing time; code already supportedDamien Miller
either sha512 (default) or sha256, but plumbing wasn't there mostly by Linus Nordberg
2022-01-05add missing -O option to usage() for ssh-keygen -Y sign;Damien Miller
from Linus Nordberg
2022-01-05move sig_process_opts() to before sig_sign(); no functional code changeDamien Miller
2021-11-28fix indenting in last commitDamien Miller
2021-11-27Add ssh-keygen -Y match-principals operation to perform matching ofDamien Miller
principals names against an allowed signers file. Requested by and mostly written by Fabian Stelzer, towards a TOFU model for SSH signatures in git. Some tweaks by me. "doesn't bother me" deraadt@
2021-10-29ssh-keygen: make verify-time argument parsing optionalDamien Miller
From Fabian Stelzer
2021-10-28When downloading resident keys from a FIDO token, pass back theDamien Miller
user ID that was used when the key was created and append it to the filename the key is written to (if it is not the default). Avoids keys being clobbered if the user created multiple resident keys with the same application string but different user IDs. feedback Pedro Martelletto; ok markus NB. increments SSH_SK_VERSION_MAJOR
2021-10-02Dynamically allocate encoded HashKnownHosts and free as appropriate.Darren Tucker
Saves 1k of static storage and prevents snprintf "possible truncation" warnings from newer compilers (although in this case it's false positive since the actual sizes are limited by the output size of the SHA1). ok djm@
2021-09-08correct my mistake in previous fix; spotted by halexDamien Miller
2021-09-07avoid NULL deref in -Y find-principals. Report and fix fromDamien Miller
Carlo Marcelo Arenas Belón
2021-08-11when verifying sshsig signatures, support an option (-Oprint-pubkey)Damien Miller
to dump the full public key to stdout; based on patch from Fabian Stelzer; ok markus@
2021-07-24Don't omit ssh-keygen -y from usage when built without OpenSSL. It isDarren Tucker
actually available, albeit only for ed25519 keys.
2021-07-24Exclude key conversion options from usage when built without OpenSSLDarren Tucker
since those are not available, similar to what we currently do with the moduli screening options. We can also use this to skip the conversion regression tests in this case.
2021-07-23Let allowed signers files used by ssh-keygen(1) signatures support keyDamien Miller
lifetimes, and allow the verification mode to specify a signature time to check at. This is intended for use by git to support signing objects using ssh keys. ok dtucker@
2021-07-09silence redundant error message; reported by Fabian StelzerDamien Miller
2021-07-05Order includes as per style(9). Portable already has these so thisDarren Tucker
removes a handful of diffs between the two.
2021-04-03highly polished whitespace, mostly fixing spaces-for-tab and badDamien Miller
indentation on continuation lines. Prompted by GHPR#185
2021-03-12pwcopy() struct passwd that we're going to reuse across a bunch ofDamien Miller
library calls; bz3273 ok dtucker@