aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/openssl.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 5835a0a..a11e6ae 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -4983,35 +4983,34 @@ static int xe_new(lua_State *L) {
CONF *conf = NULL;
X509V3_CTX cbuf = { 0 }, *ctx = NULL;
X509_EXTENSION **ud;
+ _Bool crit;
lua_settop(L, 3);
ud = prepsimple(L, X509_EXT_CLASS);
- switch (lua_type(L, 3)) {
- case LUA_TNONE:
- case LUA_TNIL:
- break;
- case LUA_TSTRING: {
+ if (xe_new_isder(value, &crit)) {
size_t len;
const char *cdata = lua_tolstring(L, 3, &len);
- _Bool crit;
-
- if (xe_new_isder(value, &crit)) {
- if (!(obj = OBJ_txt2obj(name, 0)))
- goto error;
- if (!(oct = ASN1_STRING_new()))
- goto error;
- if (!ASN1_STRING_set(oct, cdata, len))
- goto error;
- if (!(*ud = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct)))
- goto error;
+ if (!(obj = OBJ_txt2obj(name, 0)))
+ goto error;
+ if (!(oct = ASN1_STRING_new()))
+ goto error;
+ if (!ASN1_STRING_set(oct, cdata, len))
+ goto error;
+ if (!(*ud = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct)))
+ goto error;
- ASN1_OBJECT_free(obj);
- ASN1_STRING_free(oct);
+ ASN1_OBJECT_free(obj);
+ ASN1_STRING_free(oct);
- return 1;
- }
+ return 1;
+ }
+ switch (lua_type(L, 3)) {
+ case LUA_TNONE:
+ case LUA_TNIL:
+ break;
+ case LUA_TSTRING: {
if (!(conf = loadconf(L, 3)))
goto error;