post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
Data Structures | Typedefs | Functions
/home/travis/build/hasufell/pqc/include/ntru.h File Reference

public API, basic data types More...

#include <fmpz_poly.h>
#include <fmpz.h>
#include <stdint.h>
Include dependency graph for ntru.h:

Go to the source code of this file.

Data Structures

struct  ntru_params
struct  string

Typedefs

typedef struct ntru_params ntru_params
typedef struct string string

Functions

void prints (const string *print_string)
void string_delete (string *del_string)
void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
void poly_delete (fmpz_poly_t poly)
void poly_delete_array (fmpz_poly_t **poly_array)
void poly_delete_all (fmpz_poly_t poly,...)
void poly_draw (const fmpz_poly_t poly)
void poly_draw_pretty (const fmpz_poly_t poly)
stringread_file (char const *const filename)
void write_file (string const *wstring, char const *const filename)

Detailed Description

public API, basic data types

This file holds the public API of the most basic data types and operations of the pqc NTRU implementation and is meant to be installed on the client system.

Definition in file ntru.h.


Typedef Documentation

typedef struct ntru_params ntru_params

Definition at line 39 of file ntru.h.

typedef struct string string

Definition at line 40 of file ntru.h.


Function Documentation

void poly_delete ( fmpz_poly_t  poly)

This deletes the internal structure of a polynomial, and frees the pointer.

Parameters:
polythe polynomial to delete

Definition at line 123 of file ntru_poly.c.

void poly_delete_all ( fmpz_poly_t  poly,
  ... 
)

This deletes the internal structure of all polynomials, and frees the pointers. You must call this with NULL as last argument!

Parameters:
polythe polynomial to delete
...follow up polynomials

Definition at line 149 of file ntru_poly.c.

void poly_delete_array ( fmpz_poly_t **  poly_array)

Delete the internal structure of a polynomial array which must be NULL terminated. It is expected that poly_array is not on the stack and was obtained by a function like ascii_to_poly().

Parameters:
poly_arraythe polynomial array

Definition at line 131 of file ntru_poly.c.

void poly_draw ( const fmpz_poly_t  poly)

Draws a polynomial to stdout.

Parameters:
polydraw this

Definition at line 574 of file ntru_poly.c.

void poly_draw_pretty ( const fmpz_poly_t  poly)

Draws a polynomial to stdout, in pretty format.

Parameters:
polydraw this

Definition at line 583 of file ntru_poly.c.

void poly_new ( fmpz_poly_t  new_poly,
int const *const  c,
const size_t  len 
)

Initializes and builds a polynomial with the coefficient values of c[] of size len within NTRU parameters and returns a newly allocated polynomial. For an empty polynom, both c and len can be NULL/0.

Parameters:
new_polythe polynomial to initialize and fill with coefficients [out]
carray of polynomial coefficients, can be NULL
lensize of the coefficient array, can be 0
Returns:
newly allocated polynomial pointer, must be freed with fmpz_poly_clear()

Definition at line 110 of file ntru_poly.c.

void prints ( const string print_string)

Prints the given string to stdout.

Parameters:
print_stringthe print to string

Definition at line 37 of file ntru_string.c.

string* read_file ( char const *const  filename)

Reads a file and returns a newly allocated string.

Parameters:
filenamefile to open
Returns:
a newly allocated string which must be freed by the caller or NULL on failure

Reads a file and returns a newly allocated string.

Parameters:
filenamefile to open
Returns:
a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)

Definition at line 50 of file ntru_file.c.

void string_delete ( string del_string)

Delete the inner structure of the string and frees the string itself from the heap. Must not be called on stack variables.

Parameters:
del_stringthe string to delete

Definition at line 47 of file ntru_string.c.

void write_file ( string const *  wstring,
char const *const  filename 
)

Write a string to a file. The file will be pruned or created if it does not exist.

Parameters:
wstringthe string to write to the file
filenamethe name of the file to write to

Write a string to a file. The file will be pruned or created if it does not exist.

Parameters:
wstringthe string to write to the file
filenamethe name of the file to write to
Returns:
true for success or false for failure if fopen or fclose failed

Definition at line 107 of file ntru_file.c.

 All Data Structures Files Functions Variables Typedefs Defines