post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
 All Data Structures Files Functions Variables Typedefs Macros 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 
28 #ifndef NTRU_KEYPAIR_H
29 #define NTRU_KEYPAIR_H
30 
31 
32 #include "ntru_params.h"
33 
34 #include <fmpz_poly.h>
35 #include <fmpz.h>
36 #include <stdbool.h>
37 
38 
39 typedef struct keypair keypair;
40 
41 
46 struct keypair {
51  fmpz_poly_t priv;
56  fmpz_poly_t priv_inv;
61  fmpz_poly_t pub;
62 };
63 
64 
77 bool
79  fmpz_poly_t f,
80  fmpz_poly_t g,
81  keypair *pair,
82  ntru_params *params);
83 
91 void
92 export_public_key(char const * const filename,
93  fmpz_poly_t pub,
94  ntru_params *params);
95 
103 void
104 export_priv_key(char const * const filename,
105  fmpz_poly_t priv,
106  ntru_params *params);
107 
114 void
115 import_public_key(char const * const filename,
116  fmpz_poly_t pub,
117  ntru_params *params);
118 
128 void
129 import_priv_key(char const * const filename,
130  fmpz_poly_t priv,
131  fmpz_poly_t priv_inv,
132  ntru_params *params);
133 
141 void
143 
144 
145 #endif /* NTRU_KEYPAIR_H */
void export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
Definition: ntru_keypair.c:96
void import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
Definition: ntru_keypair.c:157
bool ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
Definition: ntru_keypair.c:47
fmpz_poly_t priv_inv
Definition: ntru_keypair.h:56
NTRU parameters.
void import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
Definition: ntru_keypair.c:132
fmpz_poly_t pub
Definition: ntru_keypair.h:61
fmpz_poly_t priv
Definition: ntru_keypair.h:51
void ntru_delete_keypair(keypair *pair)
Definition: ntru_keypair.c:197
void export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params)
Definition: ntru_keypair.c:111