yuchen1024 / Kunlun

A C++ library containing both easy-to-use lower level bigint/ecgroup interfaces and high-level cryptographical schemes/protocols.
75 stars 19 forks source link

undefined reference to `x25519_scalar_mulx' #1

Closed lx-1234 closed 1 year ago

lx-1234 commented 1 year ago

I compile and install openssl 3.0.7 on ubuntu20.04, and ensure the function x25519_scalar_mulx is available

$ nm libcrypto.a | grep x25519_scalar_mulx
00000000000032e0 T x25519_scalar_mulx

But when i compile the project, there is an error

test_mqrpmt_psi.cpp:(.text+0x799f): undefined reference to `x25519_scalar_mulx'

Could you give me some advice to fix it?

yuchen1024 commented 1 year ago

I retest the lib on Linux. I did not encounter the problem you mentioned. Everything goes well.

lx-1234 commented 1 year ago

My openssl version is 3.0.7. I compile and install it as following:

$ ./Configure --prefix=/usr/local/openssl shared enable-ec_nistp_64_gcc_128
$ make install

Then, I compile the lib:

$ cmake .. -DCMAKE_PREFIX_PATH=/usr/local/openssl
$ make

and encounter the problem. Is there something wrong? By the way, I don't know if the following lines should be added to the end of curve25519.hpp:

#ifdef __cplusplus
}
#endif

Thanks for your reply.

yuchen1024 commented 1 year ago

Do you modified the "crypto/ec/curve25519.c" as I documented in the readme.txt?

lx-1234 commented 1 year ago

Yes, I removed "static" of function x25519_scalar_mulx.

lyoiycz commented 1 year ago

I think it is possible that the ${OPENSSL_LIBRARIES} path generated by FIND_PACKAGE (OpenSSL REQUIRED) in CMakeLists.txt is linked to libcrypto.so, not libcrypto.a

lx-1234 commented 1 year ago

I think it is possible that the ${OPENSSL_LIBRARIES} path generated by FIND_PACKAGE (OpenSSL REQUIRED) in CMakeLists.txt is linked to libcrypto.so, not libcrypto.a

It explains. Now it works. Thanks!

yuchen1024 commented 1 year ago

I have updated the compile commands for linux. Hope it works~

On Thu, 26 Jan 2023 at 12:10, czylzx @.***> wrote:

I think it is possible that the ${OPENSSL_LIBRARIES} path generated by FIND_PACKAGE (OpenSSL REQUIRED) in CMakeLists.txt is linked to libcrypto.so, not libcrypto.a

It explains. Now it works. Thanks!

Could you please give me some advice to fix it? Thanks

— Reply to this email directly, view it on GitHub https://github.com/yuchen1024/Kunlun/issues/1#issuecomment-1404544946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMQOCUWOGLKGFQJNQVXOYLWUH2KVANCNFSM6AAAAAAS257A5Y . You are receiving this because you commented.Message ID: @.***>

-- Yu Chen, PhD, Professor https://yuchen1024.github.io School of Cyber Science and Technology, Institute of Information Engineering, Shandong University