Permalink
Browse files

OpenSSL.X509.Revocation.getRevoked is only available on OpenSSL 1.0.0…

… or later.
  • Loading branch information...
1 parent a3e5cd5 commit 1a3ba7675e9ee43f2c429f7bca798bf433225e5b @depressed-pho committed Sep 22, 2011
Showing with 10 additions and 0 deletions.
  1. +9 −0 OpenSSL/X509/Revocation.hsc
  2. +1 −0 cbits/HsOpenSSL.h
@@ -39,7 +39,9 @@ module OpenSSL.X509.Revocation
, getRevokedList
, addRevoked
+#if OPENSSL_VERSION_NUMBER >= 0x10000000
, getRevoked
+#endif
)
where
@@ -120,9 +122,11 @@ foreign import ccall unsafe "HsOpenSSL_X509_CRL_get_REVOKED"
foreign import ccall unsafe "X509_CRL_add0_revoked"
_add0_revoked :: Ptr X509_CRL -> Ptr X509_REVOKED -> IO CInt
+#if OPENSSL_VERSION_NUMBER >= 0x10000000
foreign import ccall unsafe "X509_CRL_get0_by_serial"
_get0_by_serial :: Ptr X509_CRL -> Ptr (Ptr X509_REVOKED)
-> Ptr ASN1_INTEGER -> IO CInt
+#endif
foreign import ccall unsafe "X509_CRL_sort"
_sort :: Ptr X509_CRL -> IO CInt
@@ -319,7 +323,11 @@ addRevoked crl revoked
1 -> return ()
_ -> freeRevoked revPtr >> raiseOpenSSLError
+#if OPENSSL_VERSION_NUMBER >= 0x10000000
-- |@'getRevoked' crl serial@ looks up the corresponding revocation.
+--
+-- Note that this function is only available on OpenSSL 1.0.0 or
+-- later.
getRevoked :: CRL -> Integer -> IO (Maybe RevokedCertificate)
getRevoked crl serial =
withCRLPtr crl $ \crlPtr ->
@@ -329,6 +337,7 @@ getRevoked crl serial =
if r == 1
then fmap Just $ peek revPtr >>= peekRevoked
else return Nothing
+#endif
-- |@'sortCRL' crl@ sorts the certificates in the revocation list.
sortCRL :: CRL -> IO ()
View
@@ -10,6 +10,7 @@
#include <openssl/rand.h>
#include <openssl/objects.h>
#include <openssl/opensslconf.h>
+#include <openssl/opensslv.h>
#include <openssl/pem.h>
#include <openssl/pkcs7.h>
#include <openssl/ssl.h>

0 comments on commit 1a3ba76

Please sign in to comment.