mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
Change ssh.h crypto APIs to output to BinarySink.
This affects all the functions that generate public and private key and signature blobs of all kinds, plus ssh_ecdhkex_getpublic. Instead of returning a bare block of memory and taking an extra 'int *length' parameter, all these functions now write to a BinarySink, and it's the caller's job to have prepared an appropriate one where they want the output to go (usually a strbuf). The main value of this change is that those blob-generation functions were chock full of ad-hoc length-counting and data marshalling. You have only to look at rsa2_{public,private}_blob, for example, to see the kind of thing I was keen to get rid of!
This commit is contained in:
@ -1321,13 +1321,13 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||
"PuTTYgen Error", MB_OK | MB_ICONERROR);
|
||||
} else {
|
||||
if (state->ssh2) {
|
||||
int bloblen;
|
||||
unsigned char *blob;
|
||||
blob = state->ssh2key.alg->public_blob
|
||||
(state->ssh2key.data, &bloblen);
|
||||
strbuf *blob = strbuf_new();
|
||||
state->ssh2key.alg->public_blob(
|
||||
state->ssh2key.data, BinarySink_UPCAST(blob));
|
||||
ssh2_write_pubkey(fp, state->ssh2key.comment,
|
||||
blob, bloblen,
|
||||
blob->u, blob->len,
|
||||
SSH_KEYTYPE_SSH2_PUBLIC_RFC4716);
|
||||
strbuf_free(blob);
|
||||
} else {
|
||||
ssh1_write_pubkey(fp, &state->key);
|
||||
}
|
||||
|
Reference in New Issue
Block a user