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 
80 bool
82  keypair *pair,
83  const fmpz_poly_t f,
84  const fmpz_poly_t g,
85  const ntru_params *params);
86 
94 void
95 export_public_key(char const * const filename,
96  const fmpz_poly_t pub,
97  const ntru_params *params)
98 
99 
106 void
107 export_priv_key(char const * const filename,
108  const fmpz_poly_t priv,
109  const ntru_params *params)
110 
111 
118 void
119 import_public_key(fmpz_poly_t pub,
120  char const * const filename,
121  const ntru_params *params);
122 
132 void
133 import_priv_key(fmpz_poly_t priv,
134  fmpz_poly_t priv_inv,
135  char const * const filename,
136  const ntru_params *params);
137 
145 void
147 
148 
149 #endif /* PUBLIC_NTRU_KEYPAIR_H_ */
public API, basic data types
void export_public_key(char const *const filename, const fmpz_poly_t pub, const ntru_params *params) void export_priv_key(char const *const filename
void import_priv_key(fmpz_poly_t priv, fmpz_poly_t priv_inv, char const *const filename, 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)
fmpz_poly_t pub
Definition: ntru_keypair.h:64
fmpz_poly_t priv
Definition: ntru_keypair.h:54
void const fmpz_poly_t const ntru_params *params void import_public_key(fmpz_poly_t pub, char const *const filename, const ntru_params *params)
void ntru_delete_keypair(keypair *pair)
void const fmpz_poly_t priv
Definition: ntru_keypair.h:108