diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-01-19 07:29:16 -0800 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-01-19 07:29:16 -0800 |
commit | 4577c6b9f09a121710ff0320212083291db19c64 (patch) | |
tree | 6ad76b0e45c818f16c5826f8037f8373f9df114a | |
parent | 489c525c5a42923f70c4bd5e95cb616d086595ad (diff) | |
parent | 259f30dc084d1eebec921b29ade3b37e0da29c19 (diff) | |
download | cryptography-4577c6b9f09a121710ff0320212083291db19c64.tar.gz cryptography-4577c6b9f09a121710ff0320212083291db19c64.tar.bz2 cryptography-4577c6b9f09a121710ff0320212083291db19c64.zip |
Merge pull request #483 from public/struct-insides
Expose the innards of DH and DSA
-rw-r--r-- | cryptography/hazmat/bindings/openssl/bignum.py | 3 | ||||
-rw-r--r-- | cryptography/hazmat/bindings/openssl/dh.py | 8 | ||||
-rw-r--r-- | cryptography/hazmat/bindings/openssl/dsa.py | 9 |
3 files changed, 18 insertions, 2 deletions
diff --git a/cryptography/hazmat/bindings/openssl/bignum.py b/cryptography/hazmat/bindings/openssl/bignum.py index 59efd171..6545f329 100644 --- a/cryptography/hazmat/bindings/openssl/bignum.py +++ b/cryptography/hazmat/bindings/openssl/bignum.py @@ -47,6 +47,9 @@ char *BN_bn2hex(const BIGNUM *); int BN_hex2bn(BIGNUM **, const char *); int BN_dec2bn(BIGNUM **, const char *); +int BN_bn2bin(const BIGNUM *, unsigned char *); +BIGNUM *BN_bin2bn(const unsigned char *, int, BIGNUM *); + int BN_num_bits(const BIGNUM *); """ diff --git a/cryptography/hazmat/bindings/openssl/dh.py b/cryptography/hazmat/bindings/openssl/dh.py index 3c12fbc6..edbe0e39 100644 --- a/cryptography/hazmat/bindings/openssl/dh.py +++ b/cryptography/hazmat/bindings/openssl/dh.py @@ -16,7 +16,13 @@ INCLUDES = """ """ TYPES = """ -typedef ... DH; +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 + ...; +} DH; """ FUNCTIONS = """ diff --git a/cryptography/hazmat/bindings/openssl/dsa.py b/cryptography/hazmat/bindings/openssl/dsa.py index 3b77d7ae..9068e057 100644 --- a/cryptography/hazmat/bindings/openssl/dsa.py +++ b/cryptography/hazmat/bindings/openssl/dsa.py @@ -16,7 +16,14 @@ INCLUDES = """ """ TYPES = """ -typedef ... DSA; +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 + ...; +} DSA; """ FUNCTIONS = """ |