aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorViktor Dukhovni <openssl-users@dukhovni.org>2016-01-04 23:00:33 -0500
committerViktor Dukhovni <openssl-users@dukhovni.org>2016-01-07 20:53:18 -0500
commit98186eb4e4aef6262ed6b0f499348defa2c26893 (patch)
tree38ddc0aea1be4b31a4a48d74dc307ad30288af47 /include
parentcddd424a5bda94e238e4ff06c0efc80cff3b07d1 (diff)
downloadopenssl-98186eb4e4aef6262ed6b0f499348defa2c26893.tar.gz
Backwards-compatibility subject to OPENSSL_API_COMPAT
Provide backwards-compatiblity for functions, macros and include files if OPENSSL_API_COMPAT is either not defined or defined less than the version number of the release in which the feature was deprecated. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/asn1.h3
-rw-r--r--include/openssl/bn.h43
-rw-r--r--include/openssl/crypto.h26
-rw-r--r--include/openssl/dh.h9
-rw-r--r--include/openssl/dsa.h9
-rw-r--r--include/openssl/ec.h2
-rw-r--r--include/openssl/engine.h2
-rw-r--r--include/openssl/err.h6
-rw-r--r--include/openssl/hmac.h8
-rw-r--r--include/openssl/rand.h4
-rw-r--r--include/openssl/rsa.h13
-rw-r--r--include/openssl/ssl.h3
-rw-r--r--include/openssl/store.h2
-rw-r--r--include/openssl/ui.h3
-rw-r--r--include/openssl/x509.h3
15 files changed, 68 insertions, 68 deletions
diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h
index e80b376e01..627f725ac0 100644
--- a/include/openssl/asn1.h
+++ b/include/openssl/asn1.h
@@ -61,6 +61,7 @@
# include <time.h>
# include <openssl/e_os2.h>
+# include <openssl/opensslconf.h>
# include <openssl/bio.h>
# include <openssl/stack.h>
# include <openssl/safestack.h>
@@ -68,7 +69,7 @@
# include <openssl/symhacks.h>
# include <openssl/ossl_typ.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# endif
diff --git a/include/openssl/bn.h b/include/openssl/bn.h
index b052c41991..84111b507f 100644
--- a/include/openssl/bn.h
+++ b/include/openssl/bn.h
@@ -129,6 +129,7 @@
# ifndef OPENSSL_NO_STDIO
# include <stdio.h> /* FILE */
# endif
+# include <openssl/opensslconf.h>
# include <openssl/ossl_typ.h>
# include <openssl/crypto.h>
@@ -270,14 +271,10 @@ extern "C" {
# define BN_FLG_CONSTTIME 0x04
# define BN_FLG_SECURE 0x08
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x00908000L
/* deprecated name for the flag */
# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
-# endif
-
-# ifdef OPENSSL_USE_DEPRECATED
-# define BN_FLG_FREE 0x8000
- /* used for debuging */
+# define BN_FLG_FREE 0x8000 /* used for debuging */
# endif
void BN_set_flags(BIGNUM *b, int n);
@@ -343,7 +340,7 @@ int BN_is_odd(const BIGNUM *a);
void BN_zero_ex(BIGNUM *a);
-# ifndef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT >= 0x00908000L
# define BN_zero(a) BN_zero_ex(a)
# else
# define BN_zero(a) (BN_set_word((a),0))
@@ -475,23 +472,21 @@ BIGNUM *BN_mod_sqrt(BIGNUM *ret,
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
/* Deprecated versions */
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
+DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
const BIGNUM *add,
const BIGNUM *rem,
void (*callback) (int, int,
void *),
- void *cb_arg));
-DECLARE_DEPRECATED(int
+ void *cb_arg))
+DEPRECATEDIN_0_9_8(int
BN_is_prime(const BIGNUM *p, int nchecks,
void (*callback) (int, int, void *),
- BN_CTX *ctx, void *cb_arg));
-DECLARE_DEPRECATED(int
+ BN_CTX *ctx, void *cb_arg))
+DEPRECATEDIN_0_9_8(int
BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
void (*callback) (int, int, void *),
BN_CTX *ctx, void *cb_arg,
- int do_trial_division));
-# endif /* defined(OPENSSL_USE_DEPRECATED) */
+ int do_trial_division))
/* Newer versions */
int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
@@ -535,12 +530,10 @@ int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
BN_CTX *);
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(unsigned long
- BN_BLINDING_get_thread_id(const BN_BLINDING *));
-DECLARE_DEPRECATED(void
- BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long));
-# endif
+DEPRECATEDIN_1_0_0(unsigned long
+ BN_BLINDING_get_thread_id(const BN_BLINDING *))
+DEPRECATEDIN_1_0_0(void
+ BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long))
CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
@@ -554,11 +547,9 @@ BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
BN_MONT_CTX *m_ctx),
BN_MONT_CTX *m_ctx);
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(void BN_set_params(int mul, int high, int low, int mont));
-DECLARE_DEPRECATED(int BN_get_params(int which)); /* 0, mul, 1 high, 2 low, 3
- * mont */
-# endif
+DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont))
+DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3
+ * mont */
BN_RECP_CTX *BN_RECP_CTX_new(void);
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index cf98b2cf24..a85b021253 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -130,6 +130,7 @@
# include <openssl/safestack.h>
# include <openssl/opensslv.h>
# include <openssl/ossl_typ.h>
+# include <openssl/opensslconf.h>
# ifdef CHARSET_EBCDIC
# include <openssl/ebcdic.h>
@@ -141,10 +142,25 @@
*/
# include <openssl/symhacks.h>
+# if OPENSSL_API_COMPAT < 0x10100000L
+# include <openssl/opensslv.h>
+# endif
+
#ifdef __cplusplus
extern "C" {
#endif
+# if OPENSSL_API_COMPAT < 0x10100000L
+# define SSLeay OpenSSL_version_num
+# define SSLeay_version OpenSSL_version
+# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
+# define SSLEAY_VERSION OPENSSL_VERSION
+# define SSLEAY_CFLAGS OPENSSL_CFLAGS
+# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
+# define SSLEAY_PLATFORM OPENSSL_PLATFORM
+# define SSLEAY_DIR OPENSSL_DIR
+# endif /* OPENSSL_API_COMPAT */
+
/*
* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
* names in cryptlib.c
@@ -414,15 +430,15 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(void CRYPTO_set_id_callback(unsigned long (*func) (void)));
+DEPRECATEDIN_1_0_0(void CRYPTO_set_id_callback(unsigned long (*func) (void)))
/*
- * mkdef.pl cannot handle this next one so not inside DECLARE_DEPRECATED,
- * but still inside OPENSSL_USE_DEPRECATED
+ * mkdef.pl cannot handle this next one so not inside DEPRECATEDIN_1_0_0,
+ * but still conditional on a lower or unknown source API version.
*/
+# if OPENSSL_API_COMPAT < 0x10000000L
unsigned long (*CRYPTO_get_id_callback(void)) (void);
-DECLARE_DEPRECATED(unsigned long CRYPTO_thread_id(void));
# endif
+DEPRECATEDIN_1_0_0(unsigned long CRYPTO_thread_id(void))
const char *CRYPTO_get_lock_name(int type);
int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
diff --git a/include/openssl/dh.h b/include/openssl/dh.h
index 816b1eb218..b1192a387f 100644
--- a/include/openssl/dh.h
+++ b/include/openssl/dh.h
@@ -60,6 +60,7 @@
# define HEADER_DH_H
# include <openssl/e_os2.h>
+# include <openssl/opensslconf.h>
# ifdef OPENSSL_NO_DH
# error DH is disabled.
@@ -67,7 +68,7 @@
# include <openssl/bio.h>
# include <openssl/ossl_typ.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# endif
@@ -209,12 +210,10 @@ int DH_set_ex_data(DH *d, int idx, void *arg);
void *DH_get_ex_data(DH *d, int idx);
/* Deprecated version */
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(DH *DH_generate_parameters(int prime_len, int generator,
+DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator,
void (*callback) (int, int,
void *),
- void *cb_arg));
-# endif /* defined(OPENSSL_USE_DEPRECATED) */
+ void *cb_arg))
/* New version */
int DH_generate_parameters_ex(DH *dh, int prime_len, int generator,
diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h
index 824faae099..14b06ecff6 100644
--- a/include/openssl/dsa.h
+++ b/include/openssl/dsa.h
@@ -73,8 +73,9 @@
# include <openssl/bio.h>
# include <openssl/crypto.h>
# include <openssl/ossl_typ.h>
+# include <openssl/opensslconf.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# ifndef OPENSSL_NO_DH
# include <openssl/dh.h>
@@ -222,16 +223,14 @@ DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
/* Deprecated version */
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(DSA *DSA_generate_parameters(int bits,
+DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits,
unsigned char *seed,
int seed_len,
int *counter_ret,
unsigned long *h_ret, void
(*callback) (int, int,
void *),
- void *cb_arg));
-# endif /* defined(OPENSSL_USE_DEPRECATED) */
+ void *cb_arg))
/* New version */
int DSA_generate_parameters_ex(DSA *dsa, int bits,
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index 1dc2db18cc..3926907401 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -85,7 +85,7 @@
# include <openssl/asn1.h>
# include <openssl/symhacks.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# endif
diff --git a/include/openssl/engine.h b/include/openssl/engine.h
index 34d7fed52e..300ff26b08 100644
--- a/include/openssl/engine.h
+++ b/include/openssl/engine.h
@@ -71,7 +71,7 @@
# error ENGINE is disabled.
# endif
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
diff --git a/include/openssl/err.h b/include/openssl/err.h
index 79bf6a3214..e05552b182 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -351,10 +351,8 @@ void ERR_load_crypto_strings(void);
void ERR_free_strings(void);
void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(void ERR_remove_state(unsigned long pid)); /* if zero we
- * look it up */
-# endif
+DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) /* if zero we
+ * look it up */
ERR_STATE *ERR_get_state(void);
LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
diff --git a/include/openssl/hmac.h b/include/openssl/hmac.h
index 071e8b49dc..f9a67b5386 100644
--- a/include/openssl/hmac.h
+++ b/include/openssl/hmac.h
@@ -73,13 +73,9 @@ HMAC_CTX *HMAC_CTX_new(void);
int HMAC_CTX_reset(HMAC_CTX *ctx);
void HMAC_CTX_free(HMAC_CTX *ctx);
-#ifdef OPENSSL_USE_DEPRECATED
+DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
+ const EVP_MD *md))
-/* deprecated */
-DECLARE_DEPRECATED(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
- const EVP_MD *md));
-
-#endif
/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl);
/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
diff --git a/include/openssl/rand.h b/include/openssl/rand.h
index fb5dda1e83..13e3e04f98 100644
--- a/include/openssl/rand.h
+++ b/include/openssl/rand.h
@@ -95,9 +95,7 @@ int RAND_set_rand_engine(ENGINE *engine);
RAND_METHOD *RAND_OpenSSL(void);
void RAND_cleanup(void);
int RAND_bytes(unsigned char *buf, int num);
-#ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(int RAND_pseudo_bytes(unsigned char *buf, int num));
-#endif
+DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
void RAND_seed(const void *buf, int num);
#if defined(__ANDROID__) && defined(__NDK_FPABI__)
__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */
diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h
index d47eeb179a..28c851abb5 100644
--- a/include/openssl/rsa.h
+++ b/include/openssl/rsa.h
@@ -59,12 +59,13 @@
#ifndef HEADER_RSA_H
# define HEADER_RSA_H
+# include <openssl/opensslconf.h>
# include <openssl/asn1.h>
# include <openssl/bio.h>
# include <openssl/crypto.h>
# include <openssl/ossl_typ.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# endif
@@ -212,7 +213,7 @@ struct rsa_st {
* private key operations.
*/
# define RSA_FLAG_NO_CONSTTIME 0x0100
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x00908000L
/* deprecated name for the flag*/
/*
* new with 0.9.7h; the built-in RSA
@@ -316,11 +317,9 @@ int RSA_size(const RSA *rsa);
int RSA_security_bits(const RSA *rsa);
/* Deprecated version */
-# ifdef OPENSSL_USE_DEPRECATED
-DECLARE_DEPRECATED(RSA *RSA_generate_key(int bits, unsigned long e, void
- (*callback) (int, int, void *),
- void *cb_arg));
-# endif /* defined(OPENSSL_USE_DEPRECATED) */
+DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
+ (*callback) (int, int, void *),
+ void *cb_arg))
/* New version */
int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index ee1835a91b..39cb2e7edb 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -144,10 +144,11 @@
# define HEADER_SSL_H
# include <openssl/e_os2.h>
+# include <openssl/opensslconf.h>
# include <openssl/comp.h>
# include <openssl/bio.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/x509.h>
# include <openssl/crypto.h>
# include <openssl/lhash.h>
diff --git a/include/openssl/store.h b/include/openssl/store.h
index cc4683e369..38a2d4b58a 100644
--- a/include/openssl/store.h
+++ b/include/openssl/store.h
@@ -67,7 +67,7 @@
# endif
# include <openssl/ossl_typ.h>
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/evp.h>
# include <openssl/bn.h>
# include <openssl/x509.h>
diff --git a/include/openssl/ui.h b/include/openssl/ui.h
index 3b4b372d74..93a93a7baa 100644
--- a/include/openssl/ui.h
+++ b/include/openssl/ui.h
@@ -60,11 +60,12 @@
#ifndef HEADER_UI_H
# define HEADER_UI_H
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/crypto.h>
# endif
# include <openssl/safestack.h>
# include <openssl/ossl_typ.h>
+# include <openssl/opensslconf.h>
#ifdef __cplusplus
extern "C" {
diff --git a/include/openssl/x509.h b/include/openssl/x509.h
index 0f66329544..50a5edd27e 100644
--- a/include/openssl/x509.h
+++ b/include/openssl/x509.h
@@ -65,6 +65,7 @@
# define HEADER_X509_H
# include <openssl/e_os2.h>
+# include <openssl/opensslconf.h>
# include <openssl/symhacks.h>
# include <openssl/buffer.h>
# include <openssl/evp.h>
@@ -77,7 +78,7 @@
# include <openssl/ec.h>
# endif
-# ifdef OPENSSL_USE_DEPRECATED
+# if OPENSSL_API_COMPAT < 0x10100000L
# ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
# endif