summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-03 22:12:57 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-03 22:12:57 +1000
commit5d6b15859e25da8271a3820662bb9d1f8a935107 (patch)
tree6bf9e07230165003b26cb86ee9be0c7263075864
parent32cb45c8627a41373d04d6fdc48e02d253957a65 (diff)
downloadluaossl-5d6b15859e25da8271a3820662bb9d1f8a935107.tar.gz
luaossl-5d6b15859e25da8271a3820662bb9d1f8a935107.tar.bz2
luaossl-5d6b15859e25da8271a3820662bb9d1f8a935107.zip
Remove need for LUA_COMPAT_APIINTCASTS
-rw-r--r--src/GNUmakefile2
-rw-r--r--src/openssl.c38
2 files changed, 16 insertions, 24 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
index 132f3bf..9e4fde4 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -20,7 +20,7 @@ OS_$(d) = $(shell $(d)/../mk/vendor.os)
20CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc) 20CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc)
21LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/luapath -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) 21LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/luapath -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2))
22 22
23CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) -DLUA_COMPAT_APIINTCASTS -DHAVE_CONFIG_H 23CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) -DHAVE_CONFIG_H
24CFLAGS_$(d) = $(CFLAGS_$(abspath $(@D)/../..)) 24CFLAGS_$(d) = $(CFLAGS_$(abspath $(@D)/../..))
25LDFLAGS_$(d) = $(LDFLAGS_$(abspath $(@D)/../..)) 25LDFLAGS_$(d) = $(LDFLAGS_$(abspath $(@D)/../..))
26SOFLAGS_$(d) = $(SOFLAGS_$(abspath $(@D)/../..)) 26SOFLAGS_$(d) = $(SOFLAGS_$(abspath $(@D)/../..))
diff --git a/src/openssl.c b/src/openssl.c
index 67c8263..a01fde5 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -929,7 +929,7 @@ static void auxL_pushinteger(lua_State *L, auxL_Integer i) {
929 } 929 }
930} /* auxL_pushinteger() */ 930} /* auxL_pushinteger() */
931 931
932NOTUSED static void auxL_pushunsigned(lua_State *L, auxL_Unsigned i) { 932static void auxL_pushunsigned(lua_State *L, auxL_Unsigned i) {
933 if (i <= lua_IntegerMax) { 933 if (i <= lua_IntegerMax) {
934 lua_pushinteger(L, i); 934 lua_pushinteger(L, i);
935 } else if (i == (auxL_Unsigned)(lua_Number)i) { 935 } else if (i == (auxL_Unsigned)(lua_Number)i) {
@@ -3463,7 +3463,7 @@ static int pk_decrypt(lua_State *L) {
3463 if (lua_istable(L, 3)) { 3463 if (lua_istable(L, 3)) {
3464 if (base_type == EVP_PKEY_RSA) { 3464 if (base_type == EVP_PKEY_RSA) {
3465 lua_getfield(L, 3, "rsaPadding"); 3465 lua_getfield(L, 3, "rsaPadding");
3466 rsaPadding = luaL_optint(L, -1, rsaPadding); 3466 rsaPadding = luaL_optinteger(L, -1, rsaPadding);
3467 lua_pop(L, 1); 3467 lua_pop(L, 1);
3468 } 3468 }
3469 } 3469 }
@@ -3522,7 +3522,7 @@ static int pk_encrypt(lua_State *L) {
3522 if (lua_istable(L, 3)) { 3522 if (lua_istable(L, 3)) {
3523 if (base_type == EVP_PKEY_RSA) { 3523 if (base_type == EVP_PKEY_RSA) {
3524 lua_getfield(L, 3, "rsaPadding"); 3524 lua_getfield(L, 3, "rsaPadding");
3525 rsaPadding = luaL_optint(L, -1, rsaPadding); 3525 rsaPadding = luaL_optinteger(L, -1, rsaPadding);
3526 lua_pop(L, 1); 3526 lua_pop(L, 1);
3527 } 3527 }
3528 } 3528 }
@@ -4444,7 +4444,7 @@ static int ecg_new(lua_State *L) {
4444 return 1; 4444 return 1;
4445 } 4445 }
4446 case LUA_TNUMBER: { 4446 case LUA_TNUMBER: {
4447 int nid = luaL_checkint(L, 2); 4447 int nid = luaL_checkinteger(L, 2);
4448 4448
4449 if (!ecg_push_by_nid(L, nid)) 4449 if (!ecg_push_by_nid(L, nid))
4450 goto sslerr; 4450 goto sslerr;
@@ -5364,7 +5364,7 @@ static int xc_getVersion(lua_State *L) {
5364 5364
5365static int xc_setVersion(lua_State *L) { 5365static int xc_setVersion(lua_State *L) {
5366 X509 *crt = checksimple(L, 1, X509_CERT_CLASS); 5366 X509 *crt = checksimple(L, 1, X509_CERT_CLASS);
5367 int version = luaL_checkint(L, 2); 5367 int version = luaL_checkinteger(L, 2);
5368 5368
5369 if (!X509_set_version(crt, version - 1)) 5369 if (!X509_set_version(crt, version - 1))
5370 return luaL_error(L, "x509.cert:setVersion: %d: invalid version", version); 5370 return luaL_error(L, "x509.cert:setVersion: %d: invalid version", version);
@@ -5911,11 +5911,11 @@ static int xc_setBasicConstraint(lua_State *L) {
5911 lua_pop(L, 1); 5911 lua_pop(L, 1);
5912 5912
5913 lua_getfield(L, 2, "pathLen"); 5913 lua_getfield(L, 2, "pathLen");
5914 pathLen = luaL_optint(L, -1, pathLen); 5914 pathLen = luaL_optinteger(L, -1, pathLen);
5915 lua_pop(L, 1); 5915 lua_pop(L, 1);
5916 5916
5917 lua_getfield(L, 2, "pathLenConstraint"); 5917 lua_getfield(L, 2, "pathLenConstraint");
5918 pathLen = luaL_optint(L, -1, pathLen); 5918 pathLen = luaL_optinteger(L, -1, pathLen);
5919 lua_pop(L, 1); 5919 lua_pop(L, 1);
5920 5920
5921 if (!(bs = BASIC_CONSTRAINTS_new())) 5921 if (!(bs = BASIC_CONSTRAINTS_new()))
@@ -5932,7 +5932,7 @@ static int xc_setBasicConstraint(lua_State *L) {
5932 case 1: 5932 case 1:
5933 /* FALL THROUGH */ 5933 /* FALL THROUGH */
5934 case 2: 5934 case 2:
5935 pathLen = luaL_checkint(L, 3); 5935 pathLen = luaL_checkinteger(L, 3);
5936 5936
5937 break; 5937 break;
5938 } 5938 }
@@ -6420,7 +6420,7 @@ static int xr_getVersion(lua_State *L) {
6420 6420
6421static int xr_setVersion(lua_State *L) { 6421static int xr_setVersion(lua_State *L) {
6422 X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS); 6422 X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS);
6423 int version = luaL_checkint(L, 2); 6423 int version = luaL_checkinteger(L, 2);
6424 6424
6425 if (!X509_REQ_set_version(csr, version - 1)) 6425 if (!X509_REQ_set_version(csr, version - 1))
6426 return luaL_error(L, "x509.csr:setVersion: %d: invalid version", version); 6426 return luaL_error(L, "x509.csr:setVersion: %d: invalid version", version);
@@ -6725,7 +6725,7 @@ static int xx_getVersion(lua_State *L) {
6725 6725
6726static int xx_setVersion(lua_State *L) { 6726static int xx_setVersion(lua_State *L) {
6727 X509_CRL *crl = checksimple(L, 1, X509_CRL_CLASS); 6727 X509_CRL *crl = checksimple(L, 1, X509_CRL_CLASS);
6728 int version = luaL_checkint(L, 2); 6728 int version = luaL_checkinteger(L, 2);
6729 6729
6730 if (!X509_CRL_set_version(crl, version - 1)) 6730 if (!X509_CRL_set_version(crl, version - 1))
6731 return luaL_error(L, "x509.crl:setVersion: %d: invalid version", version); 6731 return luaL_error(L, "x509.crl:setVersion: %d: invalid version", version);
@@ -7878,8 +7878,8 @@ static int sx_getParam(lua_State *L) {
7878 7878
7879static int sx_setVerify(lua_State *L) { 7879static int sx_setVerify(lua_State *L) {
7880 SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); 7880 SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS);
7881 int mode = luaL_optint(L, 2, -1); 7881 int mode = luaL_optinteger(L, 2, -1);
7882 int depth = luaL_optint(L, 3, -1); 7882 int depth = luaL_optinteger(L, 3, -1);
7883 7883
7884 if (mode != -1) 7884 if (mode != -1)
7885 SSL_CTX_set_verify(ctx, mode, 0); 7885 SSL_CTX_set_verify(ctx, mode, 0);
@@ -9808,7 +9808,7 @@ static int rand_add(lua_State *L) {
9808 9808
9809 9809
9810static int rand_bytes(lua_State *L) { 9810static int rand_bytes(lua_State *L) {
9811 int size = luaL_checkint(L, 1); 9811 int size = luaL_checkinteger(L, 1);
9812 luaL_Buffer B; 9812 luaL_Buffer B;
9813 int count = 0, n; 9813 int count = 0, n;
9814 9814
@@ -9924,11 +9924,7 @@ static int rand_uniform(lua_State *L) {
9924 } else { 9924 } else {
9925 unsigned long long N, m; 9925 unsigned long long N, m;
9926 9926
9927 if (sizeof (lua_Unsigned) >= sizeof r) { 9927 N = auxL_checkunsigned(L, 1);
9928 N = luaL_checkunsigned(L, 1);
9929 } else {
9930 N = luaL_checknumber(L, 1);
9931 }
9932 9928
9933 luaL_argcheck(L, N > 1, 1, lua_pushfstring(L, "[0, %d): interval is empty", (int)N)); 9929 luaL_argcheck(L, N > 1, 1, lua_pushfstring(L, "[0, %d): interval is empty", (int)N));
9934 9930
@@ -9941,11 +9937,7 @@ static int rand_uniform(lua_State *L) {
9941 r = r % N; 9937 r = r % N;
9942 } 9938 }
9943 9939
9944 if (sizeof (lua_Unsigned) >= sizeof r) { 9940 auxL_pushunsigned(L, r);
9945 lua_pushunsigned(L, r);
9946 } else {
9947 lua_pushnumber(L, r);
9948 }
9949 9941
9950 return 1; 9942 return 1;
9951} /* rand_uniform() */ 9943} /* rand_uniform() */