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 
96 void
97 export_public_key(char const * const filename,
98  const fmpz_poly_t pub,
99  const ntru_params *params)
100 
101 
108 void
109 export_priv_key(char const * const filename,
110  const fmpz_poly_t priv,
111  const ntru_params *params)
112 
113 
120 void
121 import_public_key(fmpz_poly_t pub,
122  char const * const filename,
123  const ntru_params *params);
124 
125 
136 void
137 import_priv_key(fmpz_poly_t priv,
138  fmpz_poly_t priv_inv,
139  char const * const filename,
140  const ntru_params *params);
141 
149 void
151 
152 
153 #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:110