summaryrefslogtreecommitdiffstats
path: root/crypto/pem/pvkfmt.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-11-15 08:54:17 +0100
committerRichard Levitte <levitte@openssl.org>2019-11-18 02:34:12 +0100
commitde0799b0fc845869d775520382b4e7f9995732e5 (patch)
treefbe29de0651a1a2399089f25ed9b1266f7b56bd6 /crypto/pem/pvkfmt.c
parent97a986f78289fef71bf8778dc4763458e983750c (diff)
PEM: constify PEM_write_ routines
There's no reason why the object to be written, or the key string given by the caller should be non-const. This makes the IMPLEMENT_PEM_..._const and DECLARE_PEM_..._const macros superfluous, so we keep them around but mark them deprecated. In all places where IMPLEMENT_PEM_..._const and DECLARE_PEM_..._const are used, they are replaced with the corresponding macros without '_const'. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10452)
Diffstat (limited to 'crypto/pem/pvkfmt.c')
-rw-r--r--crypto/pem/pvkfmt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index 6bcde93d6c..95bd4da3f5 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -424,7 +424,7 @@ static int check_bitlen_dsa(DSA *dsa, int ispub, unsigned int *magic);
static void write_rsa(unsigned char **out, RSA *rsa, int ispub);
static void write_dsa(unsigned char **out, DSA *dsa, int ispub);
-static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub)
+static int do_i2b(unsigned char **out, const EVP_PKEY *pk, int ispub)
{
unsigned char *p;
unsigned int bitlen, magic = 0, keyalg;
@@ -473,7 +473,7 @@ static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub)
return outlen;
}
-static int do_i2b_bio(BIO *out, EVP_PKEY *pk, int ispub)
+static int do_i2b_bio(BIO *out, const EVP_PKEY *pk, int ispub)
{
unsigned char *tmp = NULL;
int outlen, wrlen;
@@ -599,12 +599,12 @@ static void write_dsa(unsigned char **out, DSA *dsa, int ispub)
return;
}
-int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk)
+int i2b_PrivateKey_bio(BIO *out, const EVP_PKEY *pk)
{
return do_i2b_bio(out, pk, 0);
}
-int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk)
+int i2b_PublicKey_bio(BIO *out, const EVP_PKEY *pk)
{
return do_i2b_bio(out, pk, 1);
}
@@ -780,7 +780,7 @@ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u)
return ret;
}
-static int i2b_PVK(unsigned char **out, EVP_PKEY *pk, int enclevel,
+static int i2b_PVK(unsigned char **out, const EVP_PKEY *pk, int enclevel,
pem_password_cb *cb, void *u)
{
int outlen = 24, pklen;
@@ -865,7 +865,7 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY *pk, int enclevel,
return -1;
}
-int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
+int i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel,
pem_password_cb *cb, void *u)
{
unsigned char *tmp = NULL;