Commit Graph

365 Commits

Author SHA1 Message Date
John M. Schanck
70543bba37 Add sntrup{653,761,857} and ntrulpr{653,761,857}
Exported from SUPERCOP-20200826 using the scripts at:
https://github.com/jschanck/pqclean-package-ntruprime
2020-08-28 20:22:56 -04:00
John M. Schanck
db7fad1232 ntruhrss701/avx2: fix non-PIC call 2020-08-27 11:05:07 -04:00
John M. Schanck
268b62f3ce NTRU: Move crypto_sort_int32.h include to top of sample.c 2020-08-25 07:57:26 -04:00
John M. Schanck
146a3195e9 NTRU: more explicit casts for MS compiler 2020-08-24 10:56:18 -04:00
John M. Schanck
f49d18a75b NTRU: add explicit cast for MS compiler 2020-08-24 10:43:44 -04:00
John M. Schanck
1d26f6a582 Update NTRU and add AVX2 NTRU implementations 2020-08-24 09:47:30 -04:00
John Schanck
4ea4b478ba
Update NTRU (#311)
* Update NTRU

version: https://github.com/jschanck/ntru/tree/485dde03

* Fixed ntruhrss701/clean/Makefile.Microsoft_nmake
2020-08-15 14:26:25 -04:00
Sofía Celi
534e7a1277
Fix overflow in multiplication in Saber 2020-08-11 10:47:55 -05:00
Matthias J. Kannwischer
9fbfb230a9 remove threebears, ledakem, newhope, mqdss, qtesla
NIST announced the Round 3 finalists and alternate candidates today:
https://groups.google.com/a/list.nist.gov/d/msg/pqc-forum/0ieuPB-b8eg/Cl7Ji8TpCwAJ

Some of the schemes in PQClean did not make it to Round 3 and this commit
removes them.
2020-07-23 14:08:09 +08:00
Douglas Stebila
ae1530d192 Fix timing leak in decapsulation.
As identified in: Qian Guo, Thomas Johansson, Alexander Nilsson. A 
key-recovery timing attack on post-quantum primitives using the 
Fujisaki-Okamoto transformation and its application on FrodoKEM. In 
CRYPTO 2020.

Based on 
155c24c3df
2020-06-19 13:15:13 -04:00
Thom Wiggers
f7c7af5155
Merge pull request #297 from PQClean/fix-kyber-meta
Kyber768 and Kyber1024 don't need -maes (see #296)
2020-06-02 09:41:14 +02:00
Ko-
25b15e5791 Fix whitespace to satisfy test_duplicate_consistency 2020-05-29 18:54:15 +02:00
Ko-
bca4250d1f Update KAT values 2020-05-29 18:50:37 +02:00
Ko-
4883f2ce89 Add domain separation to NewHope
NewHope announced a new version of their specification that adds
explicit domain separation. This is a port of
https://github.com/newhopecrypto/newhope/commit/607a9d3
2020-05-29 16:41:41 +02:00
Thom Wiggers
75416c93f0
Kyber768 and Kyber1024 don't need -maes (see #296) 2020-05-29 10:01:44 +02:00
Thom Wiggers
db0d5800c5
Merge pull request #279 from PQClean/ds-aes-keyexp
Split aes*_keyexp up into ecb and ctr variants
2020-04-03 10:00:50 +02:00
Sebastian
33232a0343
HQC submission (#202)
* Sebastian's HQC merge request

* Clean up changes to common infrastructure

* Fix Bitmask macro

It assumed that ``unsigned long`` was 64 bit

* Remove maxlen from nistseedexpander

It's a complicated thing to handle because the value is larger than size_t supports on 32-bit platforms

* Initialize buffers to help linter

* Add Nistseedexpander test

* Resolve UB in gf2x.c

Some of the shifts could be larger than WORD_SIZE_BITS, ie. larger than
the width of uint64_t. This apparently on Intel gets interpreted as the
shift mod 64, but on ARM something else happened.

* Fix Windows complaints

* rename log, exp which appear to be existing functions on MS

* Solve endianness problems

* remove all spaces before ';'

* Fix duplicate consistency

* Fix duplicate consistency

* Fix complaints by MSVC about narrowing int

* Add nistseedexpander.obj to COMMON_OBJECTS_NOPATH

* astyle format util.[ch]

* add util.h to makefile

* Sort includes in util.h

* Fix more Windows MSVC complaints

Co-authored-by: Sebastian Verschoor <sebastian@zeroknowledge.me>
Co-authored-by: Thom Wiggers <thom@thomwiggers.nl>
2020-04-01 13:57:21 +08:00
mergify[bot]
da46a96aca
Merge branch 'master' into fix_ub 2020-03-27 23:13:26 +00:00
Douglas Stebila
ce4bd09860 Use the right AES CTX 2020-03-26 21:11:07 -04:00
Douglas Stebila
585a001fda Split aes*_keyexp up into ecb and ctr variants 2020-03-26 20:18:02 -04:00
Thom Wiggers
35e4b0faa1
fixup! Fix uint8_t to uint16_t upcast in Frodo 2020-03-13 16:30:01 -04:00
Thom Wiggers
5436ec0476
Fix uint8_t to uint16_t upcast in Frodo 2020-03-13 15:58:15 -04:00
Thom Wiggers
85de23bdfe
Fix too-large shift in mceliece*f 2020-03-13 13:27:02 -04:00
Thom Wiggers
ef38541c6e
Clean up SABER 2020-03-13 13:00:57 -04:00
Thom Wiggers
bc86182b93
Fix overflowing mults in NTRUHRSS701 2020-03-09 18:02:44 -04:00
Thom Wiggers
39fa1ccfc7
Fix reduce.c's overflowing multiplication 2020-03-09 17:57:43 -04:00
Matthias J. Kannwischer
85c6605bbf
fix MSVS warning 2020-03-09 15:45:20 -04:00
Matthias J. Kannwischer
de5cda4d7b
Fix NewHope verify
https://github.com/mupq/pqm4/issues/132 repoorted that the NewHope verify function does not actually return 0 or 1, but 0 or -1, which consequenctly breaks the cmov in the FO transform.
This bug was introduced when I integrated this into PQClean.
2020-03-09 15:45:19 -04:00
Thom Wiggers
8c2f5994b9
Fix duplicate consistency 2020-03-03 10:15:57 -05:00
Thom Wiggers
fe4e12308b
Fix memory leaks in LEDAkem 2020-03-03 10:15:56 -05:00
Thom Wiggers
81caa58b57
Fix memory leaks in NewHope 2020-03-03 10:15:56 -05:00
Douglas Stebila
b4de294f68 Fix memory leak in Kyber 2020-02-16 14:55:19 -05:00
Thom Wiggers
65a6a63e08
Put all common primitives on the heap (#266)
* Put AES ctx on the heap

This forces people to use the ``ctx_release`` functions, because otherwise there will be leaks

* Put fips202 on the heap

* Add much more docs for fips202.h

* fixup! Put fips202 on the heap

* Put SHA2 on the heap-supporting API

* Fix clang-tidy warnings

* Fix unreachable free() in falcon

* Fix McEliece8192128f-sse GNU Makefile
2020-02-11 11:15:14 +01:00
Thom Wiggers
7862f7faae
Fix McEliece8192128f makefile 2020-02-11 09:17:55 +01:00
Thom Wiggers
53d50fd751
Fix alignment problems with vectors in McEliece AVX2 and fix McEliece 8192128f (#267)
* Fix alignment problems with vectors

* Fix required CPU flags for McEliece

* Fix McElice8192128f that was missed in #259

* fixup! Fix McElice8192128f that was missed in #259

* Fix initialization
2020-02-07 11:13:59 +01:00
Thom Wiggers
b3f9d4f8d6
Classic McEliece (#259)
* Add McEliece reference implementations

* Add Vec implementations of McEliece

* Add sse implementations

* Add AVX2 implementations

* Get rid of stuff not supported by Mac ABI

* restrict to two cores

* Ditch .data files

* Remove .hidden from all .S files

* speed up duplicate consistency tests by batching

* make cpuinfo more robust

* Hope to stabilize macos cpuinfo without ccache

* Revert "Hope to stabilize macos cpuinfo without ccache"

This reverts commit 6129c3cabe1abbc8b956bc87e902a698e32bf322.

* Just hardcode what's available at travis

* Fixed-size types in api.h

* namespace all header files in mceliece

* Ditch operations.h

* Get rid of static inline functions

* fixup! Ditch operations.h
2020-02-05 13:09:56 +01:00
Leon Botros
f9d192036e
Add ephemeral versions of ThreeBears 2020-01-15 10:43:50 +01:00
Thom Wiggers
e762163478
Don't advertise MacOS support for Kyber-AVX2
In light of #251
2019-11-13 13:27:26 +01:00
Thom Wiggers
bb8ed7af9b
Merge pull request #248 from leonbotros/threebears
Add {Baby,Mama,Papa}Bear reference implementations
2019-11-04 11:45:49 +01:00
Leon Botros
f1511f35b9 use the same compiler flags as other implementations 2019-10-25 19:09:12 +02:00
Leon Botros
5720e25c54 add -Werror 2019-10-25 13:35:23 +02:00
Leon Botros
6a7506f520 move modulus function to source, namespace it 2019-10-25 13:14:25 +02:00
Leon Botros
cbbc9cd18f fix namespacing for mamabear, papabear 2019-10-24 19:35:55 +02:00
Leon Botros
03b4153941 remove empty line, add version 2019-10-24 19:35:55 +02:00
Leon Botros
c53d332090 add ThreeBears 2019-10-24 19:35:55 +02:00
Matthias J. Kannwischer
762706f5fe remove unnecessary if in kyber768
clang-tidy9.0.0 added a new check: bugprone-branch-clone
(https://releases.llvm.org/9.0.0/tools/clang/tools/extra/docs/ReleaseNotes.html)
This doesn't like both branches of an if are the same.
In this case I don't think there is any reason to do this, so I've removed it.
2019-10-23 08:00:26 +02:00
Thom Wiggers
f792b925b4 Enable optimizers on Windows (#244) 2019-10-21 14:23:59 +02:00
Matthias J. Kannwischer
df8cc49670 fix kyber-90s warning if size_t is not 32 bits 2019-10-15 15:20:57 +02:00
Matthias J. Kannwischer
39246b808d fix for big-endian 2019-10-04 13:10:29 +02:00
Matthias J. Kannwischer
9571a3b017 use common aes256_ecb instead of providing local AES implementation 2019-10-04 09:31:16 +02:00
Thom Wiggers
ac1f8cc74d
fixup! Add Kyber90s
Fix CRYPTO_ALGNAME
2019-09-24 08:01:54 +02:00
Thom Wiggers
526a841886
Add Kyber90s 2019-09-24 08:01:54 +02:00
Matthias J. Kannwischer
7d10484030 fix algo names for schemes that are inconsistent with the api.h 2019-09-19 12:44:26 +02:00
Thom Wiggers
f4bd312180 Adds AVX2 variants of Kyber512, Kyber768, Kyber1024 (#225)
* Integrate Kyber-AVX2 into PQClean

* Fix types and formatting in Kyber

* Workaround a valgrind crash

* Remove comment in shuffle.s

* Remove some extraneous truncations

* fixup! Fix types and formatting in Kyber
2019-09-10 11:45:01 +02:00
Leon Botros
9190172f1a fix a bug where error array is allocated way too big 2019-08-27 15:38:34 +02:00
Leon Botros
7dd7223587 more fixed sizes, hopefully fix mscv warnings 2019-08-24 16:40:47 +02:00
Leon Botros
9dd4a4b5da fix requested changes 2019-08-24 15:48:38 +02:00
Leon Botros
823ba3f13b fix msvc complaints #2 2019-08-23 14:21:09 +02:00
Leon Botros
50665606f0 serialize error before hashing 2019-08-23 12:57:17 +02:00
Leon Botros
46145a3183 hopefully fix msvc complaints 2019-08-23 12:41:58 +02:00
Leon Botros
537d2a1ac0 serialize pk/ct 2019-08-23 11:30:02 +02:00
Leon Botros
1fc2f51f82 fix clang-tidy warnings, replace variable-time schoolbook multiplications 2019-08-22 12:59:04 +02:00
Leon Botros
901d53ebe4 constant-time decapsulation/decryption failure 2019-08-21 21:27:53 +02:00
Leon Botros
d3d72f64cc constant-time inverses 2019-08-21 18:54:04 +02:00
Leon Botros
e4a5cc3cf2 add karatsuba + toom-cook-3 without VLAs 2019-08-21 17:31:57 +02:00
Leon Botros
ca898f01bc update implementations to leda v2.1 2019-08-21 14:28:31 +02:00
Thom Wiggers
2108bdcdb5
Make a static global explicitly const 2019-07-18 13:42:37 +02:00
Thom Wiggers
0ed5ba4a30
Merge pull request #192 from PQClean/saber
Add Saber
2019-07-04 15:53:57 +02:00
Matthias J. Kannwischer
756b550ceb add Saber LICENSE 2019-07-01 07:48:17 +02:00
Douglas Stebila
4157e0fbad Add release function for AES key schedule 2019-06-25 09:37:23 -04:00
Matthias J. Kannwischer
acde8afff2 Convert into a list for the Saber parameter sets 2019-06-24 09:18:58 +02:00
Matthias J. Kannwischer
515b04d87b fix warnings 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
931f466937 switch to the polymul from the submission 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
8378132c5e clean up of comments and packing 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
61b36e933b remove wrong cast 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
cc94db88fa fix vs warning 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
6aafbd56f2 add firesaber 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
8539bd8684 add lightsaber 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
15a9e77b4c remove pre-processor conditionals 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
510a7baee8 move header guards to the top 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
ccfe87a4a3 refactoring to make vs more happy 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
03596d4705 another vs warning 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
ef0ad8e752 fix some vs warnings 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
31f9ee52ce add license 2019-06-24 09:14:24 +02:00
Matthias J. Kannwischer
f18e464a68 add Saber 2019-06-24 09:14:00 +02:00
Thom Wiggers
4cea81d15f
Convert principal-submitter into a list
There are schemes, like SABER (#192) that have more than one principal
submitter. Consistency warrants that we turn it into a list for all
schemes and don't do something with allowing either a str or a list:
that would just be very annoying to parse.

Closes #194
2019-06-21 09:30:55 +02:00
Leon
3c733b6691 resolve todo, remove asserts, add duplicate checks and make sure they pass 2019-06-17 14:03:59 +02:00
Leon
e5b9b13160 rename impl to leaktime 2019-06-16 17:01:29 +02:00
Leon
db99d3ec09 more msvc complaints 2019-06-14 16:07:31 +02:00
Leon
e353081cc2 fix msvc warnings 2019-06-14 15:04:30 +02:00
Leon
bf0aca644e avoid global state by including 2nd round threshold in secret key 2019-06-14 14:23:58 +02:00
Leon
5a4b7f24a3 (de)serialization instead of pointer casts 2019-06-12 15:33:20 +02:00
Leon
6811a40527 move implementations of functions to .c files 2019-06-11 22:50:33 +02:00
Leon
9e3f973f56 define a constant for max number of rng bytes, remove unnecessary check 2019-06-11 21:45:39 +02:00
Leon
889a1f1e53 fix mvsc warning 2019-06-11 17:09:28 +02:00
Leon
9c2449387a include stdint in api 2019-06-11 16:50:38 +02:00
Leon
26dad0211d remove unused functions 2019-06-11 16:39:41 +02:00
Leon
98e643e5c7 use size_t for index in aes xof buffer and not for index of digits 2019-06-11 16:20:31 +02:00
Leon
e5da5da9a6 use uint8_t in api 2019-06-11 16:18:21 +02:00
Leon
3caad74525 variable declarations at the beginning, namespace extern variables 2019-06-11 14:21:49 +02:00
Leon
737cb1bb2e add ledakemlt32 2019-06-10 20:42:31 +02:00
leonbotros
4f97fa82b6
Merge pull request #1 from PQClean/master
update fork
2019-06-10 18:56:06 +02:00
Leon
6aafab57ef add ledakemlt52 2019-06-10 18:57:26 +02:00
Leon
c0aa560186 remove commented code, update license 2019-06-07 15:07:22 +02:00
Leon
48912d76ff msvc warning + removing commented code 2019-06-07 13:57:15 +02:00
Leon
e4add57844 more cleaning 2019-06-07 13:40:02 +02:00
Leon
6f31e7e4c2 serialize error_vector before hashing instead of pointer cast 2019-06-07 13:02:25 +02:00
Leon
b320752f2a fix more msvc warnings 2019-05-27 23:58:49 +02:00
Leon
ca6d935bbc fix msvc warnings 2019-05-27 22:48:15 +02:00
Leon
7b9e254a8b fix reading outside buffer 2019-05-27 20:21:05 +02:00
Leon
a7b3aa73b2 fix gcc/clang-tidy warnings, remove preprocessor conditionals 2019-05-27 20:17:53 +02:00
Leon
1680f3f125 add nmake makefile 2019-05-27 19:16:31 +02:00
Leon
cc551546bf cleaning & fixing gcc warnings 2019-05-24 18:38:54 +02:00
Douglas Stebila
9a82706697
Merge pull request #176 from PQClean/frodoopt
Add optimized FrodoKEM
2019-05-22 11:45:20 +02:00
Matthias J. Kannwischer
c7c080568e add opt versions of frodokem976aes, frodokem976shake, frodokem1344aes, frodokem1344shake and the corresponding duplicate checks 2019-05-22 07:42:43 +02:00
Matthias J. Kannwischer
743b28f7a8 make VS compiler happy in matrix_aes.c 2019-05-22 07:31:03 +02:00
Joost Rijneveld
2244735a87
Merge pull request #175 from PQClean/hash_state_struct
Use opaque structs for the hashing API
2019-05-21 17:03:50 +02:00
Matthias J. Kannwischer
901761d88a make VS compiler happy in matrix_shake.c 2019-05-21 16:22:09 +02:00
Matthias J. Kannwischer
57ad79ae3a remove preprocessor conditionals from frodokem640shake 2019-05-21 15:51:56 +02:00
Matthias J. Kannwischer
cf8e4e5179 add optimized frodokem640aes 2019-05-21 15:46:59 +02:00
Matthias J. Kannwischer
7701666093 remove OPENSSL preprocessor conditionals 2019-05-21 15:17:57 +02:00
Matthias J. Kannwischer
081442bb8d use more recent version of the code 2019-05-21 15:15:52 +02:00
Thom Wiggers
199adb8072
Add -Wredundant-decls 2019-05-20 16:12:01 +02:00
Matthias J. Kannwischer
a4906713be use optimized matrix_shake.c for frodokem640shake 2019-05-20 15:12:51 +02:00
Thom Wiggers
98002329ad
Port NewHope to fips202 structs 2019-05-20 10:30:35 +02:00
Thom Wiggers
23e118207d
Port Kyber{512,768,1024} to fips202 ctx struct 2019-05-20 10:23:22 +02:00
Leon
17ea905952 moved license to one license file 2019-05-19 19:52:19 +02:00
Leon
7cbeeaee59 update META.yml 2019-05-19 19:51:36 +02:00
Leon
fcbd6918c2 create api.h 2019-05-19 19:41:03 +02:00
Leon
d02c1879e9 added todo 2019-05-19 19:40:38 +02:00
Leon
b40d53b0d8 added license 2019-05-19 19:39:57 +02:00
Leon
10aa790154 remove this one 2019-05-19 19:16:16 +02:00
Leon
587090e744 renamed to something more appropriate, copied source code, ran astyle 2019-05-19 19:14:46 +02:00
Douglas Stebila
82fdce64a2 Macro for loop length 2019-05-18 11:27:45 +02:00
Matthias J. Kannwischer
3d67b4c1c2 add duplicate consistency checks and remove some comments 2019-05-17 16:10:07 +02:00
Leon
752ff05b52 add folder + META.yml for ledacrypt kem lt for category 1 with n0=2 2019-05-16 15:20:06 +02:00
Matthias J. Kannwischer
0127ba93f5 Add IND-CPA/IND-CCA2 security field to METADATA. add test for it as well (#165) 2019-05-13 11:20:32 -04:00
Matthias J. Kannwischer
6659ba1d9c add IND-CPA/IND-CCA2 flag to newhope 2019-05-13 13:30:01 +02:00
Matthias J. Kannwischer
50b1bf959e Merge branch 'cpaccametadata' into newhope 2019-05-13 13:23:57 +02:00
Matthias J. Kannwischer
1597e62514 add IND-CPA/IND-CCA2 security field to METADATA. add test for it as well 2019-05-13 13:17:41 +02:00
Douglas Stebila
ba04db65d7 Fix wrong security level for FrodoKEM-976-AES
[skip ci]
2019-05-10 14:16:10 -04:00
Matthias J. Kannwischer
75015226a2 add newhope1024cpa 2019-05-08 17:38:41 +02:00
Matthias J. Kannwischer
4f4ed3cc8b add newhope512cpa 2019-05-08 17:33:08 +02:00
Matthias J. Kannwischer
12fafb1bf0 rename newhope1024ccakem -> newhope1024cca 2019-05-08 17:07:57 +02:00
Matthias J. Kannwischer
d879595da3 add newhope512cca 2019-05-08 17:06:55 +02:00
Matthias J. Kannwischer
01b3bde4bd remove testvector hash 2019-05-07 19:40:46 +02:00
Matthias J. Kannwischer
82e53bfdd1 fix MS compiler warnings 2019-05-07 19:40:46 +02:00
Matthias J. Kannwischer
5065f46aa7 add newhope1024ccakem 2019-05-07 19:40:46 +02:00
cryptojedi
56a3715ddc Kyberv2 (#150)
* Replaced round-1 Kyber code with round-2 Kyber code (not yet cleaned/namespaced)

* Namespacing for Kyber

* Some more work on round-2 Kyber (more namespacing)

* Added missing files

* Round-2 Kyber768 now passing all tests under Linux

* Various small tweaks to make MS compiler happy

* Two more tweaks for MS compiler

* Added Kyber512 and Kyber1024 (round-2 versions)

* Making MS compiler happy

* More fixes for MS compiler

* Replaced round-1 Kyber code with round-2 Kyber code (not yet cleaned/namespaced)

* Namespacing for Kyber

* Some more work on round-2 Kyber (more namespacing)

* Added missing files

* Round-2 Kyber768 now passing all tests under Linux

* Various small tweaks to make MS compiler happy

* Two more tweaks for MS compiler

* Added Kyber512 and Kyber1024 (round-2 versions)

* Making MS compiler happy

* More fixes for MS compiler

* Started more cleanup work on Kyber768

* Replaced round-1 Kyber code with round-2 Kyber code (not yet cleaned/namespaced)

* Namespacing for Kyber

* Some more work on round-2 Kyber (more namespacing)

* Added missing files

* Round-2 Kyber768 now passing all tests under Linux

* Various small tweaks to make MS compiler happy

* Two more tweaks for MS compiler

* Added Kyber512 and Kyber1024 (round-2 versions)

* Replaced round-1 Kyber code with round-2 Kyber code (not yet cleaned/namespaced)

* Namespacing for Kyber

* Some more work on round-2 Kyber (more namespacing)

* Added missing files

* Round-2 Kyber768 now passing all tests under Linux

* Various small tweaks to make MS compiler happy

* Two more tweaks for MS compiler

* Added Kyber512 and Kyber1024 (round-2 versions)

* Making MS compiler happy

* Making MS compiler happy

* More fixes for MS compiler

* More fixes for MS compiler

* Started more cleanup work on Kyber768

* Kyber768 passing all tests locally

* Kyber512 passes all tests locally

* Kyber1024 now also passing all tests locally

* Now passing all tests with -Wmissing-prototypes

* Local tests (on Linux) passing again
2019-05-06 14:50:27 +02:00
Douglas Stebila
3494c96e53
Update to latest changes from upstream, fix correctness on MS Visual Studio (#163) 2019-05-05 18:33:34 -04:00