KnoooW / naclports

Automatically exported from code.google.com/p/naclports
0 stars 0 forks source link

Add libsodium port #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am adding a port for libsodium---version of the original NaCl crypto library. 
It seems to be working, but there are still some issues with it that I'd like 
to clear out before I try to submit it into naclports.

https://github.com/jedisct1/libsodium

http://nacl.cr.yp.to/

I am not sure where to discuss this, bugtracker seems the most appropriate.

1) After ./configure, CFLAGS in the generated Makefile ends up with both 
-fwrapv and -fno-strict-overflow options. clang then complains zillion times 
about -fno-strict-overflow being ignored as unrecognized option. What (if 
anything) should I do about it?

2) In file included from randombytes/sysrandom/randombytes_sysrandom.c:15:
/home/jirka/Bin/nacl_sdk/pepper_31/toolchain/linux_pnacl/usr/include/poll.h:10:1
0: fatal error: 'sdk_util/macros.h' file not found .
Adding CPPFLAGS="-I${NACL_SDK_ROOT}/include" as a parameter to configure script 
solves that, but I feel uneasy about this.

3) Can you recommend me one of the existing ports that I can go through to 
learn the best practices for this?

4) Is it more advantageous to wrap libsodium or directly NaCl (the crypto 
library)?

Original issue reported on code.google.com by jirkadan...@gmail.com on 22 Nov 2013 at 7:00

GoogleCodeExporter commented 9 years ago
Great news.  Can you upload you change with "git cl upload" and send it to
me for review.  I might be able to help more if I can see you changes.

(1)..  not sure.  Our version of clang is pretty recent.  Is 
-fno-strict-overflow a gcc option that clang doesn't understand?  Might need to 
modify configure and/or configure.ac if you want to avoid the warnings.

(2).. This include path should already be added with NACL_CFLAGS and 
NACL_CXXFLAGS
which should be set as CFALGS and CXXFLAGS when running configure.  Are you 
using
the DefaultConfigureStep (if not you should copy the logic from there).

(3).. Have a look at webp for a super simple port, or jpeg or zlib for a 
slightly
more involved one.

(4) I don't know anything about these two libraries so I can't be of much help 
here.

Original comment by sbc@google.com on 22 Nov 2013 at 7:20

GoogleCodeExporter commented 9 years ago
For (1) clang does support -fno-strict-overflow.  However I think that because 
"when -fwrapv is used, there is no difference between -fstrict-overflow and 
-fno-strict-overflow for integers.", Clang warns that -fno-strict-overflow is 
not used when you specify both.  If you specify one of the flags, there is no 
warning.

Original comment by jvo...@google.com on 23 Nov 2013 at 12:12

GoogleCodeExporter commented 9 years ago
Are the warnings due to (1) a problem that I need to solve or is it OK to 
submit it as it is?

Original comment by jirkadan...@gmail.com on 23 Nov 2013 at 11:51

GoogleCodeExporter commented 9 years ago
There is no requirement for the ports to compile without warnings.

Original comment by sbc@chromium.org on 23 Nov 2013 at 6:39

GoogleCodeExporter commented 9 years ago
I uploaded it as https://codereview.chromium.org/84513002/

git cl gave me a bunch of 500 errors and said it failed, but I see it on the 
webpage just fine.
Looks like I am not the first who had this problem 
https://codereview.chromium.org/47573003

Original comment by jirkadan...@gmail.com on 23 Nov 2013 at 7:34

GoogleCodeExporter commented 9 years ago
Added in r1022

Original comment by 374...@mail.muni.cz on 17 Jan 2014 at 10:59