提交 3ad9c478 编写于 作者: R Richard Levitte

Add PEM declaration macros that take attributes

This makes it possible to easily deprecated selections of PEM
functions.
Reviewed-by: NPaul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13074)
上级 895419b7
......@@ -191,72 +191,110 @@ extern "C" {
/* These are the same except they are for the declarations */
/*
* The mysterious 'extern' that's passed to some macros is innocuous,
* and is there to quiet pre-C99 compilers that may complain about empty
* arguments in macro calls.
*/
# if defined(OPENSSL_NO_STDIO)
# define DECLARE_PEM_read_fp(name, type) /**/
# define DECLARE_PEM_write_fp(name, type) /**/
# define DECLARE_PEM_read_fp_attr(attr, name, type) /**/
# define DECLARE_PEM_write_fp_attr(attr, name, type) /**/
# define DECLARE_PEM_write_fp_attr(attr, name, type) /**/
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_write_fp_const(name, type) /**/
# define DECLARE_PEM_write_fp_const_attr(attr, name, type) /**/
# endif
# define DECLARE_PEM_write_cb_fp(name, type) /**/
# else
# define DECLARE_PEM_write_cb_fp_attr(attr, name, type) /**/
# define DECLARE_PEM_read_fp(name, type) \
type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
# define DECLARE_PEM_write_fp(name, type) \
PEM_write_fnsig(name, type, FILE, write);
# else
# define DECLARE_PEM_read_fp_attr(attr, name, type) \
attr type *PEM_read_##name(FILE *fp, type **x, \
pem_password_cb *cb, void *u);
# define DECLARE_PEM_write_fp_attr(attr, name, type) \
attr PEM_write_fnsig(name, type, FILE, write);
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_write_fp_const(name, type) \
PEM_write_fnsig(name, type, FILE, write);
# define DECLARE_PEM_write_fp_const_attr(attr, name, type) \
attr PEM_write_fnsig(name, type, FILE, write);
# endif
# define DECLARE_PEM_write_cb_fp_attr(attr, name, type) \
attr PEM_write_cb_fnsig(name, type, FILE, write);
# define DECLARE_PEM_write_cb_fp(name, type) \
PEM_write_cb_fnsig(name, type, FILE, write);
# endif
# define DECLARE_PEM_read_fp(name, type) \
DECLARE_PEM_read_fp_attr(extern, name, type)
# define DECLARE_PEM_write_fp(name, type) \
DECLARE_PEM_write_fp_attr(extern, name, type)
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_write_fp_const(name, type) \
DECLARE_PEM_write_fp_const_attr(extern, name, type)
# endif
# define DECLARE_PEM_write_cb_fp(name, type) \
DECLARE_PEM_write_cb_fp_attr(extern, name, type)
# define DECLARE_PEM_read_bio(name, type) \
type *PEM_read_bio_##name(BIO *bp, type **x, \
pem_password_cb *cb, void *u);
# define DECLARE_PEM_read_bio_attr(attr, name, type) \
attr type *PEM_read_bio_##name(BIO *bp, type **x, \
pem_password_cb *cb, void *u);
# define DECLARE_PEM_read_bio(name, type) \
DECLARE_PEM_read_bio_attr(extern, name, type)
# define DECLARE_PEM_write_bio(name, type) \
PEM_write_fnsig(name, type, BIO, write_bio);
# define DECLARE_PEM_write_bio_attr(attr, name, type) \
attr PEM_write_fnsig(name, type, BIO, write_bio);
# define DECLARE_PEM_write_bio(name, type) \
DECLARE_PEM_write_bio_attr(extern, name, type)
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_write_bio_const(name, type) \
PEM_write_fnsig(name, type, BIO, write_bio);
# endif
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_write_bio_const_attr(attr, name, type) \
attr PEM_write_fnsig(name, type, BIO, write_bio);
# define DECLARE_PEM_write_bio_const(name, type) \
DECLARE_PEM_write_bio_const_attr(extern, name, type)
# endif
# define DECLARE_PEM_write_cb_bio(name, type) \
PEM_write_cb_fnsig(name, type, BIO, write_bio);
# define DECLARE_PEM_write_cb_bio_attr(attr, name, type) \
attr PEM_write_cb_fnsig(name, type, BIO, write_bio);
# define DECLARE_PEM_write_cb_bio(name, type) \
DECLARE_PEM_write_cb_bio_attr(extern, name, type)
# define DECLARE_PEM_write_attr(attr, name, type) \
DECLARE_PEM_write_bio_attr(attr, name, type) \
DECLARE_PEM_write_fp_attr(attr, name, type)
# define DECLARE_PEM_write(name, type) \
DECLARE_PEM_write_bio(name, type) \
DECLARE_PEM_write_fp(name, type)
DECLARE_PEM_write_attr(extern, name, type)
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_write_const(name, type) \
DECLARE_PEM_write_bio_const(name, type) \
DECLARE_PEM_write_fp_const(name, type)
# define DECLARE_PEM_write_const_attr(attr, name, type) \
DECLARE_PEM_write_bio_const_attr(attr, name, type) \
DECLARE_PEM_write_fp_const_attr(attr, name, type)
# define DECLARE_PEM_write_const(name, type) \
DECLARE_PEM_write_const_attr(extern, name, type)
# endif
# define DECLARE_PEM_write_cb(name, type) \
DECLARE_PEM_write_cb_bio(name, type) \
DECLARE_PEM_write_cb_fp(name, type)
# define DECLARE_PEM_read(name, type) \
DECLARE_PEM_read_bio(name, type) \
DECLARE_PEM_read_fp(name, type)
# define DECLARE_PEM_write_cb_attr(attr, name, type) \
DECLARE_PEM_write_cb_bio_attr(attr, name, type) \
DECLARE_PEM_write_cb_fp_attr(attr, name, type)
# define DECLARE_PEM_write_cb(name, type) \
DECLARE_PEM_write_cb_attr(extern, name, type)
# define DECLARE_PEM_read_attr(attr, name, type) \
DECLARE_PEM_read_bio_attr(attr, name, type) \
DECLARE_PEM_read_fp_attr(attr, name, type)
# define DECLARE_PEM_read(name, type) \
DECLARE_PEM_read_attr(extern, name, type)
# define DECLARE_PEM_rw_attr(attr, name, type) \
DECLARE_PEM_read_attr(attr, name, type) \
DECLARE_PEM_write_attr(attr, name, type)
# define DECLARE_PEM_rw(name, type) \
DECLARE_PEM_read(name, type) \
DECLARE_PEM_write(name, type)
DECLARE_PEM_rw_attr(extern, name, type)
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define DECLARE_PEM_rw_const_attr(attr, name, type) \
DECLARE_PEM_read_attr(attr, name, type) \
DECLARE_PEM_write_const_attr(attr, name, type)
# define DECLARE_PEM_rw_const(name, type) \
DECLARE_PEM_read(name, type) \
DECLARE_PEM_write_const(name, type)
DECLARE_PEM_rw_const_attr(extern, name, type)
# endif
# define DECLARE_PEM_rw_cb_attr(attr, name, type) \
DECLARE_PEM_read_attr(attr, name, type) \
DECLARE_PEM_write_cb_attr(attr, name, type)
# define DECLARE_PEM_rw_cb(name, type) \
DECLARE_PEM_read(name, type) \
DECLARE_PEM_write_cb(name, type)
DECLARE_PEM_rw_cb_attr(extern, name, type)
int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len,
......
......@@ -525,6 +525,9 @@ EOF
{ regexp => qr/DECLARE_PKCS12_SET_OF<<<\((.*)\)>>>/,
massager => sub { return (); }
},
#####
# PEM stuff
{ regexp => qr/DECLARE_PEM(?|_rw|_rw_cb|_rw_const)<<<\((.*?),.*\)>>>/,
massager => sub { return (<<"EOF");
#ifndef OPENSSL_NO_STDIO
......@@ -536,9 +539,6 @@ int PEM_write_bio_$1(void);
EOF
},
},
#####
# PEM stuff
{ regexp => qr/DECLARE_PEM(?|_write|_write_cb|_write_const)<<<\((.*?),.*\)>>>/,
massager => sub { return (<<"EOF");
#ifndef OPENSSL_NO_STDIO
......@@ -554,6 +554,18 @@ EOF
int PEM_read_$1(void);
#endif
int PEM_read_bio_$1(void);
EOF
},
},
# Universal translator of attributed PEM declarators
{ regexp => qr/
DECLARE_PEM
(_rw|_rw_cb|_rw_const|_write|_write_cb|_write_const|_read|_read_cb)
_attr
<<<\(\s*OSSL_DEPRECATEDIN_(.*?)\s*,(.*?)\)>>>
/x,
massager => sub { return (<<"EOF");
DECLARE_PEM$1($3)
EOF
},
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册