mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Allow rsakey_pubblob() to return the key comment.
(like r6433 but for SSH-1)
[originally from svn r6434]
[r6433 == 49d2cf19ac
]
This commit is contained in:
parent
49d2cf19ac
commit
c14f259ba2
3
cmdgen.c
3
cmdgen.c
@ -690,7 +690,8 @@ int main(int argc, char **argv)
|
||||
char *blob;
|
||||
int n, l, bloblen;
|
||||
|
||||
ret = rsakey_pubblob(&infilename, &vblob, &bloblen, &error);
|
||||
ret = rsakey_pubblob(&infilename, &vblob, &bloblen, NULL,
|
||||
&error);
|
||||
blob = (char *)vblob;
|
||||
|
||||
n = 4; /* skip modulus bits */
|
||||
|
3
ssh.c
3
ssh.c
@ -3256,7 +3256,8 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
|
||||
/* Load the public half of ssh->cfg.keyfile so we notice if it's in Pageant */
|
||||
if (!filename_is_null(ssh->cfg.keyfile)) {
|
||||
if (!rsakey_pubblob(&ssh->cfg.keyfile,
|
||||
&s->publickey_blob, &s->publickey_bloblen, NULL))
|
||||
&s->publickey_blob, &s->publickey_bloblen,
|
||||
NULL, NULL))
|
||||
s->publickey_blob = NULL;
|
||||
} else
|
||||
s->publickey_blob = NULL;
|
||||
|
2
ssh.h
2
ssh.h
@ -383,7 +383,7 @@ int loadrsakey(const Filename *filename, struct RSAKey *key,
|
||||
char *passphrase, const char **errorstr);
|
||||
int rsakey_encrypted(const Filename *filename, char **comment);
|
||||
int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
|
||||
const char **errorstr);
|
||||
char **commentptr, const char **errorstr);
|
||||
|
||||
int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
|
||||
|
||||
|
@ -225,7 +225,7 @@ int rsakey_encrypted(const Filename *filename, char **comment)
|
||||
* exponent, modulus).
|
||||
*/
|
||||
int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
|
||||
const char **errorstr)
|
||||
char **commentptr, const char **errorstr)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[64];
|
||||
@ -250,7 +250,7 @@ int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
|
||||
*/
|
||||
if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
|
||||
memset(&key, 0, sizeof(key));
|
||||
if (loadrsakey_main(fp, &key, TRUE, NULL, NULL, &error)) {
|
||||
if (loadrsakey_main(fp, &key, TRUE, commentptr, NULL, &error)) {
|
||||
*blob = rsa_public_blob(&key, bloblen);
|
||||
freersakey(&key);
|
||||
ret = 1;
|
||||
|
@ -415,7 +415,7 @@ static void add_keyfile(Filename filename)
|
||||
int i, nkeys, bloblen, keylistlen;
|
||||
|
||||
if (type == SSH_KEYTYPE_SSH1) {
|
||||
if (!rsakey_pubblob(&filename, &blob, &bloblen, &error)) {
|
||||
if (!rsakey_pubblob(&filename, &blob, &bloblen, NULL, &error)) {
|
||||
char *msg = dupprintf("Couldn't load private key (%s)", error);
|
||||
message_box(msg, APPNAME, MB_OK | MB_ICONERROR,
|
||||
HELPCTXID(errors_cantloadkey));
|
||||
|
Loading…
Reference in New Issue
Block a user