post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
 All Data Structures Files Functions Variables Typedefs Macros 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 <stdint.h>
37 
38 
39 typedef struct ntru_params ntru_params;
40 typedef struct string string;
41 
42 
47 struct ntru_params {
52  uint32_t N;
56  uint32_t q;
60  uint32_t p;
61 };
62 
66 struct string {
74  char *ptr;
78  size_t len;
79 };
80 
81 
87 void
88 prints(const string *print_string);
89 
98 void
99 string_delete(string *del_string);
100 
114 void
115 poly_new(fmpz_poly_t new_poly,
116  int const * const c,
117  const size_t len);
118 
125 void
126 poly_delete(fmpz_poly_t poly);
127 
136 void
137 poly_delete_array(fmpz_poly_t **poly_array);
138 
147 void
148 poly_delete_all(fmpz_poly_t poly, ...);
149 
155 void
156 poly_draw(const fmpz_poly_t poly);
157 
164 void
165 poly_draw_pretty(const fmpz_poly_t poly);
166 
174 string *
175 read_file(char const * const filename);
176 
184 void
185 write_file(string const *wstring, char const * const filename);
186 
187 
188 #endif /* NTRU_NTRU_H_ */
void string_delete(string *del_string)
Definition: ntru_string.c:47
void poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len)
Definition: ntru_poly.c:110
size_t len
Definition: ntru_string.h:53
void poly_delete_array(fmpz_poly_t **poly_array)
Definition: ntru_poly.c:131
uint32_t N
Definition: ntru_params.h:48
void poly_draw(const fmpz_poly_t poly)
Definition: ntru_poly.c:574
void poly_delete_all(fmpz_poly_t poly,...)
Definition: ntru_poly.c:149
uint32_t p
Definition: ntru_params.h:56
void write_file(string const *wstring, char const *const filename)
Definition: ntru_file.c:107
void prints(const string *print_string)
Definition: ntru_string.c:37
uint32_t q
Definition: ntru_params.h:52
string * read_file(char const *const filename)
Definition: ntru_file.c:50
void poly_delete(fmpz_poly_t poly)
Definition: ntru_poly.c:123
char * ptr
Definition: ntru_string.h:49
void poly_draw_pretty(const fmpz_poly_t poly)
Definition: ntru_poly.c:583