From e45e5df37754a74956917a1e9c293e6f5835f885 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 12 Oct 2016 12:31:27 -0400 Subject: [PATCH] openssl 1.1 DSA functions --- Crypto.cpp | 7 ++----- Crypto.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Crypto.cpp b/Crypto.cpp index 885c65f4..94d1c4c6 100644 --- a/Crypto.cpp +++ b/Crypto.cpp @@ -135,11 +135,8 @@ namespace crypto DSA * CreateDSA () { DSA * dsa = DSA_new (); - dsa->p = BN_dup (dsap); - dsa->q = BN_dup (dsaq); - dsa->g = BN_dup (dsag); - dsa->priv_key = NULL; - dsa->pub_key = NULL; + DSA_set0_pqg (dsa, BN_dup (dsap), BN_dup (dsaq), BN_dup (dsag)); + DSA_set0_key (dsa, NULL, NULL); return dsa; } diff --git a/Crypto.h b/Crypto.h index a66f51b7..19ea0a13 100644 --- a/Crypto.h +++ b/Crypto.h @@ -279,6 +279,16 @@ namespace crypto void InitCrypto (bool precomputation); void TerminateCrypto (); + +// take care about openssl version +#include +#if (OPENSSL_VERSION_NUMBER < 0x010100000) // 1.1.0 +// define getters and setters introduced in 1.1.0 +inline int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) { d->p = p; d->q = q; d->g = g; return 1; } +inline int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) { d->pub_key = pub_key; d->priv_key = priv_key; return 1; } + +#endif + } }