diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/openssl.c | 39 |
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) { | |||
| 4983 | CONF *conf = NULL; | 4983 | CONF *conf = NULL; |
| 4984 | X509V3_CTX cbuf = { 0 }, *ctx = NULL; | 4984 | X509V3_CTX cbuf = { 0 }, *ctx = NULL; |
| 4985 | X509_EXTENSION **ud; | 4985 | X509_EXTENSION **ud; |
| 4986 | _Bool crit; | ||
| 4986 | 4987 | ||
| 4987 | lua_settop(L, 3); | 4988 | lua_settop(L, 3); |
| 4988 | ud = prepsimple(L, X509_EXT_CLASS); | 4989 | ud = prepsimple(L, X509_EXT_CLASS); |
| 4989 | 4990 | ||
| 4990 | switch (lua_type(L, 3)) { | 4991 | if (xe_new_isder(value, &crit)) { |
| 4991 | case LUA_TNONE: | ||
| 4992 | case LUA_TNIL: | ||
| 4993 | break; | ||
| 4994 | case LUA_TSTRING: { | ||
| 4995 | size_t len; | 4992 | size_t len; |
| 4996 | const char *cdata = lua_tolstring(L, 3, &len); | 4993 | const char *cdata = lua_tolstring(L, 3, &len); |
| 4997 | _Bool crit; | 4994 | if (!(obj = OBJ_txt2obj(name, 0))) |
| 4998 | 4995 | goto error; | |
| 4999 | if (xe_new_isder(value, &crit)) { | 4996 | if (!(oct = ASN1_STRING_new())) |
| 5000 | if (!(obj = OBJ_txt2obj(name, 0))) | 4997 | goto error; |
| 5001 | goto error; | 4998 | if (!ASN1_STRING_set(oct, cdata, len)) |
| 5002 | if (!(oct = ASN1_STRING_new())) | 4999 | goto error; |
| 5003 | goto error; | 5000 | if (!(*ud = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct))) |
| 5004 | if (!ASN1_STRING_set(oct, cdata, len)) | 5001 | goto error; |
| 5005 | goto error; | ||
| 5006 | if (!(*ud = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct))) | ||
| 5007 | goto error; | ||
| 5008 | 5002 | ||
| 5009 | ASN1_OBJECT_free(obj); | 5003 | ASN1_OBJECT_free(obj); |
| 5010 | ASN1_STRING_free(oct); | 5004 | ASN1_STRING_free(oct); |
| 5011 | 5005 | ||
| 5012 | return 1; | 5006 | return 1; |
| 5013 | } | 5007 | } |
| 5014 | 5008 | ||
| 5009 | switch (lua_type(L, 3)) { | ||
| 5010 | case LUA_TNONE: | ||
| 5011 | case LUA_TNIL: | ||
| 5012 | break; | ||
| 5013 | case LUA_TSTRING: { | ||
| 5015 | if (!(conf = loadconf(L, 3))) | 5014 | if (!(conf = loadconf(L, 3))) |
| 5016 | goto error; | 5015 | goto error; |
| 5017 | 5016 | ||
