Compare commits

...

12 Commits

Author SHA1 Message Date
e4bdeb1e79
DOC: fix doxygen comments 2014-09-13 18:26:47 +02:00
398edc729d
POLY: fix substraction
Interestingly, the results and tests work with both variants.
However, this one is correct and matches the algorithm given in
NTRU Cryptosystems Tech Report #014.
2014-09-13 18:26:31 +02:00
73a90cc3e9
DOC: minor fixes 2014-06-28 13:11:36 +02:00
a6071c609a
DOC: add doxygen to deps 2014-06-28 13:03:40 +02:00
e795cc332d
RND: rm obsolete include 2014-06-28 02:54:05 +02:00
2e7ff450ef
BUILD: update PHONY
We use libpqc.a from ../src so it isn't expected to be in this
Makefile dir.
2014-06-28 02:13:21 +02:00
b8fd0c0559
DOC: add 'make check' to instructions 2014-06-28 02:09:07 +02:00
187875e9c7
TESTS: properly test for zero-polynomial 2014-06-28 01:27:42 +02:00
79b01381b0
TRAVIS: try to fix make check 2014-06-28 01:21:09 +02:00
62f5b93039
Merge branch 'compression' 2014-06-28 01:06:58 +02:00
02db004332
DOC: random doxygen improvements 2014-06-23 18:17:09 +02:00
c91f469419
DOC: random doxygen improvements 2014-06-23 17:43:12 +02:00
11 changed files with 24 additions and 12 deletions

View File

@ -4,6 +4,7 @@ env:
global:
secure: "BB9eiRNXC1PfNRLEifc0yQQZnM25zqaWNGVWN+atzT+NkxhVKyVr8+DoyPYaa8tOKybuSZhVkKnIiCd8iGMe3v+WyuHKFuhdiwdnEQhxbBlUCb9dDLEexI+J8QiYwC8AW/t6H9LWVwSka0RI3GJujJ8HKIBzW45I/j+1NlUte8U="
before_script:
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/local/lib"
- sudo apt-get install -qq libgmp-dev libmpfr-dev doxygen graphviz cmake libcunit1 libcunit1-dev
- sudo apt-get remove doxygen
- wget http://www.flintlib.org/flint-2.4.3.tar.gz

View File

@ -10,12 +10,18 @@ implementation with the primary goal of learning.
* FLINT (compiled with gmp and mpfr)
* glib-2.0
* lz4 (https://code.google.com/p/lz4)
* cunit (for the tests only)
* doxygen (for the documentation only)
* pkgconfig (for the build only)
### Compiling the library
Run ```make``` to build.
### Running the tests
Run ```make check``` to run the test suite.
### Installing the library
Run ```make install``` to install.

View File

@ -32,10 +32,13 @@ This library was written for Linux systems. Support for windows will not be adde
\* <a href="http://www.flintlib.org">FLINT-2.4.3 or later</a> (compiled with gmp and mpfr)
\* <a href="https://developer.gnome.org/glib/stable/">glib-2.0</a>
\* <a href="https://code.google.com/p/lz4">lz4</a>
\* <a href="http://cunit.sourceforge.net">cunit</a> (for the tests only)
\* <a href="http://www.doxygen.org">doxygen</a> (for the documentation only)
\* <a href="http://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</a> (for the build only)
\section install_sec Installation
\* make
\* make check (optional, runs the test suite)
\* make install
\section usage Usage

View File

@ -73,11 +73,11 @@ struct keypair {
* @param pair store private and public components here (the
* polynomials inside the struct will be automatically
* initialized) [out]
* @param f a random polynomial
* @param g a random polynomial
* @param f a random ternary polynomial
* @param g a random ternary polynomial
* @param params the NTRU context
* @return true for success, false if f or g are not invertible
* (then the caller hast to try different ones)
* (then the caller has to try different ones)
*/
bool
ntru_create_keypair(

View File

@ -22,10 +22,13 @@ This library was written for Linux systems. Support for windows will not be adde
\* <a href="http://www.flintlib.org">FLINT-2.4.3 or later</a> (compiled with gmp and mpfr)
\* <a href="https://developer.gnome.org/glib/stable/">glib-2.0</a>
\* <a href="https://code.google.com/p/lz4">lz4</a>
\* <a href="http://cunit.sourceforge.net">cunit</a> (for the tests only)
\* <a href="http://www.doxygen.org">doxygen</a> (for the documentation only)
\* <a href="http://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</a> (for the build only)
\section install_sec Installation
\* make
\* make check (optional, runs the test suite)
\* make install
\section usage Usage

View File

@ -70,11 +70,11 @@ struct keypair {
* @param pair store private and public components here (the
* polynomials inside the struct will be automatically
* initialized) [out]
* @param f a random polynomial
* @param g a random polynomial
* @param f a random ternary polynomial
* @param g a random ternary polynomial
* @param params the NTRU context
* @return true for success, false if f or g are not invertible
* (then the caller hast to try different ones)
* (then the caller has to try different ones)
*/
bool
ntru_create_keypair(

View File

@ -509,12 +509,12 @@ poly_inverse_poly_p(fmpz_poly_t Fp,
/* f = f - u * g mod p */
fmpz_poly_scalar_mul_fmpz(g_tmp, g_tmp, u);
fmpz_poly_sub(f, g_tmp, f);
fmpz_poly_sub(f, f, g_tmp);
fmpz_poly_mod_unsigned(f, params->p);
/* b = b - u * c mod p */
fmpz_poly_scalar_mul_fmpz(c_tmp, c_tmp, u);
fmpz_poly_sub(b, c_tmp, b);
fmpz_poly_sub(b, b, c_tmp);
fmpz_poly_mod_unsigned(b, params->p);
fmpz_clear(u);

View File

@ -183,7 +183,7 @@ poly_starmultiply(fmpz_poly_t c,
/**
* Compute the inverse of a polynomial in modulo a power of 2,
* which is q. This is based off the pseudo-code for "Inversion
* in (Z/2Z)[X](X^N - 1)" and "Inversion in (Z/p^r Z)[X](X^N - 1)".
* in (Z/2Z)[X]/(X^N - 1)" and "Inversion in (Z/p^r Z)[X](X^N - 1)".
* See NTRU Cryptosystems Tech Report #014 "Almost Inverses
* and Fast NTRU Key Creation."
*

View File

@ -25,7 +25,6 @@
* @brief random polynomials
*/
#include "math.h"
#include "ntru_err.h"
#include "ntru_params.h"
#include "ntru_poly.h"

View File

@ -44,4 +44,4 @@ clean:
rm -f *.o ntru_cunit *.orig core test-file.out pub.key
.PHONY: check clean test
.PHONY: check clean libpqc.a test

View File

@ -71,5 +71,5 @@ void test_poly_new2(void)
poly_new(new_poly, NULL, 0);
CU_ASSERT_PTR_NULL(fmpz_poly_get_coeff_ptr(new_poly, 0));
CU_ASSERT_EQUAL(fmpz_poly_is_zero(new_poly), 1);
}