[openssl-dev] [openssl.org #4449] PATCH: fix PKCS12_newpass does not take a cont char[]
noloader@gmail.com via RT
rt at openssl.org
Fri Mar 18 22:42:42 UTC 2016
A call to PKCS12_newpass:
static const char super_secret[] = "password";
status = PKCS12_newpass(p12, super_secret, super_secret);
...
Results in:
test.cc:17:57: error: invalid conversion from ‘const char*’ to
‘char*’ [-fpermissive]
In file included from test.cc:1:0:
./include/openssl/pkcs12.h:256:5: error: initializing argument 2
of ‘int PKCS12_newpass(PKCS12*, char*, char*)’ [-fpermissive]
int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
**********
The following tests OK with Master at b4ae8861214b5d73.
$ git diff > PKCS12_newpass.patch
$ cat PKCS12_newpass.patch
diff --git a/crypto/pkcs12/p12_npas.c b/crypto/pkcs12/p12_npas.c
index e23d035..601c047 100644
--- a/crypto/pkcs12/p12_npas.c
+++ b/crypto/pkcs12/p12_npas.c
@@ -76,7 +76,7 @@ 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 */
diff --git a/include/openssl/pkcs12.h b/include/openssl/pkcs12.h
index 655655a..8589c2b 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 */
/*
--
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4449
Please log in as guest with password guest if prompted
More information about the openssl-dev
mailing list