aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-03 16:58:38 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-03 16:58:38 +1000
commit51a4b348321bb0b2594bbaaca2487f16c3dfcd34 (patch)
tree2f5f43d6f565cb8206f64e86a475deec369b6361
parent91a652f1d977bb98d8baee0ba0a2df4eba7ca191 (diff)
parent9c2be15399e2026849529cd7bc79df2b0bfff4a9 (diff)
downloadluaossl-51a4b348321bb0b2594bbaaca2487f16c3dfcd34.tar.gz
luaossl-51a4b348321bb0b2594bbaaca2487f16c3dfcd34.tar.bz2
luaossl-51a4b348321bb0b2594bbaaca2487f16c3dfcd34.zip
Merge branch 'xc_getSignatureName'
-rw-r--r--src/openssl.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/openssl.c b/src/openssl.c
index f5c851d..ab729d4 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -300,6 +300,10 @@
#define HAVE_SSLV2_SERVER_METHOD (!OPENSSL_PREREQ(1,1,0) && !defined OPENSSL_NO_SSL2)
#endif
+#ifndef HAVE_X509_GET_SIGNATURE_NID
+#define HAVE_X509_GET_SIGNATURE_NID (OPENSSL_PREREQ(1,0,2))
+#endif
+
#ifndef HAVE_X509_STORE_REFERENCES
#define HAVE_X509_STORE_REFERENCES (!OPENSSL_PREREQ(1,1,0))
#endif
@@ -1613,6 +1617,10 @@ static int compat_SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm) {
#define X509_get0_ext(crt, i) X509_get_ext((crt), (i))
#endif
+#if !HAVE_X509_GET_SIGNATURE_NID
+#define X509_get_signature_nid(crt) OBJ_obj2nid((crt)->sig_alg->algorithm)
+#endif
+
#if !HAVE_X509_CRL_GET0_EXT
#define X509_CRL_get0_ext(crt, i) X509_CRL_get_ext((crt), (i))
#endif
@@ -6097,23 +6105,17 @@ static int xc_getPublicKeyDigest(lua_State *L) {
} /* xc_getPublicKeyDigest() */
-#if 0
-/*
- * TODO: X509_get_signature_type always seems to return NID_undef. Are we
- * using it wrong or is it broken?
- */
static int xc_getSignatureName(lua_State *L) {
X509 *crt = checksimple(L, 1, X509_CERT_CLASS);
int nid;
- if (NID_undef == (nid = X509_get_signature_type(crt)))
+ if (NID_undef == (nid = X509_get_signature_nid(crt)))
return 0;
auxL_pushnid(L, nid);
return 1;
} /* xc_getSignatureName() */
-#endif
static int xc_sign(lua_State *L) {
@@ -6260,9 +6262,7 @@ static const auxL_Reg xc_methods[] = {
{ "getPublicKey", &xc_getPublicKey },
{ "setPublicKey", &xc_setPublicKey },
{ "getPublicKeyDigest", &xc_getPublicKeyDigest },
-#if 0
{ "getSignatureName", &xc_getSignatureName },
-#endif
{ "sign", &xc_sign },
{ "text", &xc_text },
{ "tostring", &xc__tostring },