132 fprintf(stderr,
"Key generation...\n");
164 fprintf(stderr,
"Encryption...\n");
176 fprintf(stderr,
"Decryption...\n");
195 fprintf(stderr,
"\nSUCCESS: Input plain text is equal to output plain text.\n");
199 fprintf(stderr,
"\nCleaning up...\n");
216 fprintf(stderr,
"Basic GOPPA Initialisation...\n");
226 fprintf(stderr,
"Key generation...\n");
249 int main(
int argc,
char **argv) {
256 #if !defined(BPU_CONF_GOPPA_WO_H) && defined(BPU_CONF_ASN1)
262 fprintf(stderr,
"Basic GOPPA Initialisation...\n");
272 #ifdef BPU_CONF_MECS_CCA2_POINTCHEVAL_GOPPA
273 fprintf(stderr,
"\nCCA2 Pointcheval GOPPA Initialisation...\n");
284 fprintf(stderr,
"Basic QC-MDPC Initialisation...\n");
295 #ifdef BPU_CONF_MECS_CCA2_POINTCHEVAL_GOPPA
296 fprintf(stderr,
"\nCCA2 Pointcheval QC-MDPC Initialisation...\n");
int BPU_gf2VecMalloc(BPU_T_GF2_Vector **v, int len)
BPU_T_Code_Ctx * code_ctx
BPU_T_Perm_Element * elements
permutation vector
basic qc-mdpc mecs, without any conversion
void BPU_gf2VecFree(BPU_T_GF2_Vector **v)
Free dynamically or statically allocated vector.
BPU_T_GF2_Matrix * g_mat
Generator matrix.
BPU_T_GF2_16x ** elements
all element of matrix
uint16_t pt_len
PT len in bits.
uint16_t elements_in_row
number of elements in one row
int BPU_gf2VecRand(BPU_T_GF2_Vector *out, int w)
BPU_T_Perm_Vector * permutation
permutation "matrix"
int testCmpMecsCtx(const BPU_T_Mecs_Ctx *ctx1, const BPU_T_Mecs_Ctx *ctx2)
int BPU_gf2VecCmp(const BPU_T_GF2_Vector *v1, const BPU_T_GF2_Vector *v2)
BPU_gf2VecCmp Compare two vectors.
BPU_T_GF2_16x_Matrix * h_mat
Control matrix H.
int(* _encrypt)(BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Mecs_Ctx *ctx)
int BPU_mecsInitParamsGoppa(BPU_T_UN_Mecs_Params *params, const uint16_t m, const uint16_t t, const BPU_T_GF2_16x mod)
uint16_t msg_len
Code dimenzion.
#define BPU_printError(fmt,...)
print error message with filename, line
uint16_t support_len
number of elements in support
int BPU_mecsDecrypt(BPU_T_GF2_Vector *pt, BPU_T_GF2_Vector *ct, const BPU_T_Mecs_Ctx *ctx)
Decrypt cipher text (ct) and save it to plain text.
int BPU_mecsInitCtx(BPU_T_Mecs_Ctx **ctx, const BPU_T_UN_Mecs_Params *params, const BPU_T_EN_Mecs_Types type)
Initialize (register) mecs functions for encryption, decryption and key gen based on type...
basic mecs, without any conversion
uint8_t element_bit_size
element size, is sizeof(BPU_T_GF2) i.e. 64 bits
void BPU_mecsFreeParamsQcmdpc(BPU_T_UN_Mecs_Params *params)
BPU_T_Perm_Element size
permutation size
BPU_T_GF2_Vector * e
Error vector.
int BPU_mecsFreeCtx(BPU_T_Mecs_Ctx **ctx)
int(* _decode)(BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Code_Ctx *ctx)
This is reference to decode function. It will be set in BPU_codeInitCtx.
int BPU_asn1SaveKeyPair(const BPU_T_Mecs_Ctx *ctx, const char *pri_key_file, const char *pub_key_file)
int(* _decrypt)(BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Mecs_Ctx *ctx)
uint16_t ct_len
CT len in bits.
void BPU_mecsFreeParamsGoppa(BPU_T_UN_Mecs_Params *params)
int(* _encode)(BPU_T_GF2_Vector *out, const BPU_T_GF2_Vector *in, const struct _BPU_T_Code_Ctx *ctx)
This is reference to encode function. It will be set in BPU_codeInitCtx.
int BPU_mecsInitParamsQcmdpc(BPU_T_UN_Mecs_Params *params, const uint16_t m, const uint16_t n0, const uint16_t w, const uint16_t t)
int BPU_asn1LoadKeyPair(BPU_T_Mecs_Ctx **ctx, const char *pri_key_file, const char *pub_key_file)
int BPU_gf2xPolyCmp(const BPU_T_GF2_16x_Poly *p1, const BPU_T_GF2_16x_Poly *p2)
adapted Pointcheval's cca2 conversion
int BPU_mecsGenKeyPair(BPU_T_Mecs_Ctx *ctx)
Key generation, first must be initialized context using BPU_mecsInitCtx().
int BPU_mecsEncrypt(BPU_T_GF2_Vector *ct, const BPU_T_GF2_Vector *pt, const BPU_T_Mecs_Ctx *ctx)
Encrypt plaintext (pt) and save it to cipher text.
adapted Pointcheval's cca2 conversion for qcmdpc
int testKeyGenEncDec(BPU_T_Mecs_Ctx *ctx)
uint8_t t
Error code correction capability.
uint16_t code_len
Code len.
int main(int argc, char **argv)
BPU_T_UN_Code_Spec * code_spec
Code specific structure, like generator matrix, control matrix, gen. poly ...
BPU_T_GF2_16x_Poly * g
gen. polynomial
BPU_T_GF2 ** elements
all element of matrix