[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openssl-users
Subject:    Re: [openssl-users] compilation error with openssl-1.1.0 and DH_get0_key
From:       Robert Watson <robert () gillecaluim ! com>
Date:       2018-02-21 17:02:42
Message-ID: CADoG9xnwr30meGAZKcJkDDZuFsT9ZACs8sL1tJtGYSdZYc_-2w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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


[Attachment #5 (text/html)]

<div dir="ltr"><div><div>Thanks for suggestion, don&#39;t understand why the compiler \
didn&#39;t complain about the first argument.   Unfortunately, that just brings out \
other problem....<br></div>code:<br><font size="1">bool \
DHWrapper::CopyPublicKey(uint8_t *pDst, int32_t dstLength) {<br>       if (_pDH == \
NULL) {<br>              FATAL(&quot;DHWrapper not initialized&quot;);<br>            \
return false;<br>       }<br>       BIGNUM *_keyPublic, *_keyPrivate;<br>       \
_keyPublic = BN_new();<br>       _keyPrivate = BN_new();<br>       DH_get0_key( _pDH, \
&amp;_keyPublic, &amp;_keyPrivate );<br>       CopyKey(_keyPublic, pDst, \
dstLength);<br>       return true;<br>}<br></font></div><font size="1"><font \
size="2">Still fails compilation with:<br><font \
size="1">/build/crtmpserver/src/crtmpserver/sources/common/src/utils/misc/crypto.cpp: \
In member function ‘bool DHWrapper::CopyPublicKey(uint8_t*, \
int32_t)':<br>/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]<br>   DH_get0_key( _pDH, &amp;_keyPublic, \
&amp;_keyPrivate );<br>                                         ^~~~~~~~~~~<br>In \
file included from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/misc/crypto.h:26:0,<br> \
from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/iobuffer.h:27,<br> \
from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/buffering.h:23,<br> \
from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/utils.h:23,<br>  \
from /build/crtmpserver/src/crtmpserver/sources/common/include/common.h:25:<br>/usr/include/openssl/dh.h:183:6: \
note:     initializing argument 2 of ‘void DH_get0_key(const DH*, const BIGNUM**, \
const BIGNUM**)'<br>  void DH_get0_key(const DH *dh,<br>           \
^~~~~~~~~~~<br>/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]<br>   DH_get0_key( _pDH, &amp;_keyPublic, \
&amp;_keyPrivate );<br>                                                               \
^~~~~~~~~~~~<br>In file included from \
/build/crtmpserver/src/crtmpserver/sources/common/include/utils/misc/crypto.h:26:0,<br> \
from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/iobuffer.h:27,<br> \
from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/buffering/buffering.h:23,<br> \
from /build/crtmpserver/src/crtmpserver/sources/common/include/utils/utils.h:23,<br>  \
from /build/crtmpserver/src/crtmpserver/sources/common/include/common.h:25:<br>/usr/include/openssl/dh.h:183:6: \
note:     initializing argument 3 of ‘void DH_get0_key(const DH*, const BIGNUM**, \
const BIGNUM**)'<br>  void DH_get0_key(const DH *dh,<br>           \
^~~~~~~~~~~<br>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<br>make[1]: *** [CMakeFiles/Makefile2:231: common/CMakeFiles/common.dir/all] \
Error 2<br>make: *** [Makefile:130: all] Error \
2<br></font><br></font></font><div><br></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">On Wed, Feb 21, 2018 at 8:20 AM, Benjamin Kaduk <span \
dir="ltr">&lt;<a href="mailto:bkaduk@akamai.com" \
target="_blank">bkaduk@akamai.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span class="">
    On 02/21/2018 10:16 AM, Robert Watson wrote:<br>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>I&#39;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.<br>
                <br>
              </div>
              Here&#39;s the code snippet:<br>
              <font size="1">bool DHWrapper::CopyPublicKey(<wbr>uint8_t
                *pDst, int32_t dstLength) {<br>
                       if (_pDH == NULL) {<br>
                              FATAL(&quot;DHWrapper not initialized&quot;);<br>
                              return false;<br>
                       }<br>
                       BIGNUM *_keyPublic,*_keyPrivate;<br>
                       _keyPublic = BN_new();<br>
                       _keyPrivate = BN_new();<br>
                       DH_get0_key( _pDH, *_keyPublic, *_keyPrivate );<br>
              </font></div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    Use &#39;&amp;&#39; instead of &#39;*&#39;<br>
    <br>
    -Ben<span class=""><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div><font size="1">       CopyKey(_keyPublic, pDst,
                dstLength);<br>
                       return true;<br>
                }<br>
                <br>
              </font></div>
            <font size="1"><font size="2">Here&#39;s the compilation error:<br>
                <font \
size="1">/build/crtmpserver/src/<wbr>crtmpserver/sources/common/<wbr>src/utils/misc/crypto.cpp:
  In member function ‘bool
                  DHWrapper::CopyPublicKey(<wbr>uint8_t*, int32_t)':<br>
/build/crtmpserver/src/<wbr>crtmpserver/sources/common/<wbr>src/utils/misc/crypto.cpp:92:<wbr>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**)'<br>
                     DH_get0_key( _pDH, *_keyPublic, *_keyPrivate );<br>
                                                                              <wbr>   \
^<br>  make[2]: ***
                  [common/CMakeFiles/common.dir/<wbr>build.make:591:
common/CMakeFiles/common.dir/<wbr>build/crtmpserver/src/<wbr>crtmpserver/sources/common/<wbr>src/utils/misc/crypto.cpp.o]
  Error 1<br>
                  make[1]: *** [CMakeFiles/Makefile2:231:
                  common/CMakeFiles/common.dir/<wbr>all] Error 2<br>
                  make: *** [Makefile:130: all] Error 2<br>
                  <br>
                </font></font></font></div>
          <font size="1"><font size="2"><font size="1"><font size="2">What
                  am I doing wrong? Thanks,<br>
                </font></font></font></font></div>
        <font size="1"><font size="2"><font size="1"><font size="2">Robert<br>
              </font></font></font></font>
        <div>
          <div><font size="1"><font size="2"><br>
              </font></font></div>
        </div>
      </div>
      <br>
      <fieldset class="m_-2579466001835046661mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <br>
  </span></div>

</blockquote></div><br></div>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic