Code Monkey home page Code Monkey logo

libgoldilocks's Introduction

OTRv4

Disclaimer

This protocol specification is a draft. It's currently under constant revision
by its team members or by its reviewers: Nik Unger or Ian Goldberg.

This is the protocol specification for Off-the-Record Messaging Protocol version 4.

Funding

The work made hare was partially supported by the NlNet Foundation. Find information here.

Licensing and Use

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

The OTR team does not review implementations or specify which ones are compliant are not. Software implementers are free to implement this specification in any way they choose - under limitations of software licenses if using existing software.

libgoldilocks's People

Contributors

claucece avatar coruus avatar jeannotlapin avatar jmgurney avatar nwilson avatar olabini avatar potatosalad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

libgoldilocks's Issues

Remove code generation

No point in having it, now that we only have one field and curve. And removing it removes a bunch of complexity.

musl-gcc: `goldilocks_gen_tables` is not a statically linked executable when `--enable-static` and `--disable-shared` is passed to `./configure`

Hello.

Due to goldilocks_gen_tables being a dynamically linked executable, it cannot be executed when compiled with musl-gcc:

$ ./configure --enable-static --disable-shared CC=musl-gcc --host amd64 && make -j2

Result:

[...]
libtool: link: musl-gcc -std=c99 -fno-strict-aliasing -pedantic -Wall -Wextra -Werror -Wunreachable-code -Wmissing-declarations -Wunused-function -Wno-overlength-strings -I../src -I../src/include -I../src/public_include -I../src/arch_x86_64 -I../src/include/arch_x86_64 -O2 -maes -ffunction-sections -fdata-sections -fvisibility=hidden -fomit-frame-pointer -fPIC -g -O2 -o goldilocks_gen_tables goldilocks_gen_tables-utils.o goldilocks_gen_tables-goldilocks_gen_tables.o arch_x86_64/goldilocks_gen_tables-f_impl.o goldilocks_gen_tables-f_arithmetic.o goldilocks_gen_tables-f_generic.o goldilocks_gen_tables-goldilocks.o goldilocks_gen_tables-scalar.o 
./goldilocks_gen_tables > GEN/decaf_tables.c || (rm GEN/decaf_tables.c; exit 1)
/bin/sh: ./goldilocks_gen_tables: No such file or directory
make[2]: *** [Makefile:1078: GEN/decaf_tables.c] Error 1
make[2]: Leaving directory '/tmp/libgoldilocks/src'
make[1]: *** [Makefile:419: all-recursive] Error 1
make[1]: Leaving directory '/tmp/libgoldilocks'
make: *** [Makefile:350: all] Error 2

The solution is adding -static to create a statically linked executable instead of a dynamically linked one:

cd src && musl-gcc -static -std=c99 -fno-strict-aliasing -pedantic -Wall -Wextra -Werror -Wunreachable-code -Wmissing-declarations -Wunused-function -Wno-overlength-strings -I../src -I../src/include -I../src/public_include -I../src/arch_x86_64 -I../src/include/arch_x86_64 -O2 -maes -ffunction-sections -fdata-sections -fvisibility=hidden -fomit-frame-pointer -fPIC -g -O2 -o goldilocks_gen_tables goldilocks_gen_tables-utils.o goldilocks_gen_tables-goldilocks_gen_tables.o arch_x86_64/goldilocks_gen_tables-f_impl.o goldilocks_gen_tables-f_arithmetic.o goldilocks_gen_tables-f_generic.o goldilocks_gen_tables-goldilocks.o goldilocks_gen_tables-scalar.o

It seems to be the case that if we append -static, everything seems to work, the executable can be executed (it cannot if we omit -static, ldd shows invalid ELF header), and all tests pass.

The issue arises only when CC is set to musl-gcc. It works with gcc.

I apologize for the long title, I could not come up with a shorter one that summarizes the issue. :/

`make test` fails due to overflow in conversion

Hello.

When I run make test, I get the following:

make test -f ./Makefile.custom                                                                                               
make[1]: Entering directory '/tmp/libgoldilocks'                                                                             
g++ -fno-strict-aliasing -pedantic -Wall -Wextra -Werror -Wunreachable-code -Wmissing-declarations -Wunused-function -Wno-overlength-strings -Isrc -Isrc/include -Isrc/public_include -Isrc/include/arch_x86_64 -Isrc/arch_x86_64 -Os -march=native -ffunction-sections -fdata-sections -fvisibility=hidden -fomit-frame-pointer -fPIC -c -o build/obj/test_goldilocks.o test/test_goldilocks.cxx                                                                              
In file included from src/public_include/goldilocks/point_448.h:16,                                                          
                 from src/public_include/goldilocks/point_448.hxx:33,                                                        
                 from src/public_include/goldilocks/ed448.hxx:22,                                                            
                 from src/public_include/goldilocks.hxx:16,                                                                  
                 from test/test_goldilocks.cxx:12:                                                                           
src/public_include/goldilocks/common.h: In function ‘goldilocks_bool_t goldilocks_successful(goldilocks_error_t)’:           
src/public_include/goldilocks/common.h:97:55: error: overflow in conversion from ‘goldilocks_word_t’ {aka ‘long unsigned int’} to ‘goldilocks_error_t’ changes value from ‘18446744073709551615’ to ‘GOLDILOCKS_SUCCESS’ [-Werror=overflow]                                                                                                                     
   97 |     goldilocks_dword_t w = ((goldilocks_word_t)e) ^  ((goldilocks_word_t)GOLDILOCKS_SUCCESS);                        
      |                                                      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                         
