Skip to content

Loading…

Fixed X509_STORE_CTX bindings vs OpenSSL 0.9.x #14

Merged
merged 1 commit into from

2 participants

@mvv

No description provided.

@phonohawk phonohawk merged commit 9277f35 into phonohawk:master
@phonohawk
Owner

Merged and tested against openssl-0.9.8t. Thanks!
http://hackage.haskell.org/package/HsOpenSSL-0.10.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 22, 2012
  1. @mvv
This page is out of date. Refresh to see the latest.
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);
Something went wrong with that request. Please try again.