1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Const-correctness in the base64 functions.

This commit is contained in:
Simon Tatham 2015-05-12 14:00:04 +01:00
parent 4d88fe3dde
commit f274b56a57
4 changed files with 9 additions and 8 deletions

4
misc.c
View File

@ -495,7 +495,7 @@ char *chomp(char *str)
* Core base64 encoding and decoding routines.
*/
void base64_encode_atom(unsigned char *data, int n, char *out)
void base64_encode_atom(const unsigned char *data, int n, char *out)
{
static const char base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@ -519,7 +519,7 @@ void base64_encode_atom(unsigned char *data, int n, char *out)
out[3] = '=';
}
int base64_decode_atom(char *atom, unsigned char *out)
int base64_decode_atom(const char *atom, unsigned char *out)
{
int vals[4];
int i, v, len;

4
misc.h
View File

@ -44,8 +44,8 @@ int toint(unsigned);
char *fgetline(FILE *fp);
char *chomp(char *str);
void base64_encode_atom(unsigned char *data, int n, char *out);
int base64_decode_atom(char *atom, unsigned char *out);
void base64_encode_atom(const unsigned char *data, int n, char *out);
int base64_decode_atom(const char *atom, unsigned char *out);
struct bufchain_granule;
typedef struct bufchain_tag {

7
ssh.h
View File

@ -651,10 +651,11 @@ int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
extern int base64_decode_atom(char *atom, unsigned char *out);
extern int base64_decode_atom(const char *atom, unsigned char *out);
extern int base64_lines(int datalen);
extern void base64_encode_atom(unsigned char *data, int n, char *out);
extern void base64_encode(FILE *fp, unsigned char *data, int datalen, int cpl);
extern void base64_encode_atom(const unsigned char *data, int n, char *out);
extern void base64_encode(FILE *fp, const unsigned char *data, int datalen,
int cpl);
/* ssh2_load_userkey can return this as an error */
extern struct ssh2_userkey ssh2_wrong_passphrase;

View File

@ -1276,7 +1276,7 @@ int base64_lines(int datalen)
return (datalen + 47) / 48;
}
void base64_encode(FILE * fp, unsigned char *data, int datalen, int cpl)
void base64_encode(FILE *fp, const unsigned char *data, int datalen, int cpl)
{
int linelen = 0;
char out[4];