diff --git a/include/codecrypt.h b/include/codecrypt.h index 3c0b8fb..7b73816 100644 --- a/include/codecrypt.h +++ b/include/codecrypt.h @@ -38,6 +38,9 @@ extern "C" { /* parity check matrix */ ccr_mtx h; + + /* TODO: also consider storing the squareroot-mod-poly mtx, + * although it's derivable from poly. */ }; struct ccr_nd_pubkey { @@ -62,6 +65,7 @@ extern "C" { ccr_perm pinv; }; + /* actual functions */ int ccr_mce_gen (struct ccr_mce_pubkey*, struct ccr_mce_privkey*); int ccr_mce_encrypt (struct ccr_mce_pubkey*, const char*, char*); int ccr_mce_decrypt (struct ccr_mce_privkey*, const char*, char*); diff --git a/lib/goppa.c b/lib/goppa.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/goppa.h b/lib/goppa.h new file mode 100644 index 0000000..e69de29 diff --git a/lib/lib.c b/lib/lib.c deleted file mode 100644 index f910c68..0000000 --- a/lib/lib.c +++ /dev/null @@ -1,7 +0,0 @@ - -#include "codecrypt.h" - -int libf() -{ - return 4; -} diff --git a/lib/log.c b/lib/log.c new file mode 100644 index 0000000..b243cca --- /dev/null +++ b/lib/log.c @@ -0,0 +1,16 @@ + +#include "codecrypt.h" +#include "log.h" + +typedef void(*)(const char*) logfunc; + +static logfunc global_log=NULL; + +//TODO export +void ccr_set_log_func(logfunc x) { + global_log=x; +} + +void ccr_log(const char*, ...) { + +} diff --git a/lib/log.h b/lib/log.h new file mode 100644 index 0000000..c2e7269 --- /dev/null +++ b/lib/log.h @@ -0,0 +1,8 @@ + +#ifndef _CCR_LOG_H_ +#define _CCR_LOG_H_ + +void ccr_log(const char*, ...); + +#endif + diff --git a/lib/math.c b/lib/math.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/math.h b/lib/math.h new file mode 100644 index 0000000..8dc17c0 --- /dev/null +++ b/lib/math.h @@ -0,0 +1,11 @@ + +#ifndef _CCR_MATH_H_ +#define _CCR_MATH_H_ + +#include "codecrypt.h" + +void ccr_mtx_add(int, int, const ccr_mtx, const ccr_mtx, ccr_mtx); +void ccr_mtx_multiply(int, int, int, const ccr_mtx, const ccr_mtx, ccr_mtx); + +#endif + diff --git a/lib/mce.c b/lib/mce.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/nd.c b/lib/nd.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/prng.c b/lib/prng.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/prng.h b/lib/prng.h new file mode 100644 index 0000000..96667ac --- /dev/null +++ b/lib/prng.h @@ -0,0 +1,9 @@ + +#ifndef _CCR_PRNG_H_ +#define _CCR_PRNG_H_ + + +int ccr_prng_bit(); +int ccr_prng_int(int); + +#endif diff --git a/lib/tools.c b/lib/tools.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/tools.h b/lib/tools.h new file mode 100644 index 0000000..e69de29