#include <stdlib.h>
#include <string.h>
#include "sizes.h"
#include "gf.h"
#include "poly.h"
#include "dicho.h"
#include "randomize.h"
Go to the source code of this file.
Functions | |
void | sk_from_string (const unsigned char *sk) |
void | sk_free () |
void | xor (unsigned long *a, unsigned long *b) |
poly_t | syndrome (const unsigned char *b) |
int | roots_berl_aux (poly_t sigma, int d, poly_t *tr_aux, poly_t *tr, int e, gf_t *res) |
int | roots_berl (poly_t sigma, gf_t *res) |
int | partition (int *tableau, int gauche, int droite, int pivot) |
void | quickSort (int *tableau, int gauche, int droite, int min, int max) |
int | decode (const unsigned char *b, int *e) |
int | decrypt_block (unsigned char *cleartext, unsigned char *ciphertext, const unsigned char *sk) |
int | decrypt_block_ss (unsigned char *message, unsigned char *ciphertext, const unsigned char *sk) |
Variables | |
precomp_t | cwdata |
poly_t | g |
poly_t | sqrtmod [NB_ERRORS] |
gf_t * | Linv |
unsigned long * | coeffs |
int decode | ( | const unsigned char * | b, | |
int * | e | |||
) |
Definition at line 213 of file decrypt.c.
References aux, EXT_DEGREE, gf_init(), gf_inv, gf_mul_fast, gf_sqrt, gf_square, gf_unit, gf_zero, Linv, NB_ERRORS, poly_addto_coeff, poly_alloc(), poly_calcule_deg(), poly_coeff, poly_deg, poly_eeaux(), poly_free(), poly_set_coeff, quickSort(), roots_berl(), and syndrome().
Referenced by decrypt_block().
int decrypt_block | ( | unsigned char * | cleartext, | |
unsigned char * | ciphertext, | |||
const unsigned char * | sk | |||
) |
Definition at line 292 of file decrypt.c.
References BITS_TO_BYTES, decode(), dicho_cw2b(), DIMENSION, ERROR_SIZE, ERROR_WEIGHT, LOG_LENGTH, NB_ERRORS, sk_free(), and sk_from_string().
Referenced by decrypt_block_ss(), and main().
int decrypt_block_ss | ( | unsigned char * | message, | |
unsigned char * | ciphertext, | |||
const unsigned char * | sk | |||
) |
Definition at line 330 of file decrypt.c.
References CLEARTEXT_LENGTH, decrypt_block(), and unrandomize().
Referenced by main().
int partition | ( | int * | tableau, | |
int | gauche, | |||
int | droite, | |||
int | pivot | |||
) |
void quickSort | ( | int * | tableau, | |
int | gauche, | |||
int | droite, | |||
int | min, | |||
int | max | |||
) |
Definition at line 205 of file decrypt.c.
References partition().
Referenced by decode().
Definition at line 152 of file decrypt.c.
References EXT_DEGREE, gf_unit, NB_ERRORS, poly_addto_coeff, poly_alloc(), poly_calcule_deg(), poly_coeff, poly_free(), poly_set_coeff, poly_set_deg, poly_sqmod(), poly_sqmod_init(), and roots_berl_aux().
Referenced by decode().
Definition at line 109 of file decrypt.c.
References EXT_DEGREE, gf_div, gf_exp, gf_mul, gf_square, NB_ERRORS, poly_addto_coeff, poly_alloc(), poly_calcule_deg(), poly_coeff, poly_deg, poly_free(), poly_gcd(), and poly_quo().
Referenced by roots_berl().
void sk_free | ( | ) |
void sk_from_string | ( | const unsigned char * | sk | ) |
Definition at line 35 of file decrypt.c.
References BITS_TO_LONG, CODIMENSION, coeffs, LENGTH, Linv, NB_ERRORS, poly_alloc_from_string(), and poly_set_deg.
Referenced by decrypt_block().
poly_t syndrome | ( | const unsigned char * | b | ) |
Definition at line 77 of file decrypt.c.
References BIT_SIZE_OF_LONG, BITS_TO_LONG, CODIMENSION, coeffs, EXT_DEGREE, LENGTH, NB_ERRORS, poly_alloc(), poly_calcule_deg(), poly_set_coeff, and xor().
Referenced by decode().
void xor | ( | unsigned long * | a, | |
unsigned long * | b | |||
) |
Definition at line 69 of file decrypt.c.
References BITS_TO_LONG, and CODIMENSION.
Referenced by syndrome().
unsigned long* coeffs |