summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-05-06 03:46:09 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-05-06 21:21:54 +0100
commit049f5bbce3eebdf4ec2030042eb2ae64bb67aedb (patch)
tree9fb0ffa0579bf991f262df1b610fca866a59ef50
parentc95a8b4eb51cec25ddce846dfbd922b016d54d0c (diff)
Constify PKCS12_newpass()
PR#4449 Reviewed-by: Rich Salz <rsalz@openssl.org>
-rw-r--r--crypto/pkcs12/p12_npas.c20
-rw-r--r--doc/crypto/PKCS12_newpass.pod2
-rw-r--r--include/openssl/pkcs12.h2
3 files changed, 13 insertions, 11 deletions
diff --git a/crypto/pkcs12/p12_npas.c b/crypto/pkcs12/p12_npas.c
index 92119f5c66..000d7fb916 100644
--- a/crypto/pkcs12/p12_npas.c
+++ b/crypto/pkcs12/p12_npas.c
@@ -66,17 +66,18 @@
/* PKCS#12 password change routine */
-static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass);
-static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *oldpass,
- char *newpass);
-static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass);
+static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass);
+static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *oldpass,
+ const char *newpass);
+static int newpass_bag(PKCS12_SAFEBAG *bag, const char *oldpass,
+ const char *newpass);
static int alg_get(X509_ALGOR *alg, int *pnid, int *piter, int *psaltlen);
/*
* Change the password on a PKCS#12 structure.
*/
-int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass)
+int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass)
{
/* Check for NULL PKCS12 structure */
@@ -103,7 +104,7 @@ int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass)
/* Parse the outer PKCS#12 structure */
-static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass)
+static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass)
{
STACK_OF(PKCS7) *asafes = NULL, *newsafes = NULL;
STACK_OF(PKCS12_SAFEBAG) *bags = NULL;
@@ -177,8 +178,8 @@ err:
return rv;
}
-static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *oldpass,
- char *newpass)
+static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *oldpass,
+ const char *newpass)
{
int i;
for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) {
@@ -190,7 +191,8 @@ static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *oldpass,
/* Change password of safebag: only needs handle shrouded keybags */
-static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass)
+static int newpass_bag(PKCS12_SAFEBAG *bag, const char *oldpass,
+ const char *newpass)
{
PKCS8_PRIV_KEY_INFO *p8;
X509_SIG *p8new;
diff --git a/doc/crypto/PKCS12_newpass.pod b/doc/crypto/PKCS12_newpass.pod
index 6f01fb346a..4f44c34ede 100644
--- a/doc/crypto/PKCS12_newpass.pod
+++ b/doc/crypto/PKCS12_newpass.pod
@@ -8,7 +8,7 @@ PKCS12_newpass - change the password of a PKCS12 structure
#include <openssl/pkcs12.h>
- int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
+ int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);
=head1 DESCRIPTION
diff --git a/include/openssl/pkcs12.h b/include/openssl/pkcs12.h
index 655655a5af..8589c2bd8a 100644
--- a/include/openssl/pkcs12.h
+++ b/include/openssl/pkcs12.h
@@ -253,7 +253,7 @@ int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
-int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
+int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);
/* BEGIN ERROR CODES */
/*