Граф коммитов

70 Коммитов

Автор SHA1 Сообщение Дата
Jan Beich bfff803062 CI: fix install errors on macOS
Error: nss 3.48 is already installed
To upgrade to 3.52, run `brew upgrade nss`.
Error: nspr 4.24 is already installed
To upgrade to 4.25, run `brew upgrade nspr`.
2020-05-21 14:13:47 +02:00
Jan Beich c70dfd6ab2 CI: drop LD_LIBRARY_PATH after 52643cefe6 2020-05-21 14:13:47 +02:00
Jan Beich 244aa016bb CI: drop extra flags on macOS after 854d87d8a1 2020-05-21 14:13:47 +02:00
Jan Beich 19faab7083 Keep using old CK_GCM_PARAMS on NSS >= 3.52
Based on https://hg.mozilla.org/mozilla-central/rev/463069687b3d
2020-05-21 13:34:51 +02:00
Jan Beich 548c33cf6f CI: add FreeBSD job 2020-05-20 16:03:11 +02:00
Jan Beich 72f26f7c89 Add build flags for BSDs
In file included from build/pclient/main.c:9:
include/mprio.h:16:10: fatal error: 'blapit.h' file not found
 #include <blapit.h>
          ^~~~~~~~~~
In file included from build/pclient/main.c:9:
include/mprio.h:17:10: fatal error: 'msgpack.h' file not found
 #include <msgpack.h>
          ^~~~~~~~~~~
ld: error: unable to find library -lnss3
ld: error: unable to find library -lnspr4
ld: error: unable to find library -lmsgpackc
2020-05-20 16:03:11 +02:00
Jan Beich 24c4970e66 Avoid redefining MIN
In file included from build/pclient/main.c:13:
./prio/util.h:17:9: error: 'MIN' macro redefined [-Werror,-Wmacro-redefined]
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
         ^
/usr/include/sys/param.h:308:9: note: previous definition is here
 #define MIN(a,b) (((a)<(b))?(a):(b))
         ^
