aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py2
-rw-r--r--src/cryptography/hazmat/bindings/openssl/dh.py4
-rw-r--r--src/cryptography/hazmat/bindings/openssl/err.py5
3 files changed, 11 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index de653032..27d5e353 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -320,6 +320,7 @@ class Backend(object):
)
def _bn_to_int(self, bn):
+ assert bn != self._ffi.NULL
if six.PY3:
# Python 3 has constant time from_bytes, so use that.
@@ -346,6 +347,7 @@ class Backend(object):
ownership of the object). Be sure to register it for GC if it will
be discarded after use.
"""
+ assert bn is None or bn != self._ffi.NULL
if bn is None:
bn = self._ffi.NULL
diff --git a/src/cryptography/hazmat/bindings/openssl/dh.py b/src/cryptography/hazmat/bindings/openssl/dh.py
index 06ac6f41..b66e7196 100644
--- a/src/cryptography/hazmat/bindings/openssl/dh.py
+++ b/src/cryptography/hazmat/bindings/openssl/dh.py
@@ -18,6 +18,9 @@ typedef struct dh_st {
BIGNUM *priv_key;
/* Public DH value g^x */
BIGNUM *pub_key;
+ /* X9.42/RFC 2631 */
+ BIGNUM *q;
+ BIGNUM *j;
...;
} DH;
"""
@@ -28,6 +31,7 @@ void DH_free(DH *);
int DH_size(const DH *);
DH *DH_generate_parameters(int, int, void (*)(int, int, void *), void *);
int DH_check(const DH *, int *);
+int DH_check_pub_key(const DH *, const BIGNUM *, int *);
int DH_generate_key(DH *);
int DH_compute_key(unsigned char *, const BIGNUM *, DH *);
int DH_set_ex_data(DH *, int, void *);
diff --git a/src/cryptography/hazmat/bindings/openssl/err.py b/src/cryptography/hazmat/bindings/openssl/err.py
index ec393c1b..0ee19c9e 100644
--- a/src/cryptography/hazmat/bindings/openssl/err.py
+++ b/src/cryptography/hazmat/bindings/openssl/err.py
@@ -21,6 +21,7 @@ struct ERR_string_data_st {
};
typedef struct ERR_string_data_st ERR_STRING_DATA;
+static const int ERR_LIB_DH;
static const int ERR_LIB_EVP;
static const int ERR_LIB_EC;
static const int ERR_LIB_PEM;
@@ -95,6 +96,10 @@ static const int ASN1_R_UNSUPPORTED_TYPE;
static const int ASN1_R_WRONG_TAG;
static const int ASN1_R_WRONG_TYPE;
+static const int DH_F_COMPUTE_KEY;
+
+static const int DH_R_INVALID_PUBKEY;
+
static const int EVP_F_AES_INIT_KEY;
static const int EVP_F_D2I_PKEY;
static const int EVP_F_DSA_PKEY2PKCS8;