util.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * util.h
  3. *
  4. * Created on: May 30, 2018
  5. * Author: vader
  6. */
  7. #ifndef INCLUDE_UTIL_UTIL_H_
  8. #define INCLUDE_UTIL_UTIL_H_
  9. #include <stdlib.h>
  10. #include <stdio.h>
  11. #include <sys/types.h>
  12. #include <stdint.h>
  13. #include <string.h>
  14. #include <math.h>
  15. #include <sodium.h>
  16. #include "../structures/matrix_operations.h"
  17. #include "../random/rng.h"
  18. #include "../definitions.h"
  19. #include "../gf/gf.h"
  20. #include "../api.h"
  21. extern void store(matrix *src, unsigned char *dst);
  22. extern void store_v_y(const gf *v,const gf *y, unsigned char *sk);
  23. extern void random_m(unsigned char *m);
  24. extern void random_e(const unsigned char *sigma, unsigned char *error_array);
  25. extern void recover_public_key(const unsigned char *public_key, matrix *G);
  26. void recover_G(const unsigned char *public_key, matrix *G);
  27. extern void set_vy_from_sk(gf* v, gf * y, const unsigned char * sk);
  28. extern void recover_sk(const unsigned char * sk, gf* v, gf * y);
  29. extern int compute_weight(unsigned char *r, int size);
  30. extern void permute(gf *array, int i, int length);
  31. extern int index_of_element(const gf *v, gf element);
  32. extern int check_positions(const int *pos, const int size);
  33. extern gf discrete_logarithm(const gf a, const gf b);
  34. extern void generate_int_list_of_size(int *list, int length);
  35. void generate_elements_in_order(gf * set_of_elements_in_F_q_m, int start_value,
  36. unsigned int size);
  37. #endif /* INCLUDE_UTIL_UTIL_H_ */