Permalink
Browse files

Merge pull request #14 from mvv/x509-store-ctx-0.9-fix

Fixed X509_STORE_CTX bindings vs OpenSSL 0.9.x
  • Loading branch information...
2 parents 5b728e9 + 392a75f commit 9277f3523cb0f00ac27cd6348d8b1cbcd5a4991e @phonohawk committed Apr 24, 2012
Showing with 18 additions and 2 deletions.
  1. +2 −2 OpenSSL/X509/Store.hsc
  2. +16 −0 cbits/HsOpenSSL.c
View
4 OpenSSL/X509/Store.hsc
@@ -98,10 +98,10 @@ newtype X509StoreCtx = X509StoreCtx (ForeignPtr X509_STORE_CTX)
foreign import ccall unsafe "X509_STORE_CTX_get_current_cert"
_store_ctx_get_current_cert :: Ptr X509_STORE_CTX -> IO (Ptr X509_)
-foreign import ccall unsafe "X509_STORE_CTX_get0_current_issuer"
+foreign import ccall unsafe "HsOpenSSL_X509_STORE_CTX_get0_current_issuer"
_store_ctx_get0_current_issuer :: Ptr X509_STORE_CTX -> IO (Ptr X509_)
-foreign import ccall unsafe "X509_STORE_CTX_get0_current_crl"
+foreign import ccall unsafe "HsOpenSSL_X509_STORE_CTX_get0_current_crl"
_store_ctx_get0_current_crl :: Ptr X509_STORE_CTX -> IO (Ptr X509_CRL)
foreign import ccall unsafe "X509_STORE_CTX_get_chain"
View
16 cbits/HsOpenSSL.c
@@ -111,6 +111,22 @@ void HsOpenSSL_X509_CRL_ref(X509_CRL* crl) {
CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
}
+X509* HsOpenSSL_X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx) {
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ return X509_STORE_CTX_get0_current_issuer(ctx);
+#else
+ return ctx->current_issuer;
+#endif
+}
+
+X509_CRL* HsOpenSSL_X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx) {
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ return X509_STORE_CTX_get0_current_crl(ctx);
+#else
+ return ctx->current_crl;
+#endif
+}
+
/* PKCS#7 *********************************************************************/
long HsOpenSSL_PKCS7_is_detached(PKCS7* pkcs7) {
return PKCS7_is_detached(pkcs7);

0 comments on commit 9277f35

Please sign in to comment.