- Mar 13, 2021
-
-
Simon Tatham authored
I've added the -E option, similar to ssh-keygen's, and cgtest checks it against the OpenSSH version to ensure they match.
-
Simon Tatham authored
There's a new enumeration of fingerprint types, and you tell ssh2_fingerprint() or ssh2_fingerprint_blob() which of them to use. So far, this is only implemented behind the scenes, and exposed for testcrypt to test. All the call sites of ssh2_fingerprint pass a fixed default fptype, which is still set to the old MD5. That will change shortly.
-
Simon Tatham authored
During testing just now, I found I kept absentmindedly expecting it to work, and I don't see any reason I shouldn't indulge that expectation.
-
Simon Tatham authored
These would have left the terminal in the wrong termios state, if a batch-mode Plink was run from a terminal and had to abort the connection due to a weak crypto primitive.
-
Simon Tatham authored
The assorted host-key and warning prompt messages have no reason to differ between the two platforms, so let's centralise them. Also, while I'm here, some basic support functions that are the same in both modules.
-
Simon Tatham authored
I've replaced the old versions using the standard MessageBox with new versions using custom-drawn dialog templates and dialog procedures. The visible changes are that the acceptance buttons have custom text describing the actions they'll take, like the GTK versions, instead of having to stick with bog-standard "Yes" and "No" and hope the user reads the explanation in the main box text. Also, this gives me the opportunity to spiff up the looks a bit, by making the "POTENTIAL SECURITY BREACH" in the wrong-host-key dialog larger and boldface. But those are minor cosmetic side effects of my real purpose, which is to make it possible to add further controls to these boxes in future.
-
- Mar 08, 2021
-
-
Simon Tatham authored
In the rework last month, term_setup_window_titles made a centralised decision about whether to make the default window title just the application name, or the hostname and application name separated by a dash. Unfortunately it based that decision on whether the hostname was NULL, whereas I'd meant to include a _empty_ hostname as not worth printing. As a result, the default window title for pterm became " - pterm", not just "pterm". Easily fixed.
-
- Mar 06, 2021
-
-
Simon Tatham authored
Happened to be spotted by ASan in the course of other work.
-
- Mar 04, 2021
-
-
Simon Tatham authored
Thanks to a user for pointing out that these do exist, but aren't mentioned on the web page I've been citing as a reference so far, and moreover, they need to be identified in a slightly different way.
-
- Feb 28, 2021
-
-
Simon Tatham authored
The About text is in a readonly edit control rather than a static control, so that it can be copy-pasted. Previously, I haven't managed to avoid the side effect of the edit control being surrounded by a border - but now I've finally found out how you can do it: clear all the border styles and _then_ use SetWindowPos to force a redraw of the frame.
-
- Feb 23, 2021
-
-
Simon Tatham authored
I left this out of yesterday's collection of cmdgen CLI options and GUI PuTTYgen dialog box, but only because I forgot about it. I don't know off the top of my head why someone would particularly want to configure this detail, but given that it _is_ configurable, it seems like no extra trouble to expose it along with the rest of the parameters, just in case.
-
Simon Tatham authored
When I added the fmt_version field to ppk_save_parameters, I forgot to fill it in in the special version of that struct used by cgtest. Without that, it defaulted to 0, triggering an assertion failure.
-
- Feb 22, 2021
-
-
Simon Tatham authored
The GUI key generator doesn't need a --reencrypt option, because you can already just click Load and then Save without changing anything in between. But it does need a dialog box with all the fiddly Argon2 settings in it, plus a setting to go back to PPK v2.
-
Simon Tatham authored
This allows you to manually adjust the Argon2 parameters so that you can trade off CPU requirements in legitimate use against difficulty of brute-force attack. It also allows downgrading the key file version back to the widespread PPK v2, so you can manually back-port a key that you accidentally generated too new.
-
Simon Tatham authored
This allows you to load and save the same key without making any semantic changes to it. Currently, you can only do that by pretending to make a change, like changing the passphrase or the comment to the same thing it was before. With two key file formats now supported, and a bunch of reconfigurable parameters in the v3 key derivation, it's now more likely that you'd want to re-encrypt the same key in a different way, to upgrade or downgrade or tinker with it. (Or perhaps even just re-randomise the salt, so that someone reading the key file doesn't know _whether_ you've changed the passphrase!)
-
Simon Tatham authored
This commit adds the capability in principle to ppk_save_sb, by adding a fmt_version field in the save parameters structure. As yet it's not connected up to any user interface in PuTTYgen, but I think I'll need to, because currently there's no way at all to convert PPK v3 back to v2, and surely people will need to interoperate with older installations of PuTTY, or with other PPK-consuming software.
-
Jacob Nevins authored
-
- Feb 21, 2021
-
-
Jacob Nevins authored
Backends were inconsistent about whether unused function members were explicitly initialised to NULL or it was left to implicit static initialisation. Standardise on the latter. No intended functional change.
-
Simon Tatham authored
Thanks to Pavel and his CI for pointing out what I'd forgotten: the automated test of cmdgen.c expects that round-tripping a PPK file to some other format and back will regenerate the identical file. Of course, with a randomised salt in the new-look password hash, that isn't true any more in normal usage. Fixed by adding an option in the existing parameters structure to provide a salt override. That shouldn't be used anywhere except cgtest, but in cgtest, it restores the determinism we need. Another potential (but not guaranteed) source of difference is the automatic time-scaling of the Argon2 parameter choice. So I've turned that off too, while I'm at it.
-
Jacob Nevins authored
(-supdup and -ssh-connection. The latter concept still needs more documentation.)
-
Jacob Nevins authored
Including noting that it can't be used with Plink, and better indexing.
-
Jacob Nevins authored
It's the backend that needs terminal emulation, not Plink.
-
Jacob Nevins authored
Suggested by Brian Rak.
-
Simon Tatham authored
A user reported a phenomenon where running 'plink -shareexists' very early in the connection would cause the receiving upstream PuTTY to exit cleanly with the message 'All channels closed' in the log. That wasn't hard to track down: that happens as a result of the connection layer callback sharing_no_more_downstreams(), which causes the connection layer to check whether it has any channels left open, and if not, to terminate the connection on the grounds that everything has finished. But it's premature to draw that conclusion if the reason no channels are open if we haven't _started_ yet! Now we have a 'started' flag which is set when we initialise mainchan, and the 'we're all done now' check will never fire before that flag is set. But in the course of investigating that, I found a second problem in the same area: at an even earlier stage of an SSH connection, the connshare system doesn't _even_ have the real ConnectionLayer pointer yet. Instead, it has a pointer to a dummy one provided by the top-level ssh.c, which contains a NULL vtable pointer. So if it calls sharing_no_more_downstreams on _that_ ConnectionLayer, it will dereference NULL and crash. So I've filled in cl_dummy's vtable pointer with a trivial vtable, containing only the one callback sharing_no_more_downstreams, which itself is a no-op function. Hopefully that should all be stable now.
-
Simon Tatham authored
Ahem. Called with size < 16, that could have underrun the internal counter and looped over all of memory. Fortunately I've so far only used it for 1024 bytes at a time!
-
- Feb 20, 2021
-
-
Simon Tatham authored
This removes both uses of SHA-1 in the file format: it was used as the MAC protecting the key file against tamperproofing, and also used in the key derivation step that converted the user's passphrase to cipher and MAC keys. The MAC is simply upgraded from HMAC-SHA-1 to HMAC-SHA-256; it is otherwise unchanged in how it's applied (in particular, to what data). The key derivation is totally reworked, to be based on Argon2, which I've just added to the code base. This should make stolen encrypted key files more resistant to brute-force attack. Argon2 has assorted configurable parameters for memory and CPU usage; the new key format includes all those parameters. So there's no reason we can't have them under user control, if a user wants to be particularly vigorous or particularly lightweight with their own key files. They could even switch to one of the other flavours of Argon2, if they thought side channels were an especially large or small risk in their particular environment. In this commit I haven't added any UI for controlling that kind of thing, but the PPK loading function is all set up to cope, so that can all be added in a future commit without having to change the file format. While I'm at it, I've also switched the CBC encryption to using a random IV (or rather, one derived from the passphrase along with the cipher and MAC keys). That's more like normal SSH-2 practice.
-
Simon Tatham authored
This is going to be used in the new version of the PPK file format. It was the winner of the Password Hashing Context, which I think makes it a reasonable choice. Argon2 comes in three flavours: one with no data dependency in its memory addressing, one with _deliberate_ data dependency (intended to serialise computation, to hinder parallel brute-forcing), and a hybrid form that starts off data-independent and then switches over to the dependent version once the sensitive input data has been adequately mixed around. I test all three in the test suite; the side-channel tester can only expect Argon2i to pass; and, following the spec's recommendation, I'll be using Argon2id for the actual key file encryption.
-
Simon Tatham authored
I have no plans to use this directly, but it's a component of Argon2, which I'm about to add in the next commit.
-
Simon Tatham authored
'bool old_fmt' in ppk_load_s has now given way to a numeric version field, which will allow it to be set to 3 in future, instead of just 1 or 2. The ad-hoc integer variable 'cipher' is replaced with a pointer to a small struct that mentions individual details like key lengths, to aid parametrisation. The old ssh2_ppk_derivekey is now a larger function that derives all three of the key components used in the private-blob protection: not just the cipher key, but the cipher IV and the MAC key as well. The main part of it is a switch on the file-format version, which currently has only one case (PPK v1 and v2 don't differ in the key derivation), but gives me a handy place to drop in a new case in a future commit, changing the derivation of all those things. All the key material is stored end-to-end in a single strbuf, with ptrlens pointing into it. That makes it easy to free all in one go later.
-
Simon Tatham authored
No functional change: currently, the IV passed in is always zero (except in the test suite). But this prepares to change that in a future revision of the key file format.
-
Simon Tatham authored
-
Simon Tatham authored
I'm about to add a function of particularly large arity.
-
Simon Tatham authored
There's no need to have one bunch of free operations before returning success and another version before returning error. Easier to just set up the state in the former case so that we can fall through to the latter.
-
Simon Tatham authored
When I transcribed the code into this document, I misread 'put_data' as 'put_string' in several places, and documented SSH-style string length headers that do not actually exist in the format.
-
- Feb 16, 2021
-
-
Jacob Nevins authored
-
- Feb 15, 2021
-
-
Simon Tatham authored
This one is triggered by the following sequence: - fill up the terminal window with text ('ls -l /dev' or similar) - Win+Right then Win+Up to snap to the top right quadrant - interactively drag away from the top right quadrant with the title bar, which returns the window to its pre-snap size. After the snap, the window border will have been recomputed to take account of the window size not being an integer number of character cells. So it needs recomputing back again the next time the window size changes to something that _is_ an integer number - which happens (or rather, we process it in a deferred manner) at the EXITSIZEMOVE. So that's where we need to recompute the border (again).
-
Simon Tatham authored
Somebody on comp.security.ssh asked about it recently, and I decided that storing it in a comment in the key file was not really good enough. Also, that comment was incomplete (it listed the private key formats for RSA and DSA but not any of the newer ECC key types, simple as their private-key formats may be).
-
- Feb 13, 2021
-
-
Simon Tatham authored
How on earth did that get there?!
-
Simon Tatham authored
I just re-checked the official list page and found that VS2019 has grown another five minor versions since commit 0a4e068a.
-
- Feb 12, 2021
-
-
Simon Tatham authored
Each of these #defines represents a block of 256 code values that are used, internally to the terminal code, to indicate that a character is in one of the currently selected single-byte character sets. One effect of this is that reconfiguring the character set in mid-session causes all the text already on screen to be redrawn. Unfortunately, those 512 code points were allocated at 0xF000-0xF1FF, which is inside the Unicode private-use area. So if a font uses that area to define actually useful glyphs, then those glyphs won't be displayed correctly by PuTTY; instead, outputting 0xF000+'A' (for example) will display as 'A'. A user recently reported this problem with the 'Hack' font from https://github.com/ryanoasis/nerd-fonts . RDB's comment next to the #defines suggested that this was done on purpose for consistency with Linux (though it's not clear what part of Linux; perhaps the virtual console driver used to work this way?). But now it's getting in the way of actually useful Unicode characters, that consistency doesn't seem like the most important thing. (Also, it just seems wrong to me that you even _can_ cause PuTTY's terminal emulator to use these special internal character representations by sending legal UTF-8.) So I've moved this block of 512 characters to 0xDC00, which is in the Unicode surrogate space, and hence can't be stored in the terminal by sending UTF-8 at all (since our UTF-8 decoder rejects that range, as per spec). That's where we were already keeping other magic blocks like CSET_LINEDRW and CSET_SCOACS, and there's still room for two more. The net effect should be that in Windows PuTTY, U+F000 to U+F1FF are now displayed as whatever your font wants to show.
-