00001 /* 00002 * MCE, the real life implementation of McEliece encryption scheme. 00003 * Copyright Projet SECRET, INRIA, Rocquencourt and Bhaskar Biswas and 00004 * Nicolas Sendrier (Bhaskar.Biswas@inria.fr, Nicolas.Sendrier@inria.fr). 00005 * 00006 * This is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as 00008 * published by the Free Software Foundation; either version 2.1 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * This software 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 software; if not, write to the Free 00018 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00019 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 00020 */ 00021 #ifndef PERTE_H 00022 #define PERTE_H 00023 00024 #include <stdio.h> 00025 #include "arith.h" 00026 00027 typedef struct { 00028 int maximum, deadbits; 00029 } leaf_info_t; 00030 00031 typedef struct precomp { 00032 int m, t, real_m, real_t; 00033 int * offset; 00034 distrib_t ** distrib; 00035 leaf_info_t ** leaf_info; 00036 } precomp_t; 00037 00038 #define precomp_get_distrib(p, m , t) ((p).distrib[m][(t) - (p).offset[m]]) 00039 00040 double binomial_d(int a, int b); 00041 double log_binomial_d(int a, int b); 00042 void clear_precomp(precomp_t p); 00043 void write_precomp(precomp_t p, FILE * output_stream); 00044 precomp_t precomp_build(int m, int t, int reduc); 00045 double dicho_searchmin(precomp_t p, double min_value); 00046 double * dicho_self_info_bounds(precomp_t p); 00047 00048 #endif // PERTE_H