aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-02-17 19:25:29 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-02-17 19:25:29 -0800
commitd056f53be7ef9602d370d35e93e7ae88c8b3975c (patch)
tree56a14e0e02ee3b0ae786313a14a8aa083823c443
parent4c0bc035691665710a4da6eb400d4e22fffee4e8 (diff)
parent189bdc397c1c782d6ab1e462df719b943742438c (diff)
downloadcryptography-d056f53be7ef9602d370d35e93e7ae88c8b3975c.tar.gz
cryptography-d056f53be7ef9602d370d35e93e7ae88c8b3975c.tar.bz2
cryptography-d056f53be7ef9602d370d35e93e7ae88c8b3975c.zip
Merge pull request #635 from reaperhulk/openssl-pss-bindings
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..359305c6 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
+static const long Cryptography_HAS_PSS_PADDING = 1;
+#else
// see evp.py for the definition of Cryptography_HAS_PKEY_CTX
+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",
+ ],
}