2 * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
3 * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
4 * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
8 * This file has helper routines for doing basic GF operations with any
9 * legal value of w. The problem is that w <= 32, w=64 and w=128 all have
10 * different data types, which is a pain. The procedures in this file try
11 * to alleviate that pain. They are used in gf_unit and gf_time.
23 #include "gf_complete.h"
31 void gf_general_set_zero(gf_general_t *v, int w);
32 void gf_general_set_one(gf_general_t *v, int w);
33 void gf_general_set_two(gf_general_t *v, int w);
35 int gf_general_is_zero(gf_general_t *v, int w);
36 int gf_general_is_one(gf_general_t *v, int w);
37 int gf_general_are_equal(gf_general_t *v1, gf_general_t *v2, int w);
39 void gf_general_val_to_s(gf_general_t *v, int w, char *s, int hex);
40 int gf_general_s_to_val(gf_general_t *v, int w, char *s, int hex);
42 void gf_general_set_random(gf_general_t *v, int w, int zero_ok);
44 void gf_general_add(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
45 void gf_general_multiply(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
46 void gf_general_divide(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
47 void gf_general_inverse(gf_t *gf, gf_general_t *a, gf_general_t *b);
49 void gf_general_do_region_multiply(gf_t *gf, gf_general_t *a,
53 void gf_general_do_region_check(gf_t *gf, gf_general_t *a,
54 void *orig_a, void *orig_target, void *final_target,
58 /* Which is M, D or I for multiply, divide or inverse. */
60 void gf_general_set_up_single_timing_test(int w, void *ra, void *rb, int size);
61 int gf_general_do_single_timing_test(gf_t *gf, void *ra, void *rb, int size, char which);