Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Commit

Permalink
Fixed X509_STORE_CTX bindings vs OpenSSL 0.9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mvv committed Apr 22, 2012
1 parent 5b728e9 commit 392a75f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OpenSSL/X509/Store.hsc
Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions cbits/HsOpenSSL.c
Expand Up @@ -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);
Expand Down

0 comments on commit 392a75f

Please sign in to comment.