mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
Allow import.c to read from a BinarySource.
Like sshpubk.c before it, the loading side of import.c now works by first slurping the whole input file into a LoadedFile structure, and then using the BinarySource system to parse the file contents entirely in memory. The old API is still present and works the same as ever, but now we also provide a secondary API that can import a foreign key file from a BinarySource. This is rather a superficial conversion: I've replaced all calls to fgetline() with a local static function bsgetline() which presents more or less the same interface for a BinarySource: that is, it still returns a dynamically allocated string containing the line of text, so that the followup code could change as little as possible. It would be nice to come back in future and modernise this code to use ptrlens throughout, saving all the unnecessary allocations.
This commit is contained in:
6
ssh.h
6
ssh.h
@ -1265,10 +1265,16 @@ const char *key_type_to_str(int type);
|
||||
bool import_possible(int type);
|
||||
int import_target_type(int type);
|
||||
bool import_encrypted(const Filename *filename, int type, char **comment);
|
||||
bool import_encrypted_s(const Filename *filename, BinarySource *src,
|
||||
int type, char **comment);
|
||||
int import_ssh1(const Filename *filename, int type,
|
||||
RSAKey *key, char *passphrase, const char **errmsg_p);
|
||||
int import_ssh1_s(BinarySource *src, int type,
|
||||
RSAKey *key, char *passphrase, const char **errmsg_p);
|
||||
ssh2_userkey *import_ssh2(const Filename *filename, int type,
|
||||
char *passphrase, const char **errmsg_p);
|
||||
ssh2_userkey *import_ssh2_s(BinarySource *src, int type,
|
||||
char *passphrase, const char **errmsg_p);
|
||||
bool export_ssh1(const Filename *filename, int type,
|
||||
RSAKey *key, char *passphrase);
|
||||
bool export_ssh2(const Filename *filename, int type,
|
||||
|
Reference in New Issue
Block a user