[rs-commit] r101 - in /redwax-tool/trunk: config.h.in configure.ac redwax_openssl.c

rs-commit at redwax.eu rs-commit at redwax.eu
Wed Dec 1 22:07:11 CET 2021


Author: minfrin at redwax.eu
Date: Wed Dec  1 22:07:11 2021
New Revision: 101

Log:
Fill in for older OpenSSL.

Modified:
    redwax-tool/trunk/config.h.in
    redwax-tool/trunk/configure.ac
    redwax-tool/trunk/redwax_openssl.c

Modified: redwax-tool/trunk/config.h.in
==============================================================================
--- redwax-tool/trunk/config.h.in	(original)
+++ redwax-tool/trunk/config.h.in	Wed Dec  1 22:07:11 2021
@@ -125,11 +125,23 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `X509_get0_extensions' function. */
+#undef HAVE_X509_GET0_EXTENSIONS
+
 /* Define to 1 if you have the `X509_get0_notAfter' function. */
 #undef HAVE_X509_GET0_NOTAFTER
 
 /* Define to 1 if you have the `X509_get0_notBefore' function. */
 #undef HAVE_X509_GET0_NOTBEFORE
+
+/* Define to 1 if you have the `X509_get0_signature' function. */
+#undef HAVE_X509_GET0_SIGNATURE
+
+/* Define to 1 if you have the `X509_get0_tbs_sigalg' function. */
+#undef HAVE_X509_GET0_TBS_SIGALG
+
+/* Define to 1 if you have the `X509_get0_uids' function. */
+#undef HAVE_X509_GET0_UIDS
 
 /* Define to 1 if you have the `X509_get_extension_flags' function. */
 #undef HAVE_X509_GET_EXTENSION_FLAGS

Modified: redwax-tool/trunk/configure.ac
==============================================================================
--- redwax-tool/trunk/configure.ac	(original)
+++ redwax-tool/trunk/configure.ac	Wed Dec  1 22:07:11 2021
@@ -96,7 +96,7 @@
 
 # Checks for library functions.
 AC_FUNC_MALLOC
-AC_CHECK_FUNCS([OPENSSL_init_crypto PKCS12_SAFEBAG_get0_safes PKCS12_SAFEBAG_get_bag_nid PKCS12_SAFEBAG_get_nid PKCS12_SAFEBAG_get0_attr PKCS12_SAFEBAG_get0_p8inf PKCS12_SAFEBAG_get1_cert PKCS12_SAFEBAG_get1_crl OPENSSL_uni2utf8 ASN1_TIME_diff X509_STORE_get0_param X509_STORE_CTX_set0_trusted_stack X509_STORE_CTX_get_num_untrusted X509_get0_notBefore X509_get0_notAfter X509_get_extension_flags X509_up_ref EVP_PKEY_get0_description EVP_PKEY_get_bn_param RSA_get0_n RSA_get0_e RSA_get0_d RSA_get0_p RSA_get0_q RSA_get0_dmp1 RSA_get0_dmq1 RSA_get0_iqmp RSA_set0_key RSA_set0_factors RSA_set0_crt_params NSS_Initialize p11_kit_modules_load_and_initialize apr_crypto_clear])
+AC_CHECK_FUNCS([OPENSSL_init_crypto PKCS12_SAFEBAG_get0_safes PKCS12_SAFEBAG_get_bag_nid PKCS12_SAFEBAG_get_nid PKCS12_SAFEBAG_get0_attr PKCS12_SAFEBAG_get0_p8inf PKCS12_SAFEBAG_get1_cert PKCS12_SAFEBAG_get1_crl OPENSSL_uni2utf8 ASN1_TIME_diff X509_STORE_get0_param X509_STORE_CTX_set0_trusted_stack X509_STORE_CTX_get_num_untrusted X509_get0_notBefore X509_get0_notAfter X509_get0_tbs_sigalg X509_get0_uids X509_get0_extensions X509_get0_signature X509_get_extension_flags X509_up_ref EVP_PKEY_get0_description EVP_PKEY_get_bn_param RSA_get0_n RSA_get0_e RSA_get0_d RSA_get0_p RSA_get0_q RSA_get0_dmp1 RSA_get0_dmq1 RSA_get0_iqmp RSA_set0_key RSA_set0_factors RSA_set0_crt_params NSS_Initialize p11_kit_modules_load_and_initialize apr_crypto_clear])
 
 AC_OUTPUT
 

Modified: redwax-tool/trunk/redwax_openssl.c
==============================================================================
--- redwax-tool/trunk/redwax_openssl.c	(original)
+++ redwax-tool/trunk/redwax_openssl.c	Wed Dec  1 22:07:11 2021
@@ -591,6 +591,42 @@
 #define X509_get0_notAfter X509_get_notAfter
 #endif
 
+#if !HAVE_X509_GET0_TBS_SIGALG
+const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x)
+{
+    return &x->cert_info.signature;
+}
+#endif
+
+#if !HAVE_X509_GET0_EXTENSIONS
+const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x)
+{
+    return x->cert_info.extensions;
+}
+#endif
+
+#if !HAVE_X509_GET0_UIDS
+void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,
+                    const ASN1_BIT_STRING **psuid)
+{
+    if (piuid != NULL)
+        *piuid = x->cert_info.issuerUID;
+    if (psuid != NULL)
+        *psuid = x->cert_info.subjectUID;
+}
+#endif
+
+#if !HAVE_X509_GET0_SIGNATURE
+void X509_get0_signature(const ASN1_BIT_STRING **psig,
+                         const X509_ALGOR **palg, const X509 *x)
+{
+    if (psig)
+        *psig = &x->signature;
+    if (palg)
+        *palg = &x->sig_alg;
+}
+#endif
+
 #if !HAVE_X509_GET_EXTENSION_FLAGS
 uint32_t X509_get_extension_flags(X509 *x)
 {
@@ -2565,7 +2601,7 @@
     char *buf = NULL;
     int len = 0;
 
-    X509_PUBKEY_get0_param(&xpoid, NULL, NULL, NULL, xpkey);
+    X509_PUBKEY_get0_param(&xpoid, NULL, NULL, NULL, (X509_PUBKEY *) xpkey);
 
     redwax_metadata_push_object(m, "SubjectPublicKeyInfo", 0);
 
@@ -2582,7 +2618,7 @@
 
     BIO_free(bio);
 
-    pkey = X509_PUBKEY_get(xpkey);
+    pkey = X509_PUBKEY_get((X509_PUBKEY *)xpkey);
     if (pkey) {
 #if 0
 //        EVP_PKEY_print_public(bp, pkey, 16, NULL);



More information about the rs-commit mailing list