Re: compilation error with openssl-1.1.0 and DH_get0_key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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





-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux