简体   繁体   中英

Centos7 “make” build ‘EC_GF2m_simple_method’ was not declared in this scope

When I compile the code I get an error telling me my 'EC_GROUP_set_curve_GF2m' function was not declared in this scope. I've researched the error message and I can't figure out what to do to fix it.

from: github bubichain-v3

My Centos 7 is newly installed and installed software package:

sudo yum install -y automake autoconf libtool g++ libssl-dev cmake libbz2-dev python

Error info:

/home/bubichain-v3/src/utils/ecc_sm2.cpp: In static member function ‘static EC_GROUP* utils::EccSm2::NewGroup(utils::EccSm2::GROUP_TYPE, std::string, std::string, std::string, std::string, std::string, std::string)’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:211:48: error: ‘EC_GF2m_simple_method’ was not declared in this scope
     group = EC_GROUP_new(EC_GF2m_simple_method());
                                                ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp:216:53: error: ‘EC_GROUP_set_curve_GF2m’ was not declared in this scope
     if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) {
                                                     ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp:221:63: error: ‘EC_POINT_set_affine_coordinates_GF2m’ was not declared in this scope
     EC_POINT_set_affine_coordinates_GF2m(group, G, xG, yG, ctx);
                                                               ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp: In static member function ‘static std::string utils::EccSm2::getZA(EC_GROUP*, std::string, const EC_POINT*)’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:255:66: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
    EC_POINT_get_affine_coordinates_GF2m(group, pkey, xA, yA, NULL);
                                                                  ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp:264:62: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
    EC_POINT_get_affine_coordinates_GF2m(group, G, xG, yG, ctx);
                                                              ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp: In member function ‘bool utils::EccSm2::From(std::string)’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:334:71: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
     if (!EC_POINT_get_affine_coordinates_GF2m(group_, pkey_, x, y, ctx)) {
                                                                       ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp: In member function ‘bool utils::EccSm2::NewRandom()’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:376:71: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
     if (!EC_POINT_get_affine_coordinates_GF2m(group_, pkey_, x, y, ctx)) {
                                                                       ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp: In member function ‘std::string utils::EccSm2::Sign(const string&, const string&)’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:473:74: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
      if (!EC_POINT_get_affine_coordinates_GF2m(group_, pt1, x1, NULL, ctx)) {
                                                                          ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp: In static member function ‘static int utils::EccSm2::verify(EC_GROUP*, const string&, const string&, const string&, const string&)’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:586:69: error: ‘EC_POINT_set_affine_coordinates_GF2m’ was not declared in this scope
    EC_POINT_set_affine_coordinates_GF2m(group, pub_key, xp, yp, NULL);
                                                                     ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp:643:73: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
    if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x1, NULL, ctx)) {
                                                                         ^
/home/bubichain-v3/src/utils/ecc_sm2.cpp: In member function ‘std::string utils::EccSm2::GetPublicKey()’:
/home/bubichain-v3/src/utils/ecc_sm2.cpp:698:72: error: ‘EC_POINT_get_affine_coordinates_GF2m’ was not declared in this scope
    EC_POINT_get_affine_coordinates_GF2m(group_, pkey_, bn_x, bn_y, NULL);
                                                                        ^
make[3]: *** [utils/CMakeFiles/bubi_utils.dir/ecc_sm2.cpp.o] Error 1
make[3]: Leaving directory `/home/bubichain-v3/build/linux'
make[2]: *** [utils/CMakeFiles/bubi_utils.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
/usr/bin/cmake -E cmake_progress_report /home/bubichain-v3/build/linux/CMakeFiles 44

This solution is work for me:

Step 1: I assume that your present working directory is the Ruby source directory.

Step 2: Download the patch as shown below:

# wget https://bugs.ruby-lang.org/attachments/download/3707/out.patch

# ls out.patch
out.patch

# find . -name ossl_pkey_ec.c
./ext/openssl/ossl_pkey_ec.c

Step 4: Run the downloaded patch

# patch ./ext/openssl/ossl_pkey_ec.c < out.patch
patching file ./ext/openssl/ossl_pkey_ec.c
Hunk #1 succeeded at 757 (offset -5 lines).
Hunk #2 succeeded at 814 (offset -5 lines).
patching file ./ext/openssl/ossl_pkey_ec.c
Hunk #1 FAILED at 7.
1 out of 1 hunk FAILED -- saving rejects to file ./ext/openssl/ossl_pkey_ec.c.rej

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM