summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBenjamin Kaduk <bkaduk@akamai.com>2016-02-18 21:24:27 -0600
committerRichard Levitte <levitte@openssl.org>2017-05-08 21:17:28 +0200
commit204afd81b12c71d625e89599c0eef33588afc1f0 (patch)
tree8d53ed9eb9314f7342d12fba9e1647fb78419700 /include
parentd396da33130aba2e77478d00fd369eb8d34bd8bf (diff)
downloadopenssl-new-204afd81b12c71d625e89599c0eef33588afc1f0.tar.gz
Add PEM_read_bio_ex
The extended function includes a 'flags' argument to allow callers to specify different requested behaviors. In particular, callers can request that temporary storage buffers are allocated from the secure heap, which could be relevant when loading private key material. Refactor PEM_read_bio to use BIO_mems instead of BUFs directly, use some helper routines to reduce the overall function length, and make some of the checks more reasonable. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1700)
Diffstat (limited to 'include')
-rw-r--r--include/openssl/pem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/openssl/pem.h b/include/openssl/pem.h
index 431ee3e5ab..d6f76ebe73 100644
--- a/include/openssl/pem.h
+++ b/include/openssl/pem.h
@@ -236,6 +236,11 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len,
int PEM_read_bio(BIO *bp, char **name, char **header,
unsigned char **data, long *len);
+# define PEM_FLAG_SECURE 0x1
+# define PEM_FLAG_EAY_COMPATIBLE 0x2
+# define PEM_FLAG_ONLY_B64 0x4
+int PEM_read_bio_ex(BIO *bp, char **name, char **header,
+ unsigned char **data, long *len, unsigned int flags);
int PEM_write_bio(BIO *bp, const char *name, const char *hdr,
const unsigned char *data, long len);
int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,
@@ -388,6 +393,8 @@ int ERR_load_PEM_strings(void);
# define PEM_F_DO_PK8PKEY_FP 125
# define PEM_F_DO_PVK_BODY 135
# define PEM_F_DO_PVK_HEADER 136
+# define PEM_F_GET_HEADER_AND_DATA 143
+# define PEM_F_GET_NAME 144
# define PEM_F_I2B_PVK 137
# define PEM_F_I2B_PVK_BIO 138
# define PEM_F_LOAD_IV 101
@@ -401,6 +408,7 @@ int ERR_load_PEM_strings(void);
# define PEM_F_PEM_READ 108
# define PEM_F_PEM_READ_BIO 109
# define PEM_F_PEM_READ_BIO_DHPARAMS 141
+# define PEM_F_PEM_READ_BIO_EX 145
# define PEM_F_PEM_READ_BIO_PARAMETERS 140
# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123
# define PEM_F_PEM_READ_DHPARAMS 142