aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-01-20 13:38:36 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-01-20 13:38:36 -0600
commit1de55b76b12d7ade3e19f2c8e094695201d1523f (patch)
tree2e4537ec44634106da56a0bf38beab667e480dc4 /cryptography
parent5ab6a208c46f1de6e261646a0ad34482ea755922 (diff)
parentcd10571261ad24dcd0dc63c9703289faccd841a8 (diff)
downloadcryptography-1de55b76b12d7ade3e19f2c8e094695201d1523f.tar.gz
cryptography-1de55b76b12d7ade3e19f2c8e094695201d1523f.tar.bz2
cryptography-1de55b76b12d7ade3e19f2c8e094695201d1523f.zip
Merge branch 'master' into commoncrypto-cipher-backend
* master: expand tox backend example On OS X at build time compile the CC bindings fix docs update docs for name attribute revert fixture decorator for now, switch to append. no more globals docs for explicit backend selection and document name attribute of backend modify backend selection to allow multiple backends via comma delimiter better name for the variable don't mutate _ALL_BACKENDS pass posargs via tox so --backend can be used for tox envs support --backend as a pytest flag to limit to one backend for testing
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/backends/commoncrypto/backend.py6
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py1
-rw-r--r--cryptography/hazmat/bindings/openssl/dh.py12
-rw-r--r--cryptography/hazmat/bindings/openssl/dsa.py15
4 files changed, 23 insertions, 11 deletions
diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py
index cdce5f43..8b9fe084 100644
--- a/cryptography/hazmat/backends/commoncrypto/backend.py
+++ b/cryptography/hazmat/backends/commoncrypto/backend.py
@@ -90,16 +90,18 @@ class Backend(object):
def hash_supported(self, algorithm):
try:
self._hash_mapping[algorithm.name]
- return True
except KeyError:
return False
+ else:
+ return True
def hmac_supported(self, algorithm):
try:
self._supported_hmac_algorithms[algorithm.name]
- return True
except KeyError:
return False
+ else:
+ return True
def create_hash_ctx(self, algorithm):
return _HashContext(self, algorithm)
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 07ee58c1..ee82ba71 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -37,6 +37,7 @@ class Backend(object):
"""
OpenSSL API binding interfaces.
"""
+ name = "openssl"
def __init__(self):
self._binding = Binding()
diff --git a/cryptography/hazmat/bindings/openssl/dh.py b/cryptography/hazmat/bindings/openssl/dh.py
index edbe0e39..ecc62e98 100644
--- a/cryptography/hazmat/bindings/openssl/dh.py
+++ b/cryptography/hazmat/bindings/openssl/dh.py
@@ -17,10 +17,14 @@ INCLUDES = """
TYPES = """
typedef struct dh_st {
- BIGNUM *p; // prime number (shared)
- BIGNUM *g; // generator of Z_p (shared)
- BIGNUM *priv_key; // private DH value x
- BIGNUM *pub_key; // public DH value g^x
+ // prime number (shared)
+ BIGNUM *p;
+ // generator of Z_p (shared)
+ BIGNUM *g;
+ // private DH value x
+ BIGNUM *priv_key;
+ // public DH value g^x
+ BIGNUM *pub_key;
...;
} DH;
"""
diff --git a/cryptography/hazmat/bindings/openssl/dsa.py b/cryptography/hazmat/bindings/openssl/dsa.py
index 9068e057..609a33bf 100644
--- a/cryptography/hazmat/bindings/openssl/dsa.py
+++ b/cryptography/hazmat/bindings/openssl/dsa.py
@@ -17,11 +17,16 @@ INCLUDES = """
TYPES = """
typedef struct dsa_st {
- BIGNUM *p; // prime number (public)
- BIGNUM *q; // 160-bit subprime, q | p-1 (public)
- BIGNUM *g; // generator of subgroup (public)
- BIGNUM *priv_key; // private key x
- BIGNUM *pub_key; // public key y = g^x
+ // prime number (public)
+ BIGNUM *p;
+ // 160-bit subprime, q | p-1 (public)
+ BIGNUM *q;
+ // generator of subgroup (public)
+ BIGNUM *g;
+ // private key x
+ BIGNUM *priv_key;
+ // public key y = g^x
+ BIGNUM *pub_key;
...;
} DSA;
"""