From b105f09ccc6ef4a90b97745f50a46a5910edcdc1 Mon Sep 17 00:00:00 2001 From: William Ahern Date: Fri, 18 Dec 2015 14:08:28 +0800 Subject: put EC variable declarations inside OPENSSL_NO_EC preprocessor guard (unable to confirm which, if any, of our platforms still don't support EC natively --- src/openssl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/openssl.c b/src/openssl.c index c3f8bbb..dea175e 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -2511,10 +2511,7 @@ static int pk_toPEM(lua_State *L) { static int pk_getParameters(lua_State *L) { EVP_PKEY *key = checksimple(L, 1, PKEY_CLASS); _Bool public_only = lua_toboolean(L, 2); - void *tmp; - const EC_GROUP *group; - const EC_POINT *public_key; if (!(tmp = EVP_PKEY_get0(key))) return auxL_error(L, auxL_EOPENSSL, "pkey:getParameters"); @@ -2590,7 +2587,11 @@ static int pk_getParameters(lua_State *L) { lua_setfield(L, -2, "priv_key"); break; - case EVP_PKEY_EC: +#ifndef OPENSSL_NO_EC + case EVP_PKEY_EC: { + const EC_GROUP *group; + const EC_POINT *public_key; + /* pub_key */ if (!(group = EC_KEY_get0_group(tmp)) || !(public_key = EC_KEY_get0_public_key(tmp))) return auxL_error(L, auxL_EOPENSSL, "pkey:getParameters"); @@ -2606,12 +2607,14 @@ static int pk_getParameters(lua_State *L) { lua_setfield(L, -2, "priv_key"); break; + } +#endif default: return luaL_error(L, "%d: unsupported EVP base type", EVP_PKEY_base_id(key)); } /* switch() */ return 1; -} +} /* pk_getParameters() */ static int pk__tostring(lua_State *L) { -- cgit v1.2.3-59-g8ed1b