poly.h File Reference

#include "gf.h"

Include dependency graph for poly.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  polynome

Defines

#define TRUE   1
#define FALSE   0
#define poly_deg(p)   ((p)->deg)
#define poly_size(p)   ((p)->size)
#define poly_set_deg(p, d)   ((p)->deg = (d))
#define poly_coeff(p, i)   ((p)->coeff[i])
#define poly_set_coeff(p, i, a)   ((p)->coeff[i] = (a))
#define poly_addto_coeff(p, i, a)   ((p)->coeff[i] = gf_add((p)->coeff[i], (a)))
#define poly_multo_coeff(p, i, a)   ((p)->coeff[i] = gf_mul((p)->coeff[i], (a)))
#define poly_tete(p)   ((p)->coeff[(p)->deg])

Typedefs

typedef struct polynomepoly_t

Functions

int poly_calcule_deg (poly_t p)
poly_t poly_alloc (int d)
poly_t poly_alloc_from_string (int d, const unsigned char *s)
poly_t poly_copy (poly_t p)
void poly_free (poly_t p)
void poly_set_to_zero (poly_t p)
void poly_set (poly_t p, poly_t q)
poly_t poly_mul (poly_t p, poly_t q)
void poly_rem (poly_t p, poly_t g)
void poly_sqmod_init (poly_t g, poly_t *sq)
void poly_sqmod (poly_t res, poly_t p, poly_t *sq, int d)
poly_t poly_gcd (poly_t p1, poly_t p2)
poly_t poly_quo (poly_t p, poly_t d)
gf_t poly_eval (poly_t p, gf_t a)
int poly_degppf (poly_t g)
void poly_eeaux (poly_t *u, poly_t *v, poly_t p, poly_t g, int t)
poly_tpoly_syndrome_init (poly_t generator, gf_t *support, int n)
poly_tpoly_sqrtmod_init (poly_t g)
poly_t poly_randgen_irred (int t, int(*u8rnd)())


Define Documentation

#define FALSE   0

Definition at line 33 of file poly.h.

#define poly_addto_coeff ( p,
i,
 )     ((p)->coeff[i] = gf_add((p)->coeff[i], (a)))

#define poly_coeff ( p,
 )     ((p)->coeff[i])

#define poly_deg (  )     ((p)->deg)

#define poly_multo_coeff ( p,
i,
 )     ((p)->coeff[i] = gf_mul((p)->coeff[i], (a)))

Definition at line 42 of file poly.h.

#define poly_set_coeff ( p,
i,
 )     ((p)->coeff[i] = (a))

#define poly_set_deg ( p,
 )     ((p)->deg = (d))

#define poly_size (  )     ((p)->size)

Definition at line 37 of file poly.h.

#define poly_tete (  )     ((p)->coeff[(p)->deg])

Definition at line 43 of file poly.h.

Referenced by poly_rem().

#define TRUE   1

Definition at line 32 of file poly.h.


Typedef Documentation

typedef struct polynome * poly_t


Function Documentation

poly_t poly_alloc ( int  d  ) 

poly_t poly_alloc_from_string ( int  d,
const unsigned char *  s 
)

Definition at line 43 of file poly.c.

References polynome::coeff, polynome::deg, and polynome::size.

Referenced by sk_from_string().

int poly_calcule_deg ( poly_t  p  ) 

poly_t poly_copy ( poly_t  p  ) 

Definition at line 53 of file poly.c.

References polynome::coeff, polynome::deg, and polynome::size.

Referenced by poly_gcd(), and poly_quo().

int poly_degppf ( poly_t  g  ) 

Definition at line 251 of file poly.c.

References gf_extd, gf_unit, poly_addto_coeff, poly_alloc(), poly_calcule_deg(), poly_deg, poly_free(), poly_gcd(), poly_set_coeff, poly_set_deg, poly_sqmod(), and poly_sqmod_init().

Referenced by poly_randgen_irred().

Here is the call graph for this function:

