diff options
author | Richard Levitte <levitte@openssl.org> | 2019-11-15 08:54:17 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-11-18 02:34:12 +0100 |
commit | de0799b0fc845869d775520382b4e7f9995732e5 (patch) | |
tree | fbe29de0651a1a2399089f25ed9b1266f7b56bd6 /crypto/pem/pem_pkey.c | |
parent | 97a986f78289fef71bf8778dc4763458e983750c (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/pem_pkey.c')
-rw-r--r-- | crypto/pem/pem_pkey.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c index a4c60a354d..6f89759f1e 100644 --- a/crypto/pem/pem_pkey.c +++ b/crypto/pem/pem_pkey.c @@ -64,19 +64,20 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, return ret; } -int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, +int PEM_write_bio_PrivateKey(BIO *bp, const EVP_PKEY *x, + const EVP_CIPHER *enc, + const unsigned char *kstr, int klen, pem_password_cb *cb, void *u) { if (x->ameth == NULL || x->ameth->priv_encode != NULL) return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, - (char *)kstr, klen, cb, u); + (const char *)kstr, klen, cb, u); return PEM_write_bio_PrivateKey_traditional(bp, x, enc, kstr, klen, cb, u); } -int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, +int PEM_write_bio_PrivateKey_traditional(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, + const unsigned char *kstr, int klen, pem_password_cb *cb, void *u) { char pem_str[80]; @@ -111,7 +112,7 @@ EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x) return ret; } -int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) +int PEM_write_bio_Parameters(BIO *bp, const EVP_PKEY *x) { char pem_str[80]; if (!x->ameth || !x->ameth->param_encode) @@ -139,8 +140,8 @@ EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, return ret; } -int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, +int PEM_write_PrivateKey(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc, + const unsigned char *kstr, int klen, pem_password_cb *cb, void *u) { BIO *b; |