Skip to content

Instantly share code, notes, and snippets.

@wolfiestyle
Created May 19, 2015 03:58
Show Gist options
  • Save wolfiestyle/18d2549be6ea3ea42e62 to your computer and use it in GitHub Desktop.
Save wolfiestyle/18d2549be6ea3ea42e62 to your computer and use it in GitHub Desktop.
diff --git a/src/openssl.c b/src/openssl.c
index 99a1ec0..7dc19e2 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -2988,7 +2988,7 @@ static int xc_getVersion(lua_State *L) {
static int xc_setVersion(lua_State *L) {
X509 *crt = checksimple(L, 1, X509_CERT_CLASS);
- int version = luaL_checkint(L, 2);
+ int version = luaL_checkinteger(L, 2);
if (!X509_set_version(crt, version - 1))
return luaL_error(L, "x509.cert:setVersion: %d: invalid version", version);
@@ -3537,11 +3537,11 @@ static int xc_setBasicConstraint(lua_State *L) {
lua_pop(L, 1);
lua_getfield(L, 2, "pathLen");
- pathLen = luaL_optint(L, -1, pathLen);
+ pathLen = luaL_optinteger(L, -1, pathLen);
lua_pop(L, 1);
lua_getfield(L, 2, "pathLenConstraint");
- pathLen = luaL_optint(L, -1, pathLen);
+ pathLen = luaL_optinteger(L, -1, pathLen);
lua_pop(L, 1);
if (!(bs = BASIC_CONSTRAINTS_new()))
@@ -3558,7 +3558,7 @@ static int xc_setBasicConstraint(lua_State *L) {
case 1:
/* FALL THROUGH */
case 2:
- pathLen = luaL_checkint(L, 3);
+ pathLen = luaL_checkinteger(L, 3);
break;
}
@@ -3944,7 +3944,7 @@ static int xr_getVersion(lua_State *L) {
static int xr_setVersion(lua_State *L) {
X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS);
- int version = luaL_checkint(L, 2);
+ int version = luaL_checkinteger(L, 2);
if (!X509_REQ_set_version(csr, version - 1))
return luaL_error(L, "x509.csr:setVersion: %d: invalid version", version);
@@ -4150,7 +4150,7 @@ static int xx_getVersion(lua_State *L) {
static int xx_setVersion(lua_State *L) {
X509_CRL *crl = checksimple(L, 1, X509_CRL_CLASS);
- int version = luaL_checkint(L, 2);
+ int version = luaL_checkinteger(L, 2);
if (!X509_CRL_set_version(crl, version - 1))
return luaL_error(L, "x509.crl:setVersion: %d: invalid version", version);
@@ -5066,8 +5066,8 @@ static int sx_setStore(lua_State *L) {
static int sx_setVerify(lua_State *L) {
SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS);
- int mode = luaL_optint(L, 2, -1);
- int depth = luaL_optint(L, 3, -1);
+ int mode = luaL_optinteger(L, 2, -1);
+ int depth = luaL_optinteger(L, 3, -1);
if (mode != -1)
SSL_CTX_set_verify(ctx, mode, 0);
@@ -6270,7 +6270,7 @@ static void randL_checkpid(struct randL_state *st) {
static int rand_stir(lua_State *L) {
- int error = randL_stir(randL_getstate(L), luaL_optunsigned(L, 1, 16));
+ int error = randL_stir(randL_getstate(L), luaL_optinteger(L, 1, 16));
if (error) {
lua_pushboolean(L, 0);
@@ -6303,7 +6303,7 @@ static int rand_add(lua_State *L) {
static int rand_bytes(lua_State *L) {
- int size = luaL_checkint(L, 1);
+ int size = luaL_checkinteger(L, 1);
luaL_Buffer B;
int count = 0, n;
@@ -6420,7 +6420,7 @@ static int rand_uniform(lua_State *L) {
unsigned long long N, m;
if (sizeof (lua_Unsigned) >= sizeof r) {
- N = luaL_checkunsigned(L, 1);
+ N = luaL_checkinteger(L, 1);
} else {
N = luaL_checknumber(L, 1);
}
@@ -6437,7 +6437,7 @@ static int rand_uniform(lua_State *L) {
}
if (sizeof (lua_Unsigned) >= sizeof r) {
- lua_pushunsigned(L, r);
+ lua_pushinteger(L, r);
} else {
lua_pushnumber(L, r);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment