summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/openssl.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/openssl.c b/src/openssl.c
index f4bba40..63db361 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -799,11 +799,6 @@ static _Bool auxS_txt2nid(int *nid, const char *txt) {
799 * 799 *
800 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 800 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
801 801
802static int auxL_absindex(lua_State *L, int *index) {
803 *index = lua_absindex(L, *index);
804 return *index;
805} /* auxL_absindex() */
806
807typedef int auxref_t; 802typedef int auxref_t;
808typedef int auxtype_t; 803typedef int auxtype_t;
809 804
@@ -1166,16 +1161,18 @@ static const char *auxL_pushnid(lua_State *L, int nid) {
1166} /* auxL_pushnid() */ 1161} /* auxL_pushnid() */
1167 1162
1168static const EVP_MD *auxL_optdigest(lua_State *L, int index, EVP_PKEY *key, const EVP_MD *def) { 1163static const EVP_MD *auxL_optdigest(lua_State *L, int index, EVP_PKEY *key, const EVP_MD *def) {
1169 const char *name = luaL_optstring(L, auxL_absindex(L, &index), NULL); 1164 const char *name = luaL_optstring(L, index, NULL);
1170 const EVP_MD *md; 1165 const EVP_MD *md;
1171 1166
1172 if ((md = auxS_todigest(name, key, NULL))) 1167 if ((md = auxS_todigest(name, key, NULL)))
1173 return md; 1168 return md;
1174 1169
1175 if (name) { 1170 if (name) {
1171 index = lua_absindex(L, index);
1176 luaL_argerror(L, index, lua_pushfstring(L, "invalid digest type (%s)", name)); 1172 luaL_argerror(L, index, lua_pushfstring(L, "invalid digest type (%s)", name));
1177 NOTREACHED; 1173 NOTREACHED;
1178 } else if (key) { 1174 } else if (key) {
1175 index = lua_absindex(L, index);
1179 luaL_argerror(L, index, lua_pushfstring(L, "no digest type for key type (%d)", EVP_PKEY_base_id(key))); 1176 luaL_argerror(L, index, lua_pushfstring(L, "no digest type for key type (%d)", EVP_PKEY_base_id(key)));
1180 NOTREACHED; 1177 NOTREACHED;
1181 } 1178 }