[openssl-users] compilation error with openssl-1.1.0 and DH_get0_key

Robert Watson robert at gillecaluim.com
Wed Feb 21 17:02:42 UTC 2018


Thanks for suggestion, don't understand why the compiler didn't complain
about the first argument.  Unfortunately, that just brings out other
problem....
code:
bool DHWrapper::CopyPublicKey(uint8_t *pDst, int32_t dstLength) {
    if (_pDH == NULL) {
        FATAL("DHWrapper not initialized");
        return false;
    }
    BIGNUM *_keyPublic, *_keyPrivate;
    _keyPublic = BN_new();
    _keyPrivate = BN_new();
    DH_get0_key( _pDH, &_keyPublic, &_keyPrivate );
    CopyKey(_keyPublic, pDst, dstLength);
    return true;
}
Still fails compilation with:
/build/crtmpserver/src/crtmpserver/sources/common/src/utils/misc/crypto.cpp:
In member function ‘bool DHWrapper::CopyPublicKey(uint8_t*, int32_t)’:
/build/crtmpserver/src/crtmpserver/sources/common/src/utils/misc/crypto.cpp:92:21:
error: invalid conversion from ‘BIGNUM** {aka bignum_st**}’ to ‘const
BIGNUM** {aka const bignum_st**}’ [-fpermissive]
  DH_get0_key( _pDH, &_keyPublic, &_keyPrivate );
                     ^~~~~~~~~~~
In file included from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/misc/crypto.h:26:0,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/iobuffer.h:27,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/buffering.h:23,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/utils.h:23,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/common.h:25:
/usr/include/openssl/dh.h:183:6: note:   initializing argument 2 of ‘void
DH_get0_key(const DH*, const BIGNUM**, const BIGNUM**)’
 void DH_get0_key(const DH *dh,
      ^~~~~~~~~~~
/build/crtmpserver/src/crtmpserver/sources/common/src/utils/misc/crypto.cpp:92:34:
error: invalid conversion from ‘BIGNUM** {aka bignum_st**}’ to ‘const
BIGNUM** {aka const bignum_st**}’ [-fpermissive]
  DH_get0_key( _pDH, &_keyPublic, &_keyPrivate );
                                  ^~~~~~~~~~~~
In file included from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/misc/crypto.h:26:0,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/iobuffer.h:27,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/buffering.h:23,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/utils.h:23,
                 from
/build/crtmpserver/src/crtmpserver/sources/common/include/common.h:25:
/usr/include/openssl/dh.h:183:6: note:   initializing argument 3 of ‘void
DH_get0_key(const DH*, const BIGNUM**, const BIGNUM**)’
 void DH_get0_key(const DH *dh,
      ^~~~~~~~~~~
make[2]: *** [common/CMakeFiles/common.dir/build.make:591:
common/CMakeFiles/common.dir/build/crtmpserver/src/crtmpserver/sources/common/src/utils/misc/crypto.cpp.o]
Error 1
make[1]: *** [CMakeFiles/Makefile2:231: common/CMakeFiles/common.dir/all]
Error 2
make: *** [Makefile:130: all] Error 2



On Wed, Feb 21, 2018 at 8:20 AM, Benjamin Kaduk <bkaduk at akamai.com> wrote:

> On 02/21/2018 10:16 AM, Robert Watson wrote:
>
> I'm trying to update a crypto library for crtmpserver to work with openssl
> 1.1.0.  The software is no longer actively maintained and my c++ skills are
> somewhat rudimentary but I keep getting a compilation error for something
> that seems trivial.
>
> Here's the code snippet:
> bool DHWrapper::CopyPublicKey(uint8_t *pDst, int32_t dstLength) {
>     if (_pDH == NULL) {
>         FATAL("DHWrapper not initialized");
>         return false;
>     }
>     BIGNUM *_keyPublic,*_keyPrivate;
>     _keyPublic = BN_new();
>     _keyPrivate = BN_new();
>     DH_get0_key( _pDH, *_keyPublic, *_keyPrivate );
>
>
> Use '&' instead of '*'
>
> -Ben
>
>     CopyKey(_keyPublic, pDst, dstLength);
>     return true;
> }
>
> Here's the compilation error:
> /build/crtmpserver/src/crtmpserver/sources/common/src/utils/misc/crypto.cpp:
> In member function ‘bool DHWrapper::CopyPublicKey(uint8_t*, int32_t)’:
> /build/crtmpserver/src/crtmpserver/sources/common/
> src/utils/misc/crypto.cpp:92:47: error: cannot convert ‘BIGNUM {aka
> bignum_st}’ to ‘const BIGNUM** {aka const bignum_st**}’ for argument ‘2’ to
> ‘void DH_get0_key(const DH*, const BIGNUM**, const BIGNUM**)’
>   DH_get0_key( _pDH, *_keyPublic, *_keyPrivate );
>                                                ^
> make[2]: *** [common/CMakeFiles/common.dir/build.make:591:
> common/CMakeFiles/common.dir/build/crtmpserver/src/
> crtmpserver/sources/common/src/utils/misc/crypto.cpp.o] Error 1
> make[1]: *** [CMakeFiles/Makefile2:231: common/CMakeFiles/common.dir/all]
> Error 2
> make: *** [Makefile:130: all] Error 2
>
> What am I doing wrong? Thanks,
> Robert
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20180221/5f85be9c/attachment.html>


More information about the openssl-users mailing list