cc1plus: all warnings being treated as errors                                                                                
make[1]: *** [Makefile.custom:168: build/obj/test_goldilocks.o] Error 1                                                      
make[1]: Leaving directory '/tmp/libgoldilocks'                                                                              
make: *** [Makefile:864: test] Error 2
diff --git a/src/public_include/goldilocks/common.h b/src/public_include/goldilocks/common.h
index 927369b..2bf3428 100644
--- a/src/public_include/goldilocks/common.h
+++ b/src/public_include/goldilocks/common.h
@@ -94,7 +94,7 @@ goldilocks_succeed_if(goldilocks_bool_t x) {
 /** Return GOLDILOCKS_TRUE iff x == GOLDILOCKS_SUCCESS */
 static GOLDILOCKS_INLINE goldilocks_bool_t
 goldilocks_successful(goldilocks_error_t e) {
-    goldilocks_dword_t w = ((goldilocks_word_t)e) ^  ((goldilocks_word_t)GOLDILOCKS_SUCCESS);
+    goldilocks_dword_t w = ((goldilocks_word_t)e) ^  GOLDILOCKS_SUCCESS;
     return (w-1)>>GOLDILOCKS_WORD_BITS;
 }

seems to suppress the error (warning) and the tests do pass. Thoughts?

Using commit c8d994098ff9094e3021f1a01e43faa3c6cf6fe4.

Check imagine twist on point_eq

On decaf.c, there seems to be an unreachable case regarding the Imagine Twist flag. This might be something to change on libdecaf too.

Should be reported to Mike Hamburg

Failing to build from git master on Arch Linux

Hi, after noticing recent commit activity I held back reporting broken build failures on Arch Linux for a while, assuming things would sort themselves out. Today I tried another build from latest git at commit d07cb5b. Here are my observations:

...
./goldilocks_gen_tables > GEN/goldilocks_tables.c || (rm GEN/goldilocks_tables.c; exit 1)
/bin/sh: line 1: 104188 Illegal instruction     (core dumped) ./goldilocks_gen_tables > GEN/goldilocks_tables.c
make[2]: *** [Makefile:1333: GEN/goldilocks_tables.c] Error 1
make[2]: Leaving directory '/home/glitsj16/libgoldilocks/src'
make[1]: *** [Makefile:420: all-recursive] Error 1
make[1]: Leaving directory '/home/glitsj16/libgoldilocks'
make: *** [Makefile:351: all] Error 2

OS: Arch Linux

$ pacman -Q gcc make
gcc 9.3.0-1
make 4.3-1

Full build log: https://gist.github.com/glitsj16/67836b5e1c7aac97deeff161500d40c3

Fix "make test"

rc/GENERATED/include/decaf/point_448.hxx: In constructor ‘decaf::Ed448Goldilocks::Point::Point(const decaf::FixedBlock<56>&, bool)’:
../src/GENERATED/include/decaf/point_448.hxx:321:64: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context]
if (GOLDILOCKS_SUCCESS != decode(buffer,allow_identity ? GOLDILOCKS_TRUE : GOLDILOCKS_FALSE)) {
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[FYI] make test fails with gcc 9

Hi, I just noticed that building from git master (6b7851c) throws an error in make test on my Arch Linux box. On another machine running Ubuntu 16.04 LTS it builds fine. So I assume the gcc 9 version from Arch Linux is responsible here.

OS: Arch Linux
$ pacman -Q gcc
gcc 9.2.0-4

Build snippet:

...
gcc -std=c99 -fno-strict-aliasing -pedantic -Wall -Wextra -Werror -Wunreachable-code -Wmissing-declarations -Wunused-function -Wno-overlength-strings   -Isrc -Isrc/include -Isrc/public_include -Isrc/include/arch_x86_64 -Isrc/arch_x86_64 -Os -march=native  -ffunction-sections -fdata-sections -fvisibility=hidden -fomit-frame-pointer -fPIC  -c -o build/obj/f_generic.o src/f_generic.c
In file included from src/public_include/goldilocks/point_448.h:16,
                 from src/public_include/goldilocks/point_448.hxx:33,
                 from src/public_include/goldilocks/ed448.hxx:22,
                 from src/public_include/goldilocks.hxx:16,
                 from test/test_goldilocks.cxx:12:
src/public_include/goldilocks/common.h: In function ‘goldilocks_bool_t goldilocks_successful(goldilocks_error_t)’:
src/public_include/goldilocks/common.h:97:55: error: overflow in conversion from ‘goldilocks_word_t’ {aka ‘long unsigned int’} to ‘goldilocks_error_t’ changes value from ‘18446744073709551615’ to ‘GOLDILOCKS_SUCCESS’ [-Werror=overflow]
   97 |     goldilocks_dword_t w = ((goldilocks_word_t)e) ^  ((goldilocks_word_t)GOLDILOCKS_SUCCESS);
      |                                                      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile.custom:168: build/obj/test_goldilocks.o] Error 1

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.