post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
 All Data Structures Files Functions Variables Typedefs Pages
ntru_keypair.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 
31 #ifndef PUBLIC_NTRU_KEYPAIR_H_
32 #define PUBLIC_NTRU_KEYPAIR_H_
33 
34 #include <ntru.h>
35 
36 #include <fmpz_poly.h>
37 #include <fmpz.h>
38 #include <stdbool.h>
39 #include <stdint.h>
40 
41 
42 typedef struct keypair keypair;
43 
44 
49 struct keypair {
54  fmpz_poly_t priv;
59  fmpz_poly_t priv_inv;
64  fmpz_poly_t pub;
65 };
66 
67 
82 bool
84  keypair *pair,
85  const fmpz_poly_t f,
86  const fmpz_poly_t g,
87  const ntru_params *params);
88 
97 bool
98 export_public_key(char const * const filename,
99  const fmpz_poly_t pub,
100  const ntru_params *params);
101 
110 bool
111 export_priv_key(char const * const filename,
112  const fmpz_poly_t priv,
113  const ntru_params *params);
114 
123 bool
124 import_public_key(fmpz_poly_t pub,
125  char const * const filename,
126  const ntru_params *params);
127 
128 
140 bool
141 import_priv_key(fmpz_poly_t priv,
142  fmpz_poly_t priv_inv,
143  char const * const filename,
144  const ntru_params *params);
145 
153 void
155 
156 
157 #endif /* PUBLIC_NTRU_KEYPAIR_H_ */
public API, basic data types
bool export_public_key(char const *const filename, const fmpz_poly_t pub, const ntru_params *params)
fmpz_poly_t priv_inv
Definition: ntru_keypair.h:59
bool ntru_create_keypair(keypair *pair, const fmpz_poly_t f, const fmpz_poly_t g, const ntru_params *params)
bool import_priv_key(fmpz_poly_t priv, fmpz_poly_t priv_inv, char const *const filename, const ntru_params *params)
fmpz_poly_t pub
Definition: ntru_keypair.h:64
fmpz_poly_t priv
Definition: ntru_keypair.h:54
bool import_public_key(fmpz_poly_t pub, char const *const filename, const ntru_params *params)
bool export_priv_key(char const *const filename, const fmpz_poly_t priv, const ntru_params *params)
void ntru_delete_keypair(keypair *pair)