cocos2d/cocos2d-x-3rd-party-libs-bin

openssl: struct dh_st declaration missing for all platforms but win10

Closed this issue · 1 comments

Hi,

I noticed that the openssl dh.h includes are missing the declaration for struct dh_st for all platforms but win10. In include/win10/openssl/dh.h you can find:

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 */

... all other includes (ios, android, linux, mac...) don't have this declaration.

I need the Diffie-Hellman key exchange for my project so it would be nice to have this declared out-of-the-box (without having to recompile for all platforms). Can you please enabled DH for all the remaining platforms?

It seems this is not an issue with the cocos build of openssl. I was using an older version of openssl which exposed the above mentioned structure, however later versions have functions to change p and q... DH_set0_pgq(). I modified my code and it works.

Note that DH keys may use non-standard DH_METHOD implementations, either directly or by the use of ENGINE modules. In some cases (eg. an ENGINE providing support for hardware-embedded keys), these BIGNUM values will not be used by the implementation or may be used for alternative data storage. For this reason, applications should generally avoid using DH structure elements directly and instead use API functions to query or modify keys.

From: https://wiki.openssl.org/index.php/Manual:Dh(3)