From: Victor Wagner <vitus@wagner.pp.ru>
Date: Sun, 13 May 2018 04:14:44 +0000 (+0300)
Subject: Added explicit check for CMS functions in libcrypto
X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;p=oss%2Fctypescrypto.git

Added explicit check for CMS functions in libcrypto
---

diff --git a/ctypescrypto/cms.py b/ctypescrypto/cms.py
index 8e856f5..d92b733 100644
--- a/ctypescrypto/cms.py
+++ b/ctypescrypto/cms.py
@@ -17,6 +17,12 @@ from ctypescrypto.bio import Membio
 from ctypescrypto.oid import Oid
 from ctypescrypto.x509 import StackOfX509
 
+# Check for neccesary functionality in libcrypto
+# LibreSSL fails this check
+
+if not hasattr(libcrypto,"CMS_decrypt"):
+    raise OSError("libcrypto lacks CMS functionality. Try using different libcrypto")
+
 class CMSError(LibCryptoError):
     """
     Exception which is raised when error occurs