1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Rename all public/private key load/save functions.

Now they have names that are more consistent (no more userkey_this but
that_userkey); a bit shorter; and, most importantly, all the current
functions end in _f to indicate that they deal with keys stored in
disk files. I'm about to add a second set of entry points that deal
with keys via the more general BinarySource / BinarySink interface,
which will sit alongside these with a different suffix.
This commit is contained in:
Simon Tatham
2020-01-05 10:28:45 +00:00
parent 8a87f4509c
commit e5fbed7632
9 changed files with 78 additions and 87 deletions

View File

@ -150,8 +150,8 @@ static int rsa_ssh1_load_main(FILE * fp, RSAKey *key, bool pub_only,
return ret;
}
int rsa_ssh1_loadkey(const Filename *filename, RSAKey *key,
const char *passphrase, const char **errorstr)
int rsa1_load_f(const Filename *filename, RSAKey *key,
const char *passphrase, const char **errorstr)
{
FILE *fp;
char buf[64];
@ -194,7 +194,7 @@ int rsa_ssh1_loadkey(const Filename *filename, RSAKey *key,
* See whether an RSA key is encrypted. Return its comment field as
* well.
*/
bool rsa_ssh1_encrypted(const Filename *filename, char **comment)
bool rsa1_encrypted_f(const Filename *filename, char **comment)
{
FILE *fp;
char buf[64];
@ -222,8 +222,8 @@ bool rsa_ssh1_encrypted(const Filename *filename, char **comment)
* Read the public part of an SSH-1 RSA key from a file (public or
* private), and generate its public blob in exponent-first order.
*/
int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
char **commentptr, const char **errorstr)
int rsa1_loadpub_f(const Filename *filename, BinarySink *bs,
char **commentptr, const char **errorstr)
{
FILE *fp;
char buf[64];
@ -319,8 +319,7 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
/*
* Save an RSA key file. Return true on success.
*/
bool rsa_ssh1_savekey(const Filename *filename, RSAKey *key,
char *passphrase)
bool rsa1_save_f(const Filename *filename, RSAKey *key, char *passphrase)
{
strbuf *buf = strbuf_new_nm();
int estart;
@ -606,8 +605,8 @@ static int userkey_parse_line_counter(const char *text)
return -1;
}
ssh2_userkey *ssh2_load_userkey(
const Filename *filename, const char *passphrase, const char **errorstr)
ssh2_userkey *ppk_load_f(const Filename *filename, const char *passphrase,
const char **errorstr)
{
FILE *fp;
char header[40], *b, *encryption, *comment, *mac;
@ -1056,9 +1055,8 @@ bool openssh_loadpub(FILE *fp, char **algorithm,
return false;
}
bool ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
BinarySink *bs,
char **commentptr, const char **errorstr)
bool ppk_loadpub_f(const Filename *filename, char **algorithm, BinarySink *bs,
char **commentptr, const char **errorstr)
{
FILE *fp;
char header[40], *b;
@ -1159,7 +1157,7 @@ bool ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
return false;
}
bool ssh2_userkey_encrypted(const Filename *filename, char **commentptr)
bool ppk_encrypted_f(const Filename *filename, char **commentptr)
{
FILE *fp;
char header[40], *b, *comment;
@ -1247,8 +1245,7 @@ void base64_encode(FILE *fp, const unsigned char *data, int datalen, int cpl)
fputc('\n', fp);
}
bool ssh2_save_userkey(
const Filename *filename, ssh2_userkey *key, char *passphrase)
bool ppk_save_f(const Filename *filename, ssh2_userkey *key, char *passphrase)
{
FILE *fp;
strbuf *pub_blob, *priv_blob;