protect the inline functions with the OPENSSL_VERSION_NUMBER

This commit is contained in:
christos 2018-02-05 11:52:32 +00:00
parent 669bbf3051
commit a888e01c4e
7 changed files with 21 additions and 0 deletions

View File

@ -387,6 +387,7 @@ void ERR_load_DH_strings(void);
# define DH_R_PEER_KEY_ERROR 113
# define DH_R_SHARED_INFO_ERROR 114
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline void
DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
{
@ -425,6 +426,7 @@ DH_set_length(DH *dh, long length)
{
dh->length = length;
}
#endif
#ifdef __cplusplus
}

View File

@ -326,6 +326,7 @@ void ERR_load_DSA_strings(void);
# define DSA_R_PARAMETER_ENCODING_ERROR 105
# define DSA_R_Q_NOT_PRIME 113
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline void
DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **r, const BIGNUM **s)
{
@ -400,6 +401,7 @@ static inline int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
return 1;
}
#endif
#ifdef __cplusplus

View File

@ -329,6 +329,8 @@ void ERR_load_ECDSA_strings(void);
# define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
# define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline void
ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **r, const BIGNUM **s)
{
@ -351,6 +353,9 @@ ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
}
return 1;
}
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1533,6 +1533,8 @@ void ERR_load_EVP_strings(void);
# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
# define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
{
EVP_MD_CTX *ctx = malloc(sizeof(*ctx));
@ -1557,6 +1559,8 @@ static inline RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
return pkey->pkey.rsa;
}
#endif
# ifdef __cplusplus
}

View File

@ -102,6 +102,7 @@ int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline HMAC_CTX *HMAC_CTX_new(void)
{
HMAC_CTX *ctx = malloc(sizeof(*ctx));
@ -118,6 +119,7 @@ static inline void HMAC_CTX_free(HMAC_CTX *ctx)
HMAC_CTX_cleanup(ctx);
free(ctx);
}
#endif
#ifdef __cplusplus

View File

@ -30,7 +30,9 @@ extern "C" {
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta)
*/
# ifndef OPENSSL_VERSION_NUMBER
# define OPENSSL_VERSION_NUMBER 0x100020bfL
# endif
# ifdef OPENSSL_FIPS
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k-fips 26 Jan 2017"
# else

View File

@ -660,6 +660,8 @@ void ERR_load_RSA_strings(void);
#include <string.h>
#ifdef OPENSSL_VERSION_NUMBER >= 0x10100000L
static inline RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth)
{
RSA_METHOD *ret = malloc(sizeof(*meth));
@ -832,6 +834,8 @@ static inline void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1,
*iqmp = r->iqmp;
}
#endif
#ifdef __cplusplus
}