post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
 All Data Structures Files Functions Variables Typedefs Pages
ntru.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 FH Bielefeld
3  *
4  * This file is part of a FH Bielefeld project.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21 
30 #ifndef PUBLIC_NTRU_NTRU_H_
31 #define PUBLIC_NTRU_NTRU_H_
32 
33 
34 #include <fmpz_poly.h>
35 #include <fmpz.h>
36 #include <stdbool.h>
37 #include <stdint.h>
38 
39 
40 typedef struct ntru_params ntru_params;
41 typedef struct string string;
42 
43 
48 struct ntru_params {
53  uint32_t N;
57  uint32_t q;
61  uint32_t p;
62 };
63 
67 struct string {
75  char *ptr;
79  size_t len;
80 };
81 
82 
88 void
89 prints(const string *print_string);
90 
99 void
100 string_delete(string *del_string);
101 
113 void
114 poly_new(fmpz_poly_t new_poly,
115  int const * const c,
116  const size_t len);
117 
124 void
125 poly_delete(fmpz_poly_t poly);
126 
135 void
136 poly_delete_array(fmpz_poly_t **poly_array);
137 
146 void
147 poly_delete_all(fmpz_poly_t poly, ...);
148 
154 void
155 poly_draw(const fmpz_poly_t poly);
156 
163 void
164 poly_draw_pretty(const fmpz_poly_t poly);
165 
173 string *
174 read_file(char const * const filename);
175 
184 bool
185 write_file(string const *wstring, char const * const filename);
186 
187 
188 #endif /* NTRU_NTRU_H_ */
void string_delete(string *del_string)
void poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len)
size_t len
Definition: ntru.h:79
char * ptr
Definition: ntru.h:75
void poly_delete_array(fmpz_poly_t **poly_array)
uint32_t N
Definition: ntru.h:53
void poly_draw(const fmpz_poly_t poly)
void poly_delete_all(fmpz_poly_t poly,...)
uint32_t p
Definition: ntru.h:61
bool write_file(string const *wstring, char const *const filename)
void prints(const string *print_string)
Definition: ntru.h:67
uint32_t q
Definition: ntru.h:57
string * read_file(char const *const filename)
void poly_delete(fmpz_poly_t poly)
void poly_draw_pretty(const fmpz_poly_t poly)