void poly_eeaux ( poly_t u,
poly_t v,
poly_t  p,
poly_t  g,
int  t 
)

Definition at line 299 of file poly.c.

References aux, gf_div, gf_mul_fast, gf_unit, gf_zero, poly_addto_coeff, poly_alloc(), poly_coeff, poly_deg, poly_free(), poly_set(), poly_set_coeff, poly_set_deg, and poly_set_to_zero().

Referenced by decode().

Here is the call graph for this function:

gf_t poly_eval ( poly_t  p,
gf_t  a 
)

Definition at line 125 of file poly.c.

References polynome::coeff, poly_deg, and poly_eval_aux().

Referenced by key_genmat().

Here is the call graph for this function:

void poly_free ( poly_t  p  ) 

poly_t poly_gcd ( poly_t  p1,
poly_t  p2 
)

Definition at line 211 of file poly.c.

References poly_copy(), poly_deg, poly_free(), and poly_gcd_aux().

Referenced by poly_degppf(), and roots_berl_aux().

Here is the call graph for this function:

poly_t poly_mul ( poly_t  p,
poly_t  q 
)

Definition at line 108 of file poly.c.

References gf_mul, poly_addto_coeff, poly_alloc(), poly_calcule_deg(), poly_coeff, and poly_deg.

Here is the call graph for this function:

poly_t poly_quo ( poly_t  p,
poly_t  d 
)

Definition at line 225 of file poly.c.

References gf_inv, gf_mul_fast, gf_zero, poly_addto_coeff, poly_alloc(), poly_calcule_deg(), poly_coeff, poly_copy(), poly_free(), poly_set_coeff, and poly_set_deg.

Referenced by roots_berl_aux().

Here is the call graph for this function:

poly_t poly_randgen_irred ( int  t,
int(*)()  u8rnd 
)

Definition at line 365 of file poly.c.

References g, gf_rand(), gf_unit, poly_alloc(), poly_degppf(), poly_set_coeff, poly_set_deg, and u8rnd().

Referenced by keypair().

Here is the call graph for this function:

void poly_rem ( poly_t  p,
poly_t  g 
)

void poly_set ( poly_t  p,
poly_t  q 
)

Definition at line 83 of file poly.c.

References polynome::coeff, polynome::deg, poly_calcule_deg(), and polynome::size.

Referenced by poly_eeaux(), and poly_sqrtmod_init().

Here is the call graph for this function:

void poly_set_to_zero ( poly_t  p  ) 

Definition at line 69 of file poly.c.

References polynome::coeff, polynome::deg, and polynome::size.

Referenced by poly_eeaux(), poly_sqmod(), poly_sqmod_init(), and poly_sqrtmod_init().

void poly_sqmod ( poly_t  res,
poly_t  p,
poly_t sq,
int  d 
)

Definition at line 176 of file poly.c.

References gf_mul_fast, gf_square, gf_zero, poly_addto_coeff, poly_coeff, poly_deg, poly_set_coeff, poly_set_deg, and poly_set_to_zero().

Referenced by poly_degppf(), poly_sqrtmod_init(), and roots_berl().

Here is the call graph for this function:

void poly_sqmod_init ( poly_t  g,
poly_t sq 
)

Definition at line 151 of file poly.c.

References gf_unit, poly_deg, poly_rem(), poly_set_coeff, poly_set_deg, and poly_set_to_zero().

Referenced by poly_degppf(), poly_sqrtmod_init(), and roots_berl().

Here is the call graph for this function:

poly_t* poly_sqrtmod_init ( poly_t  g  ) 

poly_t* poly_syndrome_init ( poly_t  generator,
gf_t support,
int  n 
)

Definition at line 448 of file poly.c.

References gf_add, gf_div, gf_mul, gf_unit, poly_alloc(), poly_coeff, poly_deg, and poly_set_coeff.

Referenced by keypair().

Here is the call graph for this function:


This work was partially suported by Europian Network of Excellence, ECRYPT; ECRYPT