Compare commits
No commits in common. "master" and "compression" have entirely different histories.
master
...
compressio
@ -4,7 +4,6 @@ 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
|
||||
|
@ -10,18 +10,12 @@ 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.
|
||||
|
@ -32,13 +32,10 @@ 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
|
||||
|
@ -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 ternary polynomial
|
||||
* @param g a random ternary polynomial
|
||||
* @param f a random polynomial
|
||||
* @param g a random polynomial
|
||||
* @param params the NTRU context
|
||||
* @return true for success, false if f or g are not invertible
|
||||
* (then the caller has to try different ones)
|
||||
* (then the caller hast to try different ones)
|
||||
*/
|
||||
bool
|
||||
ntru_create_keypair(
|
||||
|
@ -22,13 +22,10 @@ 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
|
||||
|
@ -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 ternary polynomial
|
||||
* @param g a random ternary polynomial
|
||||
* @param f a random polynomial
|
||||
* @param g a random polynomial
|
||||
* @param params the NTRU context
|
||||
* @return true for success, false if f or g are not invertible
|
||||
* (then the caller has to try different ones)
|
||||
* (then the caller hast to try different ones)
|
||||
*/
|
||||
bool
|
||||
ntru_create_keypair(
|
||||
|
@ -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, f, g_tmp);
|
||||
fmpz_poly_sub(f, g_tmp, f);
|
||||
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, b, c_tmp);
|
||||
fmpz_poly_sub(b, c_tmp, b);
|
||||
fmpz_poly_mod_unsigned(b, params->p);
|
||||
|
||||
fmpz_clear(u);
|
||||
|
@ -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."
|
||||
*
|
||||
|
@ -25,6 +25,7 @@
|
||||
* @brief random polynomials
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "ntru_err.h"
|
||||
#include "ntru_params.h"
|
||||
#include "ntru_poly.h"
|
||||
|
@ -44,4 +44,4 @@ clean:
|
||||
rm -f *.o ntru_cunit *.orig core test-file.out pub.key
|
||||
|
||||
|
||||
.PHONY: check clean libpqc.a test
|
||||
.PHONY: check clean test
|
||||
|
@ -71,5 +71,5 @@ void test_poly_new2(void)
|
||||
|
||||
poly_new(new_poly, NULL, 0);
|
||||
|
||||
CU_ASSERT_EQUAL(fmpz_poly_is_zero(new_poly), 1);
|
||||
CU_ASSERT_PTR_NULL(fmpz_poly_get_coeff_ptr(new_poly, 0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user