From 8c4ce6d8c62a8301932d3eb0ae00f02280a68207 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 11 May 2015 15:23:48 +0100 Subject: [PATCH] Const-correctness in key-loading functions. The passphrase parameter should be a const char *. --- ssh.h | 5 +++-- sshpubk.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ssh.h b/ssh.h index 83cceb17..256478cb 100644 --- a/ssh.h +++ b/ssh.h @@ -643,7 +643,7 @@ const char *dh_validate_f(void *handle, Bignum f); Bignum dh_find_K(void *, Bignum f); int loadrsakey(const Filename *filename, struct RSAKey *key, - char *passphrase, const char **errorstr); + const char *passphrase, const char **errorstr); int rsakey_encrypted(const Filename *filename, char **comment); int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen, char **commentptr, const char **errorstr); @@ -661,7 +661,8 @@ extern struct ssh2_userkey ssh2_wrong_passphrase; int ssh2_userkey_encrypted(const Filename *filename, char **comment); struct ssh2_userkey *ssh2_load_userkey(const Filename *filename, - char *passphrase, const char **errorstr); + const char *passphrase, + const char **errorstr); unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm, int *pub_blob_len, char **commentptr, const char **errorstr); diff --git a/sshpubk.c b/sshpubk.c index 6aba82fc..90318b72 100644 --- a/sshpubk.c +++ b/sshpubk.c @@ -22,7 +22,7 @@ (x)=='/' ? 63 : 0 ) static int loadrsakey_main(FILE * fp, struct RSAKey *key, int pub_only, - char **commentptr, char *passphrase, + char **commentptr, const char *passphrase, const char **error) { unsigned char buf[16384]; @@ -155,8 +155,8 @@ static int loadrsakey_main(FILE * fp, struct RSAKey *key, int pub_only, return ret; } -int loadrsakey(const Filename *filename, struct RSAKey *key, char *passphrase, - const char **errorstr) +int loadrsakey(const Filename *filename, struct RSAKey *key, + const char *passphrase, const char **errorstr) { FILE *fp; char buf[64]; @@ -581,7 +581,8 @@ const struct ssh_signkey *find_pubkey_alg(const char *name) } struct ssh2_userkey *ssh2_load_userkey(const Filename *filename, - char *passphrase, const char **errorstr) + const char *passphrase, + const char **errorstr) { FILE *fp; char header[40], *b, *encryption, *comment, *mac;