BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
qcmdpc.h File Reference

Go to the source code of this file.

Macros

#define BPU_QCMDPC_PARAM_MAX_ITER   10
 maximum count of iterations in decoding More...
 
#define BPU_QCMDPC_PARAM_DELTA   5
 starting param delta (threshold) for decode1 algorithm More...
 
#define BPU_QCMDPC_PARAM_DELTA_B   0
 threshold for decode2 More...
 
#define BPU_QCMDPC_MAX_B_VALUES   5
 count of precalculated values for decode2 algorithm More...
 

Functions

int BPU_mecsQcmdpcEncode (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Code_Ctx *ctx)
 
int BPU_mecsQcmdpcDecrypt (BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Code_Ctx *ctx)
 
int BPU_mecsQcmdpcDecode1 (BPU_T_GF2_Vector *error_vec, const BPU_T_GF2_Vector *cipher_text, int delta, const struct _BPU_T_Code_Ctx *ctx)
 
int BPU_mecsQcmdpcDecode2 (BPU_T_GF2_Vector *error_vec, const BPU_T_GF2_Vector *cipher_text, const struct _BPU_T_Code_Ctx *ctx)
 
void BPU_mecsQcmdpcCalcSyndrom (BPU_T_GF2_Vector *syndrom, const BPU_T_GF2_Vector *cipher_text, const struct _BPU_T_Code_Ctx *ctx)
 
int BPU_mecsQcmdpcTestGHmatrices (const BPU_T_GF2_QC_Matrix *G, const BPU_T_GF2_Sparse_Qc_Matrix *H)
 
int BPU_mecsQcmdpcGenKeys (BPU_T_Code_Ctx *ctx)
 

Macro Definition Documentation

#define BPU_QCMDPC_MAX_B_VALUES   5

count of precalculated values for decode2 algorithm

Definition at line 40 of file qcmdpc.h.

#define BPU_QCMDPC_PARAM_DELTA   5

starting param delta (threshold) for decode1 algorithm

Definition at line 36 of file qcmdpc.h.

#define BPU_QCMDPC_PARAM_DELTA_B   0

threshold for decode2

Definition at line 39 of file qcmdpc.h.

#define BPU_QCMDPC_PARAM_MAX_ITER   10

maximum count of iterations in decoding

Definition at line 33 of file qcmdpc.h.

Function Documentation

void BPU_mecsQcmdpcCalcSyndrom ( BPU_T_GF2_Vector syndrom,
const BPU_T_GF2_Vector cipher_text,
const struct _BPU_T_Code_Ctx ctx 
)

Calc syndrom of cipher_text.

Parameters
syndromoutput computed syndrom of cipher text
cipher_textcipher text
ctxQC-MDPC McEliece context

Definition at line 231 of file qcmdpc.c.

int BPU_mecsQcmdpcDecode1 ( BPU_T_GF2_Vector error_vec,
const BPU_T_GF2_Vector cipher_text,
int  delta,
const struct _BPU_T_Code_Ctx ctx 
)

Decoding algorithm 1 for QC-MDPC codes capable of correct param_t errors. It has non-zero probability of DECODING FAUILURE RATE (=<0.00000%). Slower than algorithm 2. Better DFR than algorithm 2. Can be parametrized by param_max_iter, param_delta (threshold tolerance value).

Parameters
error_vecoutput error vector
cipher_textinput cipher text
deltaparam delta (threshold tolerance parameter)
ctxQC-MDPC McEliece context
Returns
0 if OK, else error

Definition at line 110 of file qcmdpc.c.

int BPU_mecsQcmdpcDecode2 ( BPU_T_GF2_Vector error_vec,
const BPU_T_GF2_Vector cipher_text,
const struct _BPU_T_Code_Ctx ctx 
)

Decoding algorithm 2 for QC-MDPC codes capable of correct param_t errors. It has non-zero probability of DECODING FAUILURE RATE (=<0.00009%). Faster than algorithm 1. Worse DFR than algorithm 1. Can be parametrized by param_max_iter, param_delta_B (precomputed threshold values).

Parameters
error_vecoutput error vector
cipher_textinput cipher text
ctxQC-MDPC McEliece context
Returns
0 if OK, else error

Definition at line 175 of file qcmdpc.c.

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

McEliece QC-MDPC decrypt

Parameters
outmessage
incipher text
ctxQC-MDPC McEliece context
Returns
0 if OK, else error

Definition at line 65 of file qcmdpc.c.

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

McEliece QC-MDPC encode

Parameters
outcipher text
inmessage
ctxQC-MDPC McEliece context
Returns
0 if OK, else error

Definition at line 23 of file qcmdpc.c.

int BPU_mecsQcmdpcGenKeys ( BPU_T_Code_Ctx ctx)

Generate key pair of QC-MDPC code for McEliece cryptosystem. Generator matrix G is not sparse. Its public key. Parity-check matrix H is in sparse form. Its private key. Params of code are set as global constants in crypto.h header file.

Parameters
ctxQC-MDPC McEliece context
Returns
0 if OK, else error

Definition at line 247 of file qcmdpc.c.

int BPU_mecsQcmdpcTestGHmatrices ( const BPU_T_GF2_QC_Matrix G,
const BPU_T_GF2_Sparse_Qc_Matrix H 
)

Test if generated matrices G x H^T = 0

Parameters
Ggenerator matrix of code
Hparity-check matrix of code
Returns
0 if OK, 1 if error

Definition at line 413 of file qcmdpc.c.