open-quantum-safe / liboqs

C library for prototyping and experimenting with quantum-resistant cryptography
https://openquantumsafe.org/
Other
1.83k stars 447 forks source link

Error running make on master #359

Closed Nouri-Alnahawi closed 6 years ago

Nouri-Alnahawi commented 6 years ago

Hi,

After cloning the repository and building the code with make as shown in the Readme, I get the following error:

vagrant@ubuntu-xenial:/home/Shared_Folder/liboqs$ make /bin/mkdir -p include/oqs cp -f config.h include/oqs cp -f src/oqs.h include/oqs cp -f src/common/common.h include/oqs cp -f src/common/rand.h include/oqs cp -f src/crypto/aes/aes.h include/oqs cp -f src/crypto/rand_urandom_aesctr/rand_urandom_aesctr.h include/oqs cp -f src/crypto/rand_urandom_chacha20/rand_urandom_chacha20.h include/oqs cp -f src/crypto/sha3/sha3.h include/oqs cp -f src/kem/kem.h include/oqs cp -f src/kem/bike/kem_bike.h include/oqs cp -f src/kem/frodokem/kem_frodokem.h include/oqs cp -f src/kem/sike/kem_sike.h include/oqs cp -f src/kex/kex.h include/oqs cp -f src/kex_ntru/kex_ntru.h include/oqs cp -f src/kex_rlwe_newhope/kex_rlwe_newhope.h include/oqs cp -f src/kex_sidh_msr/kex_sidh_msr.h include/oqs cp -f src/sig/sig.h include/oqs cp -f src/sig_picnic/sig_picnic.h include/oqs cp -f src/sig_qtesla/sig_qtesla.h include/oqs cp -pR -f .libs/liboqs.a cp: missing destination file operand after '.libs/liboqs.a' Try 'cp --help' for more information. Makefile:1144: recipe for target 'links' failed make: *** [links] Error 1

I've tried different configurations, and different branches, but I always get the same error. I kind of think I'm missing something here, however I just want to use the library with mc_bits enabled, and that didn'T work as well, so I tried the standard build instead. Same problem.

Thanks in advance

dstebila commented 6 years ago

Can you try the fix I've created on the following branch:

dstebila commented 6 years ago

Resolved by #364.

Nouri-Alnahawi commented 6 years ago

Sorry for the late reply! I've tried it and it definitely did more now than before. I also tried master after your merge and it works fine. Now I still have to try out the mc_bits API with my application. However, I had to run make with sudo, otherwise it fails to rename files. Thanks a ton!

dstebila commented 6 years ago

Can you explain what you mean by "had to run make with sudo, otherwise it fails to rename files"? That shouldn't happen either.

Nouri-Alnahawi commented 6 years ago

Ya sure. Maybe it's because I'm using vagrant, but when calling make without sudo, it fails to rename some files in the process with the message: "permission denied". Unfortunately, I don't have the log anymore, since it worked with sudo afterwards. I will try to replicate the error and post again.

On another note, since you disabled symbolic linkage of the library file, does that mean we don't need to use -l when compiling anymore? Because the gcc linker can't find it anymore.

Cheers

dstebila commented 6 years ago

I'm not familiar with vagrant so I don't really understand what is going on there.

As for compiling with -l, do you mean when you are compiling other applications against liboqs? You'd still need to use -loqs appropriately, and -L to the directory that liboqs.a is located in. (You can use ./configure --prefix=<whatever> and make install to get liboqs.a put a directory of your choice.)

Nouri-Alnahawi commented 6 years ago

Yes. I'm just writing a small C console application in which I use the mc_bits key exchange functions, thus I need a compiled library and the headers from the /include directory. -loqs didn't work first because liboqs.a wasn't linked anymore, but it's working now.

However, here are the errors I received after reproducing the same behavior without sudo. It's a lot of output, so I just posted the error messages...

After autoreconf -i

libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'config'.
libtoolize: copying file 'config/libtool.m4'
libtoolize: copying file 'config/ltoptions.m4'
libtoolize: copying file 'config/ltsugar.m4'
libtoolize: copying file 'config/ltversion.m4'
libtoolize: copying file 'config/lt~obsolete.m4'
configure.ac:6: installing './compile'
configure.ac:6: installing './config.guess'
configure.ac:6: installing './config.sub'
configure.ac:8: installing './install-sh'
configure.ac:8: installing './missing'

After ./configure

checking for suffix of object files... ./configure: line 3626: conftest.c: Protocol error
sed: can't read conftest.c: Protocol error
configure: error: in `/home/Shared_Folder/git/liboqs':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details

config.log

No makefile is generated!

Then sudo ./configure and it works fine.

sudo make

make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Leaving directory '/home/Shared_Folder/git/liboqs'
Making all in tests
make[2]: Entering directory '/home/Shared_Folder/git/liboqs/tests'
make[2]: Warning: File 'Makefile' has modification time 514 s in the future
make[2]: Nothing to be done for 'all'.
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Leaving directory '/home/Shared_Folder/git/liboqs/tests'
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory '/home/Shared_Folder/git/liboqs'
make: warning:  Clock skew detected.  Your build may be incomplete.

makewithout sudo

ar: unable to rename '.libs/librandchacha20.a'; reason: Operation not permitted
Makefile:380: recipe for target 'librandchacha20.la' failed
make[2]: *** [librandchacha20.la] Error 1
make[2]: Leaving directory '/home/Shared_Folder/git/liboqs/src/crypto/rand_urandom_chacha20'
Makefile:673: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/Shared_Folder/git/liboqs'
Makefile:539: recipe for target 'all' failed
make: *** [all] Error 2

I hope this is just the Vagrant VM I'm using...
Nouri-Alnahawi commented 6 years ago

I'm sorry to keep digging stuff, but now I have a problem with libmcbits.a

The linker does find the library file in src/kex_code_mcbits/.libs but the object files in that library are empty! I extracted the content with ar -vx and viewed the .o file withnm,, but there is nothing inside. I checked other .o files and they seemed ok, or at least had some symbols and addresses in them.

Should I start a new issue, or is this something you can reply to here?

Thanks again!

dstebila commented 6 years ago

Hi Nouri, I've asked @smashra to take a look at this and the other issue, he'll follow up with you on here soon.

smashra commented 6 years ago

Hi Nouri,

I have pushed a branch master-fix-mcbits. Please see if that works for you. It requires sodium library. I installed it on my ubuntu machine : sudo apt-get install libsodium-dev

Let me know how it goes.

Sincerely Shravan

On Mon, Sep 10, 2018 at 1:21 PM Douglas Stebila notifications@github.com wrote:

Hi Nouri, I've asked @smashra https://github.com/smashra to take a look at this and the other issue, he'll follow up with you on here soon.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/open-quantum-safe/liboqs/issues/359#issuecomment-419992179, or mute the thread https://github.com/notifications/unsubscribe-auth/ANmJwz7PCc_oFLTxuLmBBqGwgMMD4xdbks5uZp-vgaJpZM4Wa9AT .

dstebila commented 6 years ago

FYI Nouri we are in the process of changing the API we use for these types of primitives, from the "KEX" API to the "KEM" API, both of which are currently present in master, but not with all algorithms. Probably in the next week or two, kex_code_mcbits will be removed, probably to be replaced by a Classic McEliece implementation following the KEM API.

Nouri-Alnahawi commented 6 years ago

Hello Douglas, thank you for the information. I've noticed that McBits was removed from the master branch. Is it now replaced by the classic McEliece? And pardon my silly question, does this mean that it's a separate impl., or will it still be the mcbits original? Thank you again!

dstebila commented 6 years ago

Hi Nouri,

Yes, we'll be replacing it with Classic McEliece, starting from the version of the Classic McEliece code that's part of their NIST submission. I tried to find out from the McBits authors whether they were continuing to update and recommend McBits, but didn't hear anything back, so decided to focus on Classic McEliece going forward.

Nouri-Alnahawi commented 6 years ago

Hi Douglas,

Sounds great! Sorry for starting an off-topic discussion here but do you have a time plan for the implementation? And as far as I know, classic McEliece had some weaknesses against timing attacks, which is why McBits used a Niederreiter variant. Do you have any improvement ideas, or any plans regarding this matter?

dstebila commented 5 years ago

I believe that the implementation of Classic McEliece (the NIST submission) uses some of the techniques from McBits to avoid timing attacks. However I haven't looked into the details yet.