Aggregate 'BIGNUM foo is of an incomplete type and cannot be defined

I tried to compile opendcp but an error occurred.

$ make ... [ 10%] Building CXX object libasdcp/CMakeFiles/opendcp-asdcp.dir/KM_prng.cpp.o /home/jwel/opendcp/libasdcp/KM_prng.cpp: In function 'void Kumu::Gen_FIPS_186_Value(const byte_t*, ui32_t, byte_t*, ui32_t)': /home/jwel/opendcp/libasdcp/KM_prng.cpp:219:10: error: aggregate 'BIGNUM c_2powb' has incomplete type and cannot be defined BIGNUM c_2powb, c_2, c_b; ^~~~~~~ /home/jwel/opendcp/libasdcp/KM_prng.cpp:219:19: error: aggregate 'BIGNUM c_2' has incomplete type and cannot be defined BIGNUM c_2powb, c_2, c_b; ^~~ /home/jwel/opendcp/libasdcp/KM_prng.cpp:219:24: error: aggregate 'BIGNUM c_b' has incomplete type and cannot be defined BIGNUM c_2powb, c_2, c_b; ^~~ /home/jwel/opendcp/libasdcp/KM_prng.cpp:220:19: error: 'BN_init' was not declared in this scope BN_init(&c_2powb); BN_init(&c_2); BN_init(&c_b); ^ /home/jwel/opendcp/libasdcp/KM_prng.cpp:248:14: error: aggregate 'BIGNUM bn_tmp' has incomplete type and cannot be defined BIGNUM bn_tmp, bn_xkey, bn_x_n; ^~~~~~ /home/jwel/opendcp/libasdcp/KM_prng.cpp:248:22: error: aggregate 'BIGNUM bn_xkey' has incomplete type and cannot be defined BIGNUM bn_tmp, bn_xkey, bn_x_n; ^~~~~~~ /home/jwel/opendcp/libasdcp/KM_prng.cpp:248:31: error: aggregate 'BIGNUM bn_x_n' has incomplete type and cannot be defined BIGNUM bn_tmp, bn_xkey, bn_x_n; ^~~~~~ libasdcp/CMakeFiles/opendcp-asdcp.dir/build.make:110: recipe for target 'libasdcp/CMakeFiles/opendcp-asdcp.dir/KM_prng.cpp.o' failed make[2]: *** [libasdcp/CMakeFiles/opendcp-asdcp.dir/KM_prng.cpp.o] Error 1 make[1]: *** [libasdcp/CMakeFiles/opendcp-asdcp.dir/all] Error 2 make: *** [all] Error 2 

It looks like an openssl problem for me, so I tried to check this:

 $ cat testBIGNUM.cpp #include <openssl/bn.h> int main(){ BIGNUM bn; } $ g++ testBIGNUM.cpp testBIGNUM.cpp: In function 'int main()': testBIGNUM.cpp:4:9: error: aggregate 'BIGNUM bn' has incomplete type and cannot be defined BIGNUM bn; ^~ 

my version of openssl is 1.1.0d-2, and I don't know how to fix it.

+5
source share
1 answer

There have been big changes between OpenSSL 1.0.2 and OpenSSL 1.1.0, and they are not fully compatible with the source code. In particular, many data structures that were in the 1.0.2 header files are now opaque. Applications using OpenSSL should make some small changes compatible.

In the case of BIGNUM, you need to do this as follows:

 #include <openssl/bn.h> int main() { BIGNUM *bn; bn = BN_new(); ... BN_free(bn); return 0; } 

In the case of opendcp, probably the answer is to switch to OpenSSL 1.0.2 instead.

+4
source

Source: https://habr.com/ru/post/1264334/


All Articles