aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-17 19:41:02 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-17 19:41:02 -0600
commit19ddc8d4122c3b3ef00d9ba8401b7cc2e55fc309 (patch)
treef96f336bd77115f7bc80fd6568cf67c655643f0f
parent4c0bc035691665710a4da6eb400d4e22fffee4e8 (diff)
downloadcryptography-19ddc8d4122c3b3ef00d9ba8401b7cc2e55fc309.tar.gz
cryptography-19ddc8d4122c3b3ef00d9ba8401b7cc2e55fc309.tar.bz2
cryptography-19ddc8d4122c3b3ef00d9ba8401b7cc2e55fc309.zip
conditionally bind PSS constant if available
-rw-r--r--cryptography/hazmat/bindings/openssl/rsa.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/cryptography/hazmat/bindings/openssl/rsa.py b/cryptography/hazmat/bindings/openssl/rsa.py
index b6f7d04c..0644efa6 100644
--- a/cryptography/hazmat/bindings/openssl/rsa.py
+++ b/cryptography/hazmat/bindings/openssl/rsa.py
@@ -33,7 +33,10 @@ static const int RSA_SSLV23_PADDING;
static const int RSA_NO_PADDING;
static const int RSA_PKCS1_OAEP_PADDING;
static const int RSA_X931_PADDING;
+static const int RSA_PKCS1_PSS_PADDING;
static const int RSA_F4;
+
+static const int Cryptography_HAS_PSS_PADDING;
"""
FUNCTIONS = """
@@ -70,10 +73,14 @@ int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *, int);
"""
CUSTOMIZATIONS = """
-#if OPENSSL_VERSION_NUMBER < 0x10000000
+#if OPENSSL_VERSION_NUMBER >= 0x10000000
// see evp.py for the definition of Cryptography_HAS_PKEY_CTX
+static const long Cryptography_HAS_PSS_PADDING = 1;
+# else
+static const long Cryptography_HAS_PSS_PADDING = 0;
int (*EVP_PKEY_CTX_set_rsa_padding)(EVP_PKEY_CTX *, int) = NULL;
int (*EVP_PKEY_CTX_set_rsa_pss_saltlen)(EVP_PKEY_CTX *, int) = NULL;
+static const long RSA_PKCS1_PSS_PADDING = 0;
#endif
"""
@@ -81,5 +88,8 @@ CONDITIONAL_NAMES = {
"Cryptography_HAS_PKEY_CTX": [
"EVP_PKEY_CTX_set_rsa_padding",
"EVP_PKEY_CTX_set_rsa_pss_saltlen",
- ]
+ ],
+ "Cryptography_HAS_PSS_PADDING": [
+ "RSA_PKCS1_PSS_PADDING",
+ ],
}