simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sun Apr 24 08:38:37 BST 2022
TL;DR:
de47ec2f cryptsuite.py: shorter idiom for base64 decoding.
e7d51505 Utility function strbuf_dup.
a5c0205b Utility functions to get the algorithm from a public key.
ffa25be1 Fix error messages in ppk_loadpub_s.
6143a50e windows/storage.c: factor out low-level Registry access.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2022-04-24 08:38:37
commit de47ec2f5f7444f0aae1bfe8badc17785e1bf2f4
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=de47ec2f5f7444f0aae1bfe8badc17785e1bf2f4;hp=52f296b7e21176cd12ec5e7848b0983bf6bac0f7
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Apr 19 10:07:11 2022 +0100
cryptsuite.py: shorter idiom for base64 decoding.
These days, the base64 module has 'b64decode', which can tolerate a
str or a bytes as input. Switched to using that, and also, imported it
under a nice short name 'b64'.
In the process, removed the obsolete equivocation between
base64.decodebytes and base64.decodestring. That was there to cope
with Python 2 - but the assert statement right next to it has been
enforcing P3 since commit 2ec2b796ed24cb5 two years ago!
test/cryptsuite.py | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
commit e7d51505c7b10640ccaf724da4266afe8a079c38
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e7d51505c7b10640ccaf724da4266afe8a079c38;hp=de47ec2f5f7444f0aae1bfe8badc17785e1bf2f4
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Apr 19 10:53:44 2022 +0100
Utility function strbuf_dup.
If you already have a string (of potentially-binary data) in the form
of a ptrlen reference to somewhere else, and you want to keep a copy
somewhere, it's useful to copy it into a strbuf. But it takes a couple
of lines of faff to do that, and it's nicer to wrap that up into a
tiny helper function.
This commit adds that helper function strbuf_dup, and its non-movable
sibling strbuf_dup_nm for secret data. Also, gone through the existing
code and found a bunch of cases where this makes things less verbose.
misc.h | 4 ++++
pageant.c | 20 ++++++--------------
ssh/login1.c | 3 +--
ssh/userauth2-client.c | 6 ++----
sshpubk.c | 3 +--
test/testcrypt.c | 36 ++++++++++++------------------------
utils/strbuf.c | 14 ++++++++++++++
7 files changed, 40 insertions(+), 46 deletions(-)
commit a5c0205b8715e99097fae3b4f754af1d8102e953
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a5c0205b8715e99097fae3b4f754af1d8102e953;hp=e7d51505c7b10640ccaf724da4266afe8a079c38
Author: Simon Tatham <anakin at pobox.com>
Date: Thu Apr 21 11:00:16 2022 +0100
Utility functions to get the algorithm from a public key.
Every time I've had to do this before, I've always done the three-line
dance of initialising a BinarySource and calling get_string on it.
It's long past time I wrapped that up into a convenient subroutine.
cmdgen.c | 5 ++---
ssh.h | 3 +++
ssh/userauth2-client.c | 6 ++----
sshpubk.c | 12 ++++++++++++
windows/pageant.c | 6 ++----
5 files changed, 21 insertions(+), 11 deletions(-)
commit ffa25be185be5f27e8cebc3b7a5902a760671af6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=ffa25be185be5f27e8cebc3b7a5902a760671af6;hp=a5c0205b8715e99097fae3b4f754af1d8102e953
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Apr 20 07:45:17 2022 +0100
Fix error messages in ppk_loadpub_s.
The function will accept a public key file or a PPK, but if it fails
to parse as any of those, the error message says "not a PuTTY SSH-2
private key", which is particularly incongruous in situations where
you're specifically _not_ after the private half of the key.
Now says "not a public key or a PuTTY SSH-2 private key".
sshpubk.c | 4 ++--
test/cryptsuite.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
commit 6143a50ed228fdf5a72c2970629b4ff643d001fc
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6143a50ed228fdf5a72c2970629b4ff643d001fc;hp=ffa25be185be5f27e8cebc3b7a5902a760671af6
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Apr 22 10:01:01 2022 +0100
windows/storage.c: factor out low-level Registry access.
All the fiddly business where you have to check that a thing exists,
make sure of its type, find its size, allocate some memory, and then
read it again properly (or, alternatively, loop round dealing with
ERROR_MORE_DATA) just doesn't belong at every call site. It's crying
out to be moved out into some separate utility functions that present
a more ergonomic API, so that the code that decides _which_ Registry
entries to read and what to do with them can concentrate on that.
So I've written a fresh set of registry API wrappers in windows/utils,
and simplified windows/storage.c as a result. The jump-list handling
code in particular is almost legible now!
windows/CMakeLists.txt | 2 +-
windows/help.c | 2 +-
windows/platform.h | 15 +-
windows/storage.c | 386 +++++++++++-------------------------
windows/utils/registry.c | 184 +++++++++++++++++
windows/utils/registry_get_string.c | 43 ----
6 files changed, 315 insertions(+), 317 deletions(-)
More information about the tartarus-commits
mailing list