post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
|
00001 /* 00002 * Copyright (C) 2014 FH Bielefeld 00003 * 00004 * This file is part of a FH Bielefeld project. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00019 * MA 02110-1301 USA 00020 */ 00021 00028 #ifndef NTRU_KEYPAIR_H 00029 #define NTRU_KEYPAIR_H 00030 00031 00032 #include "ntru_params.h" 00033 00034 #include <fmpz_poly.h> 00035 #include <fmpz.h> 00036 #include <stdbool.h> 00037 00038 00039 typedef struct keypair keypair; 00040 00041 00046 struct keypair { 00051 fmpz_poly_t priv; 00056 fmpz_poly_t priv_inv; 00061 fmpz_poly_t pub; 00062 }; 00063 00064 00077 bool 00078 ntru_create_keypair( 00079 fmpz_poly_t f, 00080 fmpz_poly_t g, 00081 keypair *pair, 00082 ntru_params *params); 00083 00091 void 00092 export_public_key(char const * const filename, 00093 fmpz_poly_t pub, 00094 ntru_params *params); 00095 00103 void 00104 export_priv_key(char const * const filename, 00105 fmpz_poly_t priv, 00106 ntru_params *params); 00107 00114 void 00115 import_public_key(char const * const filename, 00116 fmpz_poly_t pub, 00117 ntru_params *params); 00118 00128 void 00129 import_priv_key(char const * const filename, 00130 fmpz_poly_t priv, 00131 fmpz_poly_t priv_inv, 00132 ntru_params *params); 00133 00141 void 00142 ntru_delete_keypair(keypair *pair); 00143 00144 00145 #endif /* NTRU_KEYPAIR_H */