BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
goppa.c File Reference
#include "goppa.h"
#include <stdlib.h>
#include <bitpunch/math/gf2.h>
#include <bitpunch/math/perm.h>
#include <bitpunch/debugio.h>

Go to the source code of this file.

Functions

int BPU_goppaEncode (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Code_Ctx *ctx)
 BPU_goppaEncode Encode message using goppa code. More...
 
int BPU_goppaDecode (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Code_Ctx *ctx)
 
int BPU_goppaGetError (BPU_T_GF2_Vector *error, const BPU_T_GF2_Vector *encoded, const BPU_T_Code_Ctx *ctx)
 
void BPU_goppaDetSyndrome (BPU_T_GF2_16x_Poly *syndrome, const BPU_T_GF2_Vector *z, const BPU_T_Code_Ctx *ctx)
 BPU_goppaDetSyndrome. More...
 
void BPU_goppaFindPolyAB (BPU_T_GF2_16x_Poly *a, BPU_T_GF2_16x_Poly *b, const BPU_T_GF2_16x_Poly *tau, const BPU_T_GF2_16x_Poly *mod, const BPU_T_Math_Ctx *math_ctx)
 Find polynomials a, b of degree <= (t div 2) More...
 
int BPU_goppaInitMatH2 (BPU_T_GF2_Matrix *h2, BPU_T_GF2_16x_Matrix *hx, const BPU_T_Code_Ctx *ctx)
 BPU_goppaInitMatH2 Initialize control matrix. More...
 
int BPU_goppaGenCode (BPU_T_Code_Ctx *ctx)
 BPU_goppaGenCode Generate random code based on params. More...
 

Function Documentation

int BPU_goppaDecode ( BPU_T_GF2_Vector out,
const BPU_T_GF2_Vector in,
const struct _BPU_T_Code_Ctx ctx 
)

Decode message using Patterson alg.

Parameters
encoded[in]encoded message
decoded[out]decoded message, allocated inside
ctx[out]McEliece context
Returns
still 0

Definition at line 66 of file goppa.c.

void BPU_goppaDetSyndrome ( BPU_T_GF2_16x_Poly syndrome,
const BPU_T_GF2_Vector z,
const BPU_T_Code_Ctx ctx 
)

BPU_goppaDetSyndrome.

Parameters
syndrome
z
ctx

Definition at line 163 of file goppa.c.

int BPU_goppaEncode ( BPU_T_GF2_Vector out,
const BPU_T_GF2_Vector in,
const struct _BPU_T_Code_Ctx ctx 
)

BPU_goppaEncode Encode message using goppa code.

Parameters
out
in
ctx
Returns

Definition at line 32 of file goppa.c.

void BPU_goppaFindPolyAB ( BPU_T_GF2_16x_Poly a,
BPU_T_GF2_16x_Poly b,
const BPU_T_GF2_16x_Poly tau,
const BPU_T_GF2_16x_Poly mod,
const BPU_T_Math_Ctx math_ctx 
)

Find polynomials a, b of degree <= (t div 2)

Find polynomials a, b of degree <= (t div 2). We are using GCD to find them, gcd(tau, mod) = a, so: a = tau * b + mod * (some s***s). Out a and b are allocated inside, after use must be freed using BPU_freePoly().

Parameters
tau[in][description]
mod[in][description]
a[out]polynomial is allocated inside, must be then freed using BPU_freePoly()
b[out]polynomial is allocated inside, must be then freed using BPU_freePoly()
math_ctx[in][description]

Definition at line 194 of file goppa.c.

int BPU_goppaGenCode ( BPU_T_Code_Ctx ctx)

BPU_goppaGenCode Generate random code based on params.

Parameters
ctx
Returns

Definition at line 249 of file goppa.c.

int BPU_goppaGetError ( BPU_T_GF2_Vector error,
const BPU_T_GF2_Vector encoded,
const BPU_T_Code_Ctx ctx 
)

Get error vector Patterson alg.

Parameters
encoded[in]encoded message
decoded[out]decoded message, allocated inside
ctx[out]McEliece context
Returns
still 0

Definition at line 85 of file goppa.c.

int BPU_goppaInitMatH2 ( BPU_T_GF2_Matrix h2,
BPU_T_GF2_16x_Matrix hx,
const BPU_T_Code_Ctx ctx 
)

BPU_goppaInitMatH2 Initialize control matrix.

Parameters
h2
hx
ctx
Returns

Definition at line 206 of file goppa.c.