00001 // Copyright (C) 2011 CNRS - Ecole Polytechnique - INRIA. 00002 // 00003 // This file is part of TIFA. 00004 // 00005 // TIFA is free software; you can redistribute it and/or modify it under the 00006 // terms of the GNU Lesser General Public License as published by the Free 00007 // Software Foundation; either version 2.1 of the License, or (at your option) 00008 // any later version. 00009 // 00010 // TIFA is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00013 // more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, 00017 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00029 #if !defined(_TIFA_SIQS_POLY_H_) 00030 #define _TIFA_SIQS_POLY_H_ 00031 00032 #include <stdint.h> 00033 #include <stdbool.h> 00034 #include <gmp.h> 00035 00036 #include "exit_codes.h" 00037 #include "array.h" 00038 #include "approx.h" 00039 00040 #ifdef __cplusplus 00041 extern "C" { 00042 #endif 00043 00053 struct struct_siqs_poly_t { 00057 mpz_t a; 00061 mpz_t b; 00065 mpz_t c; 00069 mpz_t n; 00073 uint32_t loga; 00077 uint32_t logb; 00081 uint32_t logc; 00086 approximer_t* approximer; 00090 uint32_array_t *factor_base; 00094 uint32_array_t *sqrtm_pi; 00099 int32_array_t *sol1; 00104 int32_array_t *sol2; 00114 mpz_array_t* Bl; 00119 uint32_t** Bainv2; 00123 uint32_t npolys; 00127 uint32_t polyno; 00131 uint32_t nprimes_in_a; 00135 uint32_t* idx_of_a; 00139 uint32_t nfullpolyinit; 00140 }; 00141 00146 typedef struct struct_siqs_poly_t siqs_poly_t; 00147 00158 siqs_poly_t* alloc_siqs_poly( 00159 mpz_t target_a, 00160 mpz_t n, 00161 uint32_array_t* const factor_base, 00162 uint32_array_t* const sqrtm_pi 00163 ); 00164 00176 void free_siqs_poly(siqs_poly_t* poly); 00177 00189 ecode_t update_polynomial(siqs_poly_t* const poly); 00190 00200 int na_used(siqs_poly_t* const poly); 00201 00202 #ifdef __cplusplus 00203 } 00204 #endif 00205 00206 #endif