BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
qcmdpctypes.c
Go to the documentation of this file.
1 /*
2 This file is part of BitPunch
3 Copyright (C) 2015 Frantisek Uhrecky <frantisek.uhrecky[what here]gmail.com>
4 Copyright (C) 2015 Andrej Gulyas <andrej.guly[what here]gmail.com>
5 
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #include "qcmdpctypes.h"
20 
22  BPU_gf2QcMatrixFree(&spec->G, 0);
23  BPU_gf2SparseQcMatrixFree(&spec->H, 0);
24  free(spec);
25 }
26 
27 int BPU_qcmdpcInitParams(BPU_T_Qcmdpc_Params **params, const uint16_t m, const uint16_t n0, const uint16_t w, const uint16_t t) {
28  *params = (BPU_T_Qcmdpc_Params*) calloc(sizeof(BPU_T_Qcmdpc_Params), 1);
29 
30  if (!params) {
31  BPU_printError("Can't init Code params");
32 
33  return -1;
34  }
35  (*params)->m = m;
36  (*params)->n0 = n0;
37  (*params)->w = w;
38  (*params)->t = t;
39 
40  return 0;
41 }
42 
44  if (*params) {
45  free(*params);
46  }
47  *params = NULL;
48 }
void BPU_qcmdpcFreeParams(BPU_T_Qcmdpc_Params **params)
Definition: qcmdpctypes.c:43
BPU_T_GF2_QC_Matrix G
generator matrix
Definition: qcmdpctypes.h:29
void BPU_gf2QcMatrixFree(BPU_T_GF2_QC_Matrix *v, int is_dyn)
Definition: gf2types.c:251
#define BPU_printError(fmt,...)
print error message with filename, line
Definition: debugio.h:47
int BPU_qcmdpcInitParams(BPU_T_Qcmdpc_Params **params, const uint16_t m, const uint16_t n0, const uint16_t w, const uint16_t t)
Definition: qcmdpctypes.c:27
void BPU_gf2SparseQcMatrixFree(BPU_T_GF2_Sparse_Qc_Matrix *v, int is_dyn)
Definition: gf2types.c:174
void BPU_qcmdpcFreeSpec(BPU_T_Qcmdpc_Spec *spec)
Definition: qcmdpctypes.c:21
BPU_T_GF2_Sparse_Qc_Matrix H
parity-check matrix
Definition: qcmdpctypes.h:30