2020-05-20 16:03:11 +02:00
Robert Helmer 52643cefe6
upgrade Travis CI distro to Ubuntu Bionic (#86) 2020-04-26 12:23:09 -07:00
Henry Corrigan-Gibbs f72b2b2441
Fix serialization bug in `prio/serial.c` (#81)
* In `serial_read_packet_client`, we should check that the type
of the incoming packet matches the type of the `PrioPacketClient`
passed into `serial_read_packet_client` and fail if the two don't
match.

* Add a test for this behavior.

Co-authored-by: Robert Helmer <rhelmer@rhelmer.org>
2020-04-21 10:14:17 -07:00
Christian Holler (:decoder) ed4142ae1c
Fix memory leak in serial_read_packet_client (#80)
* Fix memory leak in serial_read_packet_client

* Fixing more memory leaks in `prio/serial.c`

The `UP_CHECK` macro just returned on failure, rather than
jumping to the `cleanup` label. This commit replaces `UP_CHECK`
with `UP_CHECKC`, which jumps to `cleanup` on failure.

* Replace `P_CHECK` with `P_CHECKC` in prio/serial.c

Every function in `prio/serial.c` has a `cleanup` label, but
much of the code in these functions won't actually jump to
cleanup on failure. As far as I can tell, this doesn't cause
any additional memory leaks, but in case someone adds cleanup
code at the `cleanup` label in the future, it seems prudent to
always jump to `cleanup` on failure.

Co-authored-by: Henry Corrigan-Gibbs <henrycg@csail.mit.edu>
2020-04-21 10:07:56 -07:00
tititiou36 6efb51c538 No need to memset memory allocated with calloc 2020-04-20 08:07:37 +02:00
Gabriel Ganne 9a30c743c0 remove unnecessary runtime call to strlen()
PRIO_TAG is a fixed-size string, we can use sizeof to the same effect.
This also has the nice side-effect of removing a variable-length-array
since AAD_LEN could not be known at compile-time
2019-08-07 09:48:04 -07:00
Anthony Miyaguchi 854d87d8a1 Update SConstruct to modify include path based on sys.platform (#74)
* Format SConstruct with black

* Update SConstruct to modify include path based on OS

* Remove unneeded exports
2019-04-30 14:44:59 -07:00
Henry Corrigan-Gibbs 662191a831 Remove comment in CODE_OF_CONDUCT.md 2019-03-30 08:59:38 -07:00
Mozilla-GitHub-Standards bbca24fded Add Mozilla Code of Conduct file
Fixes #72.

_(Message COC002)_
2019-03-30 08:59:38 -07:00
Henry Corrigan-Gibbs cfecb2cc84 Remove precomputed table of roots (#68) (#69)
* Remove precomputed table of roots (#68)

There is no need to ship the large precomputed table of roots of unity;
it's possible to compute the table on the fly in linear time (in the
table size). This commit:
* removes the table from `prio/params.h`,
* removes the script that generates it (`scripts/gen_params.py`), and
* adds code to generate the table in `prio/config.c`.

* Point Travis to latest version of NSS
2019-03-27 21:34:20 -07:00
Robert Helmer a898b5505d Ensure that early cleanup runs correctly 2019-02-14 15:54:10 -08:00
Robert Helmer 84356e147b
upgrade nss and tighten up error checking (#66)
* upgrade nss and tighten up error checking
2019-02-14 14:35:08 -08:00
Robert Helmer a95cfdd5ea
use `unsigned long long` to support 64-bit ints on 32-bit platforms (#62)
* use  to support 64-bit ints on 32-bit platforms

* Tests and utilitie now use unsigned long long.
2019-01-09 21:47:00 -08:00
Henry Corrigan-Gibbs 981e09efa1 Fix security bug in proof-checking code (#60)
* Add PRG_get_int_range() function

* Fix bug in proof-checking code.

Per Appendix D.2 of the full version of the Prio paper, the servers
should evaluate the polynomials f, g, and h at a random point r in the
set {M+1, ..., modulus-1}, where M is the number of multiplication gates
in the "Valid" circuit. The implementation previously sampled the point
r from the larger set {0, ..., modulus-1}.

* Remove extraneous printf() in test code

* Fixes per clang-format
2019-01-08 22:41:57 -08:00
Robert Helmer 3b3d1b6d4b
bump NSS version to fix travis-CI build (#61) 2019-01-08 22:33:56 -08:00
Henry Corrigan-Gibbs 1f12e2b68d Issue 57 correctly check max input length (#58)
* Issue #57 - Expose maximum number of data fields

- Add PrioConfig_maxDataFields() to public API
- Check that the number of data fields passed in during config
  creation is not too large.

* Test for PrioConfig_maxDataFields()

* Fix formatting per clang-format.
2018-11-07 14:24:04 -08:00
Adeebur Rahman 2c06b4b8d0 issue #43 - add travis-ci integration for osx (#53)
* issue #43 - add travis-ci integration for osx

* opt for using clang-format on linux side only
2018-10-11 21:53:46 -07:00
Henry Corrigan-Gibbs 00c02f9206 Ensure that output does not overflow 2018-10-10 11:24:16 -07:00
Henry Corrigan-Gibbs 2bfea2aaee Functions for import/export of private keys (#51)
* Allow DEBUG mode without sanitizers

Valgrind is incompatible with AddressSanitizer, so it is nice to turn
on DEBUG mode without the sanitizers.

* PrivateKey import/export functions

* Define PT_CHECK*() macros for better test output

When using P_CHECKC(), you get no information about where
or why the test failed. These macros also call `mu_check()`
so that you can more easily figure out what went wrong.

* Fix clang-format issues

* Configure travis to use NSS 3.39

* Update README with new version dependencies.

* Fixes per rhelmer's review

* Fix typos.
* Use (pointer,length)-style arguments for import and export functions.
2018-10-02 12:13:39 -07:00
Henry Corrigan-Gibbs 4923601767 Add contact details for security bugs (#50) 2018-10-01 11:25:29 -07:00
Franziskus Kiefer 934173a113 memory leak in fft_interpolate_raw
This should probably be `MP_CHECKC`. Otherwise this leaks.
(Found by coverity)
2018-09-28 07:34:27 -07:00
Henry Corrigan-Gibbs 8cb93da723 Move `PK11_FreeSlot` below `cleanup` label (#49) 2018-09-26 14:00:12 -07:00
Henry Corrigan-Gibbs 02a81fb652 Remove all variable-length arrays on the stack (#45)
* Remove all variable-length arrays

* Fix indenting
2018-09-24 09:34:53 -07:00
Henry Corrigan-Gibbs 919088a37a Use AddressSanitizer and UBSanitizer in ptest (#46) 2018-09-24 00:49:59 -07:00
Nathan Froyd 2a49189144 make roots data read-only, shareable between processes, and smaller on 64-bit platforms (#38)
* don't clang-format generated roots

The formatted arrays are significantly less readable.

* eliminate the need for RootsInv data

Since RootsInv is essentially Roots stored in reverse order, we don't
need to store an entirely separate array for the inverse roots.  We can
simply iterate over Roots in reverse order to produce the inverse roots.

* make roots data read-only and shareable between processes

The roots of unity are currently stored as:

static const char *Roots[] = { ... };

which is inefficient for two reasons:

1. `Roots` is a writable array, even though we only ever read from it.
2. `Roots` contain pointers, which require run-time relocations.
   These run-time relocations can be at least as large as the entries
   in the array.

The upshot is that `Roots` requires more space than necessary and cannot
be shared between processes.

To fix both of these problems, let's change the storage format to one
long character array, where individual roots are formatted to all be the
same width.  This format enables efficient access to individual roots
and is pointer-free, so no run-time relocations are required.

* Script works with Python3, add one sanity check
2018-09-21 07:54:58 -07:00
Robert Helmer 488da2d729
Linux distros expect NSS headers to not have nss/ prefix on include, … (#40)
* Linux distros expect NSS headers to not have nss/ prefix on include, see https://bugzilla.mozilla.org/show_bug.cgi?id=1491289

* put /usr/include/nss on default path

* make clang-format happy
2018-09-17 14:54:15 -07:00
Robert Helmer 52a3348ea1
This Firefox-specific browser test was moved to a unit test in https://bugzilla.mozilla.org/show_bug.cgi?id=1485620 so we can remove it now (#39) 2018-09-17 11:38:49 -07:00
Robert Helmer 9df5cd22ae change readme to specify linkflags not ldflags
PR #34 changes the way compiler flags are read from the environment, and
SCons seems to want "LINKFLAGS" set in the enviroment instead of
"LDFLAGS" - this was being mapped before.

It's probably not worth re-mapping this, just changing it so what is
specified in the README still works for platforms that need to install
NSS in a weird place (like macOS and Windows) :)
2018-09-11 22:35:21 -07:00
Anthony Miyaguchi 113b69c58d Add CCFLAGS for compiler options 2018-09-10 17:00:02 -07:00
Robert Helmer 02beee180e bug 1465251 - turned out the last histogram I picked was expired :/ I checked and it looks like all the ones we are using now are not expired, and I see active code incrementing them. 2018-09-08 17:20:58 -07:00
Robert Helmer 7bb69953ce per bug 1465251, switch to sync version of PrioEncoder.encode() 2018-09-07 14:42:41 -07:00
Robert Helmer f1087cb6c4 per bug 1465251, switch to using boolean-only histograms 2018-09-06 16:20:07 -07:00
Robert Helmer 3ecb4a074f avoid undefined behavior on platforms where char is signed (which would result in integer overflow before) 2018-08-30 11:43:48 -07:00
Robert Helmer 0500eb04e6
typo fix 2018-08-30 11:41:57 -07:00
Henry Corrigan-Gibbs fb03f0f588
Merge pull request #27 from rhelmer/use-clang-compiler
issue #25 - use clang as the compiler
2018-08-30 11:39:07 -07:00
Robert Helmer d1ab26522d update README to reflect required SCons version 2018-08-30 09:16:24 -07:00
Henry Corrigan-Gibbs 0659704ba4
Merge pull request #29 from rhelmer/libprio-always-builds-debug
scons currently always does a debug build, fix the default and also t…
2018-08-30 08:30:06 -07:00
Robert Helmer 5b9b9fb182 scons currently always does a debug build, fix the default and also the example in the README 2018-08-29 21:51:44 -07:00
Robert Helmer 768dfb9551 issue #25 - use clang as the compiler 2018-08-29 21:21:31 -07:00
Henry Corrigan-Gibbs 91b63f8487 Two small fixes (#28)
* Remove unnecessary debug #define
* Fix formatting in README
2018-08-29 14:18:36 -07:00
Robert Helmer ded8b1054b
issue #25 - format libprio with clang-format, using Mozilla style (#26)
* issue #25 - format libprio with clang-format, using Mozilla style

* force clang 3.9 (latest available on Ubuntu Trusty)

* remove clang-format file, 3.9 is confused by some settings. try using built-in Mozilla style instead
2018-08-29 13:47:18 -07:00
Robert Helmer 4899697586
issue #21 - add minimal travis-ci integration for libprio (#22) 2018-08-27 22:33:13 -07:00
Henry Corrigan-Gibbs af2f8425af
Merge pull request #24 from rhelmer/use-non-locale-dependent-isxdigit-and-toupper
issue #20 - do not use locale-dependent versions of isxdigit and toupper
2018-08-27 21:38:49 -07:00
Henry Corrigan-Gibbs 022985daae Fix formatting nits 2018-08-27 21:37:10 -07:00