diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-05-21 13:33:49 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-05-21 13:33:49 +0300 |
commit | 3681f34c0d3bd9b6d30a7817989a862e29ab4fe4 (patch) | |
tree | 37c7682cc82c2aeb40dbae3f254d0443098adf34 /main/lua-ossl/0005-initialize-extension-data-in-DER-format-without-inte.patch | |
parent | 4612138ae56728c821ba01850d8e0f36aa5ce2a3 (diff) | |
download | aports-3681f34c0d3bd9b6d30a7817989a862e29ab4fe4.tar.bz2 aports-3681f34c0d3bd9b6d30a7817989a862e29ab4fe4.tar.xz |
main/lua-ossl: various extension-related improvements
Diffstat (limited to 'main/lua-ossl/0005-initialize-extension-data-in-DER-format-without-inte.patch')
-rw-r--r-- | main/lua-ossl/0005-initialize-extension-data-in-DER-format-without-inte.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/main/lua-ossl/0005-initialize-extension-data-in-DER-format-without-inte.patch b/main/lua-ossl/0005-initialize-extension-data-in-DER-format-without-inte.patch new file mode 100644 index 0000000000..331720254d --- /dev/null +++ b/main/lua-ossl/0005-initialize-extension-data-in-DER-format-without-inte.patch @@ -0,0 +1,63 @@ +From 7ca611d113b05016ad91920120e537712e036983 Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> +Date: Thu, 14 May 2015 15:24:05 +0300 +Subject: [PATCH 5/5] initialize extension data in DER format without + intermediate hex encoding + +--- + src/openssl.c | 27 ++++++++++++++++++++++++++- + 1 file changed, 26 insertions(+), 1 deletion(-) + +diff --git a/src/openssl.c b/src/openssl.c +index 89be6b5..55f9aaa 100644 +--- a/src/openssl.c ++++ b/src/openssl.c +@@ -2841,12 +2841,31 @@ static int xe_new(lua_State *L) { + const char *name = luaL_checkstring(L, 1); + const char *value = luaL_checkstring(L, 2); + ++ ASN1_OBJECT *obj = NULL; ++ ASN1_STRING *oct = NULL; + CONF *conf = NULL; + X509V3_CTX cbuf = { 0 }, *ctx = NULL; + X509_EXTENSION *ext = NULL; + + if (!lua_isnil(L, 3)) { +- const char *cdata = luaL_checkstring(L, 3); ++ size_t len; ++ const char *cdata = luaL_checklstring(L, 3, &len); ++ int crit = !strcmp(value, "critical,DER"); ++ ++ if (crit || !strcmp(value, "DER")) { ++ 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); ++ return 1; ++ } ++ + BIO *bio = getbio(L); + if (BIO_puts(bio, cdata) < 0) + goto error; +@@ -2877,6 +2896,12 @@ static int xe_new(lua_State *L) { + + return 1; + error: ++ if (obj) ++ ASN1_OBJECT_free(obj); ++ ++ if (oct) ++ ASN1_STRING_free(oct); ++ + if (conf) + NCONF_free(conf); + +-- +2.1.0 + |