summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-08-30 23:21:03 +1000
committerdaurnimator <quae@daurnimator.com>2017-08-31 01:09:51 +1000
commit761108e2d2662b46b9b5370ace02e7325159f446 (patch)
treeb977e4fddd104698baaad160d436248ab67de651 /src
parent6679ba855465ea1ff751301ecc16fc7fe3f9cbe9 (diff)
downloadluaossl-761108e2d2662b46b9b5370ace02e7325159f446.tar.gz
luaossl-761108e2d2662b46b9b5370ace02e7325159f446.tar.bz2
luaossl-761108e2d2662b46b9b5370ace02e7325159f446.zip
Fix most 'expansion-to-defined' warnings
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 8500815..9561617 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -83,11 +83,16 @@
83#define MSC_2VER(M, m, p) ((((M) + 6) * 10000000) + ((m) * 1000000) + (p)) 83#define MSC_2VER(M, m, p) ((((M) + 6) * 10000000) + ((m) * 1000000) + (p))
84#define MSC_PREREQ(M, m, p) (_MSC_FULL_VER > 0 && _MSC_FULL_VER >= MSC_2VER((M), (m), (p))) 84#define MSC_PREREQ(M, m, p) (_MSC_FULL_VER > 0 && _MSC_FULL_VER >= MSC_2VER((M), (m), (p)))
85 85
86#define OPENSSL_PREREQ(M, m, p) \ 86#ifdef LIBRESSL_VERSION_NUMBER
87 (OPENSSL_VERSION_NUMBER >= (((M) << 28) | ((m) << 20) | ((p) << 12)) && !defined LIBRESSL_VERSION_NUMBER) 87#define OPENSSL_PREREQ(M, m, p) (0)
88
89#define LIBRESSL_PREREQ(M, m, p) \ 88#define LIBRESSL_PREREQ(M, m, p) \
90 (LIBRESSL_VERSION_NUMBER >= (((M) << 28) | ((m) << 20) | ((p) << 12))) 89 (LIBRESSL_VERSION_NUMBER >= (((M) << 28) | ((m) << 20) | ((p) << 12)))
90#else
91#define OPENSSL_PREREQ(M, m, p) \
92 (OPENSSL_VERSION_NUMBER >= (((M) << 28) | ((m) << 20) | ((p) << 12)))
93#define LIBRESSL_PREREQ(M, m, p) (0)
94#endif
95
91 96
92#ifndef __has_builtin 97#ifndef __has_builtin
93#define __has_builtin(x) 0 98#define __has_builtin(x) 0
@@ -146,7 +151,11 @@
146#endif 151#endif
147 152
148#ifndef HAVE_DTLSV1_CLIENT_METHOD 153#ifndef HAVE_DTLSV1_CLIENT_METHOD
149#define HAVE_DTLSV1_CLIENT_METHOD (!defined OPENSSL_NO_DTLS1) 154#ifdef OPENSSL_NO_DTLS1
155#define HAVE_DTLSV1_CLIENT_METHOD (0)
156#else
157#define HAVE_DTLSV1_CLIENT_METHOD (1)
158#endif
150#endif 159#endif
151 160
152#ifndef HAVE_DTLSV1_SERVER_METHOD 161#ifndef HAVE_DTLSV1_SERVER_METHOD
@@ -154,7 +163,11 @@
154#endif 163#endif
155 164
156#ifndef HAVE_DTLS_CLIENT_METHOD 165#ifndef HAVE_DTLS_CLIENT_METHOD
157#define HAVE_DTLS_CLIENT_METHOD (OPENSSL_PREREQ(1,0,2) && !defined OPENSSL_NO_DTLS1) 166#ifdef OPENSSL_NO_DTLS1
167#define HAVE_DTLS_CLIENT_METHOD (0)
168#else
169#define HAVE_DTLS_CLIENT_METHOD OPENSSL_PREREQ(1,0,2)
170#endif
158#endif 171#endif
159 172
160#ifndef HAVE_DTLS_SERVER_METHOD 173#ifndef HAVE_DTLS_SERVER_METHOD
@@ -162,7 +175,11 @@
162#endif 175#endif
163 176
164#ifndef HAVE_DTLSV1_2_CLIENT_METHOD 177#ifndef HAVE_DTLSV1_2_CLIENT_METHOD
165#define HAVE_DTLSV1_2_CLIENT_METHOD (OPENSSL_PREREQ(1,0,2) && !defined OPENSSL_NO_DTLS1) 178#ifdef OPENSSL_NO_DTLS1
179#define HAVE_DTLSV1_2_CLIENT_METHOD (0)
180#else
181#define HAVE_DTLSV1_2_CLIENT_METHOD OPENSSL_PREREQ(1,0,2)
182#endif
166#endif 183#endif
167 184
168#ifndef HAVE_DTLSV1_2_SERVER_METHOD 185#ifndef HAVE_DTLSV1_2_SERVER_METHOD
@@ -229,10 +246,6 @@
229#define HAVE_RSA_GET0_KEY OPENSSL_PREREQ(1,1,0) 246#define HAVE_RSA_GET0_KEY OPENSSL_PREREQ(1,1,0)
230#endif 247#endif
231 248
232#ifndef HAVE_RSA_PKCS1_PSS_PADDING
233#define HAVE_RSA_PKCS1_PSS_PADDING (defined RSA_PKCS1_PSS_PADDING || OPENSSL_PREREQ(1,0,0) || LIBRESSL_PREREQ(2,0,0))
234#endif
235
236#ifndef HAVE_RSA_SET0_CRT_PARAMS 249#ifndef HAVE_RSA_SET0_CRT_PARAMS
237#define HAVE_RSA_SET0_CRT_PARAMS OPENSSL_PREREQ(1,1,0) 250#define HAVE_RSA_SET0_CRT_PARAMS OPENSSL_PREREQ(1,1,0)
238#endif 251#endif
@@ -378,7 +391,11 @@
378#endif 391#endif
379 392
380#ifndef STRERROR_R_CHAR_P 393#ifndef STRERROR_R_CHAR_P
381#define STRERROR_R_CHAR_P (defined __GLIBC__ && (_GNU_SOURCE || !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600))) 394#ifdef __GLIBC__
395#define STRERROR_R_CHAR_P (_GNU_SOURCE || !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600))
396#else
397#define STRERROR_R_CHAR_P (0)
398#endif
382#endif 399#endif
383 400
384#ifndef LIST_HEAD 401#ifndef LIST_HEAD
@@ -4416,7 +4433,7 @@ static const auxL_IntegerReg pk_rsa_pad_opts[] = {
4416 { "RSA_NO_PADDING", RSA_NO_PADDING }, // no padding 4433 { "RSA_NO_PADDING", RSA_NO_PADDING }, // no padding
4417 { "RSA_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING }, // OAEP padding (encrypt and decrypt only) 4434 { "RSA_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING }, // OAEP padding (encrypt and decrypt only)
4418 { "RSA_X931_PADDING", RSA_X931_PADDING }, // (signature operations only) 4435 { "RSA_X931_PADDING", RSA_X931_PADDING }, // (signature operations only)
4419#if HAVE_RSA_PKCS1_PSS_PADDING 4436#if RSA_PKCS1_PSS_PADDING
4420 { "RSA_PKCS1_PSS_PADDING", RSA_PKCS1_PSS_PADDING }, // (sign and verify only) 4437 { "RSA_PKCS1_PSS_PADDING", RSA_PKCS1_PSS_PADDING }, // (sign and verify only)
4421#endif 4438#endif
4422 { NULL, 0 }, 4439 { NULL, 0 },