Compare commits
12 Commits
compressio
...
master
Author | SHA1 | Date | |
---|---|---|---|
e4bdeb1e79 | |||
398edc729d | |||
73a90cc3e9 | |||
a6071c609a | |||
e795cc332d | |||
2e7ff450ef | |||
b8fd0c0559 | |||
187875e9c7 | |||
79b01381b0 | |||
62f5b93039 | |||
02db004332 | |||
c91f469419 |
@ -4,6 +4,7 @@ env:
|
|||||||
global:
|
global:
|
||||||
secure: "BB9eiRNXC1PfNRLEifc0yQQZnM25zqaWNGVWN+atzT+NkxhVKyVr8+DoyPYaa8tOKybuSZhVkKnIiCd8iGMe3v+WyuHKFuhdiwdnEQhxbBlUCb9dDLEexI+J8QiYwC8AW/t6H9LWVwSka0RI3GJujJ8HKIBzW45I/j+1NlUte8U="
|
secure: "BB9eiRNXC1PfNRLEifc0yQQZnM25zqaWNGVWN+atzT+NkxhVKyVr8+DoyPYaa8tOKybuSZhVkKnIiCd8iGMe3v+WyuHKFuhdiwdnEQhxbBlUCb9dDLEexI+J8QiYwC8AW/t6H9LWVwSka0RI3GJujJ8HKIBzW45I/j+1NlUte8U="
|
||||||
before_script:
|
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 install -qq libgmp-dev libmpfr-dev doxygen graphviz cmake libcunit1 libcunit1-dev
|
||||||
- sudo apt-get remove doxygen
|
- sudo apt-get remove doxygen
|
||||||
- wget http://www.flintlib.org/flint-2.4.3.tar.gz
|
- wget http://www.flintlib.org/flint-2.4.3.tar.gz
|
||||||
|
@ -10,12 +10,18 @@ implementation with the primary goal of learning.
|
|||||||
* FLINT (compiled with gmp and mpfr)
|
* FLINT (compiled with gmp and mpfr)
|
||||||
* glib-2.0
|
* glib-2.0
|
||||||
* lz4 (https://code.google.com/p/lz4)
|
* lz4 (https://code.google.com/p/lz4)
|
||||||
|
* cunit (for the tests only)
|
||||||
|
* doxygen (for the documentation only)
|
||||||
* pkgconfig (for the build only)
|
* pkgconfig (for the build only)
|
||||||
|
|
||||||
### Compiling the library
|
### Compiling the library
|
||||||
|
|
||||||
Run ```make``` to build.
|
Run ```make``` to build.
|
||||||
|
|
||||||
|
### Running the tests
|
||||||
|
|
||||||
|
Run ```make check``` to run the test suite.
|
||||||
|
|
||||||
### Installing the library
|
### Installing the library
|
||||||
|
|
||||||
Run ```make install``` to install.
|
Run ```make install``` to install.
|
||||||
|
@ -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="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://developer.gnome.org/glib/stable/">glib-2.0</a>
|
||||||
\* <a href="https://code.google.com/p/lz4">lz4</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)
|
\* <a href="http://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</a> (for the build only)
|
||||||
|
|
||||||
\section install_sec Installation
|
\section install_sec Installation
|
||||||
\* make
|
\* make
|
||||||
|
\* make check (optional, runs the test suite)
|
||||||
\* make install
|
\* make install
|
||||||
|
|
||||||
\section usage Usage
|
\section usage Usage
|
||||||
|
@ -73,11 +73,11 @@ struct keypair {
|
|||||||
* @param pair store private and public components here (the
|
* @param pair store private and public components here (the
|
||||||
* polynomials inside the struct will be automatically
|
* polynomials inside the struct will be automatically
|
||||||
* initialized) [out]
|
* initialized) [out]
|
||||||
* @param f a random polynomial
|
* @param f a random ternary polynomial
|
||||||
* @param g a random polynomial
|
* @param g a random ternary polynomial
|
||||||
* @param params the NTRU context
|
* @param params the NTRU context
|
||||||
* @return true for success, false if f or g are not invertible
|
* @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
|
bool
|
||||||
ntru_create_keypair(
|
ntru_create_keypair(
|
||||||
|
@ -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="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://developer.gnome.org/glib/stable/">glib-2.0</a>
|
||||||
\* <a href="https://code.google.com/p/lz4">lz4</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)
|
\* <a href="http://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</a> (for the build only)
|
||||||
|
|
||||||
\section install_sec Installation
|
\section install_sec Installation
|
||||||
\* make
|
\* make
|
||||||
|
\* make check (optional, runs the test suite)
|
||||||
\* make install
|
\* make install
|
||||||
|
|
||||||
\section usage Usage
|
\section usage Usage
|
||||||
|
@ -70,11 +70,11 @@ struct keypair {
|
|||||||
* @param pair store private and public components here (the
|
* @param pair store private and public components here (the
|
||||||
* polynomials inside the struct will be automatically
|
* polynomials inside the struct will be automatically
|
||||||
* initialized) [out]
|
* initialized) [out]
|
||||||
* @param f a random polynomial
|
* @param f a random ternary polynomial
|
||||||
* @param g a random polynomial
|
* @param g a random ternary polynomial
|
||||||
* @param params the NTRU context
|
* @param params the NTRU context
|
||||||
* @return true for success, false if f or g are not invertible
|
* @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
|
bool
|
||||||
ntru_create_keypair(
|
ntru_create_keypair(
|
||||||
|
@ -509,12 +509,12 @@ poly_inverse_poly_p(fmpz_poly_t Fp,
|
|||||||
|
|
||||||
/* f = f - u * g mod p */
|
/* f = f - u * g mod p */
|
||||||
fmpz_poly_scalar_mul_fmpz(g_tmp, g_tmp, u);
|
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);
|
fmpz_poly_mod_unsigned(f, params->p);
|
||||||
|
|
||||||
/* b = b - u * c mod p */
|
/* b = b - u * c mod p */
|
||||||
fmpz_poly_scalar_mul_fmpz(c_tmp, c_tmp, u);
|
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_poly_mod_unsigned(b, params->p);
|
||||||
|
|
||||||
fmpz_clear(u);
|
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,
|
* Compute the inverse of a polynomial in modulo a power of 2,
|
||||||
* which is q. This is based off the pseudo-code for "Inversion
|
* 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
|
* See NTRU Cryptosystems Tech Report #014 "Almost Inverses
|
||||||
* and Fast NTRU Key Creation."
|
* and Fast NTRU Key Creation."
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
* @brief random polynomials
|
* @brief random polynomials
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "math.h"
|
|
||||||
#include "ntru_err.h"
|
#include "ntru_err.h"
|
||||||
#include "ntru_params.h"
|
#include "ntru_params.h"
|
||||||
#include "ntru_poly.h"
|
#include "ntru_poly.h"
|
||||||
|
@ -44,4 +44,4 @@ clean:
|
|||||||
rm -f *.o ntru_cunit *.orig core test-file.out pub.key
|
rm -f *.o ntru_cunit *.orig core test-file.out pub.key
|
||||||
|
|
||||||
|
|
||||||
.PHONY: check clean test
|
.PHONY: check clean libpqc.a test
|
||||||
|
@ -71,5 +71,5 @@ void test_poly_new2(void)
|
|||||||
|
|
||||||
poly_new(new_poly, NULL, 0);
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user