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 * Defines and data structures for 4-bit Galois fields
11 #ifndef GF_COMPLETE_GF_W4_H
12 #define GF_COMPLETE_GF_W4_H
16 #define GF_FIELD_WIDTH 4
17 #define GF_DOUBLE_WIDTH (GF_FIELD_WIDTH*2)
18 #define GF_FIELD_SIZE (1 << GF_FIELD_WIDTH)
19 #define GF_MULT_GROUP_SIZE (GF_FIELD_SIZE-1)
21 /* ------------------------------------------------------------
22 JSP: Each implementation has its own data, which is allocated
23 at one time as part of the handle. For that reason, it
24 shouldn't be hierarchical -- i.e. one should be able to
25 allocate it with one call to malloc. */
27 struct gf_logtable_data {
28 uint8_t log_tbl[GF_FIELD_SIZE];
29 uint8_t antilog_tbl[GF_FIELD_SIZE * 2];
30 uint8_t *antilog_tbl_div;
33 struct gf_single_table_data {
34 uint8_t mult[GF_FIELD_SIZE][GF_FIELD_SIZE];
35 uint8_t div[GF_FIELD_SIZE][GF_FIELD_SIZE];
38 struct gf_double_table_data {
39 uint8_t div[GF_FIELD_SIZE][GF_FIELD_SIZE];
40 uint8_t mult[GF_FIELD_SIZE][GF_FIELD_SIZE*GF_FIELD_SIZE];
42 struct gf_quad_table_data {
43 uint8_t div[GF_FIELD_SIZE][GF_FIELD_SIZE];
44 uint16_t mult[GF_FIELD_SIZE][(1<<16)];
47 struct gf_quad_table_lazy_data {
48 uint8_t div[GF_FIELD_SIZE][GF_FIELD_SIZE];
49 uint8_t smult[GF_FIELD_SIZE][GF_FIELD_SIZE];
50 uint16_t mult[(1 << 16)];
53 struct gf_bytwo_data {
59 // ARM NEON init functions
60 int gf_w4_neon_cfm_init(gf_t *gf);
61 void gf_w4_neon_single_table_init(gf_t *gf);
63 #endif /* GF_COMPLETE_GF_W4_H */