diff options
author | Matt Caswell <matt@openssl.org> | 2016-04-06 17:49:48 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-04-09 10:10:55 +0100 |
commit | 0aeddcfa61250a6c474c4f8b3533772a63192f1b (patch) | |
tree | d8ac8b14fc1bd8a365d522a0ecf0fc9999c01575 /include | |
parent | b9aec69ace2ae84b2b4494cc49725945805d5a29 (diff) |
Make DH opaque
Move the dh_st structure into an internal header file and provide
relevant accessors for the internal fields.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/openssl/dh.h | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/include/openssl/dh.h b/include/openssl/dh.h index 2e021e235b..c4708c4f68 100644 --- a/include/openssl/dh.h +++ b/include/openssl/dh.h @@ -121,33 +121,6 @@ struct dh_method { BN_GENCB *cb); }; -struct dh_st { - /* - * This first argument is used to pick up errors when a DH is passed - * instead of a EVP_PKEY - */ - int pad; - int version; - BIGNUM *p; - BIGNUM *g; - long length; /* optional */ - BIGNUM *pub_key; /* g^x % p */ - BIGNUM *priv_key; /* x */ - int flags; - BN_MONT_CTX *method_mont_p; - /* Place holders if we want to do X9.42 DH */ - BIGNUM *q; - BIGNUM *j; - unsigned char *seed; - int seedlen; - BIGNUM *counter; - int references; - CRYPTO_EX_DATA ex_data; - const DH_METHOD *meth; - ENGINE *engine; - CRYPTO_RWLOCK *lock; -}; - DECLARE_ASN1_ITEM(DHparams) # define DH_GENERATOR_2 2 @@ -238,6 +211,18 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); # endif +void DH_get0_pqg(const DH *dh, BIGNUM **p, BIGNUM **q, BIGNUM **g); +int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DH_get0_key(const DH *dh, BIGNUM **pub_key, BIGNUM **priv_key); +int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); +void DH_clear_flags(DH *dh, int flags); +int DH_test_flags(const DH *dh, int flags); +void DH_set_flags(DH *dh, int flags); +ENGINE *DH_get0_engine(DH *d); +long DH_get_length(const DH *dh); +int DH_set_length(DH *dh, long length); + + # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) |