summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Ahern <william@server.local>2013-09-09 17:20:31 -0700
committerWilliam Ahern <william@server.local>2013-09-09 17:20:31 -0700
commitc170c28d17d30d05ccfc042f642d9dcf686c830a (patch)
treed24eafda60b1825aa85733dfc88b884672d0f114
parent993ee935cdb5aacb3485cceb0cdb264d7f8bd098 (diff)
downloadluaossl-c170c28d17d30d05ccfc042f642d9dcf686c830a.tar.gz
luaossl-c170c28d17d30d05ccfc042f642d9dcf686c830a.tar.bz2
luaossl-c170c28d17d30d05ccfc042f642d9dcf686c830a.zip
-n
exclude currently dead code, and fix array terminator bug
-rw-r--r--openssl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/openssl.c b/openssl.c
index 5fda60d..f8e5ef0 100644
--- a/openssl.c
+++ b/openssl.c
@@ -1020,10 +1020,11 @@ static int pk_toPEM(lua_State *L) {
1020 "public", "PublicKey", 1020 "public", "PublicKey",
1021 "private", "PrivateKey", 1021 "private", "PrivateKey",
1022// "params", "Parameters", 1022// "params", "Parameters",
1023 NULL,
1023 }; 1024 };
1024 1025
1025 switch (checkoption(L, i, NULL, opts)) { 1026 switch (checkoption(L, i, NULL, opts)) {
1026 case 0: case 1: 1027 case 0: case 1: /* public, PublicKey */
1027 if (!PEM_write_bio_PUBKEY(bio, key)) 1028 if (!PEM_write_bio_PUBKEY(bio, key))
1028 return throwssl(L, "pubkey:__tostring"); 1029 return throwssl(L, "pubkey:__tostring");
1029 1030
@@ -1032,7 +1033,7 @@ static int pk_toPEM(lua_State *L) {
1032 1033
1033 BIO_reset(bio); 1034 BIO_reset(bio);
1034 break; 1035 break;
1035 case 2: case 3: 1036 case 2: case 3: /* private, PrivateKey */
1036 if (!PEM_write_bio_PrivateKey(bio, key, 0, 0, 0, 0, 0)) 1037 if (!PEM_write_bio_PrivateKey(bio, key, 0, 0, 0, 0, 0))
1037 throwssl(L, "pubkey:__tostring"); 1038 throwssl(L, "pubkey:__tostring");
1038 1039
@@ -1040,7 +1041,8 @@ static int pk_toPEM(lua_State *L) {
1040 lua_pushlstring(L, pem, len); 1041 lua_pushlstring(L, pem, len);
1041 1042
1042 break; 1043 break;
1043 case 4: case 5: 1044#if 0
1045 case 4: case 5: /* params, Parameters */
1044 /* EVP_PKEY_base_id not in OS X */ 1046 /* EVP_PKEY_base_id not in OS X */
1045 switch (EVP_PKEY_type(key->type)) { 1047 switch (EVP_PKEY_type(key->type)) {
1046 case EVP_PKEY_RSA: 1048 case EVP_PKEY_RSA:
@@ -1093,6 +1095,7 @@ static int pk_toPEM(lua_State *L) {
1093 BIO_reset(bio); 1095 BIO_reset(bio);
1094 1096
1095 break; 1097 break;
1098#endif
1096 default: 1099 default:
1097 lua_pushnil(L); 1100 lua_pushnil(L);
1098 1101
@@ -2164,7 +2167,7 @@ static int xc_getBasicConstraint(lua_State *L) {
2164 int n = 0, i, top; 2167 int n = 0, i, top;
2165 2168
2166 for (i = 2, top = lua_gettop(L); i <= top; i++) { 2169 for (i = 2, top = lua_gettop(L); i <= top; i++) {
2167 switch (checkoption(L, i, 0, (const char *[]){ "CA", "pathLen", "pathLenConstraint", 0 })) { 2170 switch (checkoption(L, i, 0, (const char *[]){ "CA", "pathLen", "pathLenConstraint", NULL })) {
2168 case 0: 2171 case 0:
2169 lua_pushboolean(L, CA); 2172 lua_pushboolean(L, CA);
2170 n++; 2173 n++;
@@ -2220,7 +2223,7 @@ static int xc_setBasicConstraint(lua_State *L) {
2220 } else { 2223 } else {
2221 lua_settop(L, 3); 2224 lua_settop(L, 3);
2222 2225
2223 switch (checkoption(L, 2, 0, (const char *[]){ "CA", "pathLen", "pathLenConstraint", 0 })) { 2226 switch (checkoption(L, 2, 0, (const char *[]){ "CA", "pathLen", "pathLenConstraint", NULL })) {
2224 case 0: 2227 case 0:
2225 luaL_checktype(L, 3, LUA_TBOOLEAN); 2228 luaL_checktype(L, 3, LUA_TBOOLEAN);
2226 CA = lua_toboolean(L, 3); 2229 CA = lua_toboolean(L, 3);
@@ -2385,7 +2388,7 @@ static int xc_sign(lua_State *L) {
2385 2388
2386static int xc__tostring(lua_State *L) { 2389static int xc__tostring(lua_State *L) {
2387 X509 *crt = checksimple(L, 1, X509_CERT_CLASS); 2390 X509 *crt = checksimple(L, 1, X509_CERT_CLASS);
2388 int fmt = checkoption(L, 2, "pem", (const char *[]){ "pem", 0 }); 2391 int fmt = checkoption(L, 2, "pem", (const char *[]){ "pem", NULL });
2389 BIO *bio = getbio(L); 2392 BIO *bio = getbio(L);
2390 char *pem; 2393 char *pem;
2391 long len; 2394 long len;
@@ -2598,7 +2601,7 @@ static int xr_sign(lua_State *L) {
2598 2601
2599static int xr__tostring(lua_State *L) { 2602static int xr__tostring(lua_State *L) {
2600 X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS); 2603 X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS);
2601 int fmt = checkoption(L, 2, "pem", (const char *[]){ "pem", 0 }); 2604 int fmt = checkoption(L, 2, "pem", (const char *[]){ "pem", NULL });
2602 BIO *bio = getbio(L); 2605 BIO *bio = getbio(L);
2603 char *pem; 2606 char *pem;
2604 long len; 2607 long len;