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 stuctures for 8-bit Galois fields
11 #ifndef GF_COMPLETE_GF_W8_H
12 #define GF_COMPLETE_GF_W8_H
17 #define GF_FIELD_WIDTH (8)
18 #define GF_FIELD_SIZE (1 << GF_FIELD_WIDTH)
19 #define GF_HALF_SIZE (1 << (GF_FIELD_WIDTH/2))
20 #define GF_MULT_GROUP_SIZE GF_FIELD_SIZE-1
22 #define GF_BASE_FIELD_WIDTH (4)
23 #define GF_BASE_FIELD_SIZE (1 << GF_BASE_FIELD_WIDTH)
25 struct gf_w8_logtable_data {
26 uint8_t log_tbl[GF_FIELD_SIZE];
27 uint8_t antilog_tbl[GF_FIELD_SIZE * 2];
28 uint8_t inv_tbl[GF_FIELD_SIZE];
31 struct gf_w8_logzero_table_data {
32 short log_tbl[GF_FIELD_SIZE]; /* Make this signed, so that we can divide easily */
33 uint8_t antilog_tbl[512+512+1];
38 struct gf_w8_logzero_small_table_data {
39 short log_tbl[GF_FIELD_SIZE]; /* Make this signed, so that we can divide easily */
40 uint8_t antilog_tbl[255*3];
41 uint8_t inv_tbl[GF_FIELD_SIZE];
45 struct gf_w8_composite_data {
49 /* Don't change the order of these relative to gf_w8_half_table_data */
51 struct gf_w8_default_data {
52 uint8_t high[GF_FIELD_SIZE][GF_HALF_SIZE];
53 uint8_t low[GF_FIELD_SIZE][GF_HALF_SIZE];
54 uint8_t divtable[GF_FIELD_SIZE][GF_FIELD_SIZE];
55 uint8_t multtable[GF_FIELD_SIZE][GF_FIELD_SIZE];
58 struct gf_w8_half_table_data {
59 uint8_t high[GF_FIELD_SIZE][GF_HALF_SIZE];
60 uint8_t low[GF_FIELD_SIZE][GF_HALF_SIZE];
63 struct gf_w8_single_table_data {
64 uint8_t divtable[GF_FIELD_SIZE][GF_FIELD_SIZE];
65 uint8_t multtable[GF_FIELD_SIZE][GF_FIELD_SIZE];
68 struct gf_w8_double_table_data {
69 uint8_t div[GF_FIELD_SIZE][GF_FIELD_SIZE];
70 uint16_t mult[GF_FIELD_SIZE][GF_FIELD_SIZE*GF_FIELD_SIZE];
73 struct gf_w8_double_table_lazy_data {
74 uint8_t div[GF_FIELD_SIZE][GF_FIELD_SIZE];
75 uint8_t smult[GF_FIELD_SIZE][GF_FIELD_SIZE];
76 uint16_t mult[GF_FIELD_SIZE*GF_FIELD_SIZE];
79 struct gf_w4_logtable_data {
80 uint8_t log_tbl[GF_BASE_FIELD_SIZE];
81 uint8_t antilog_tbl[GF_BASE_FIELD_SIZE * 2];
82 uint8_t *antilog_tbl_div;
85 struct gf_w4_single_table_data {
86 uint8_t div[GF_BASE_FIELD_SIZE][GF_BASE_FIELD_SIZE];
87 uint8_t mult[GF_BASE_FIELD_SIZE][GF_BASE_FIELD_SIZE];
90 struct gf_w8_bytwo_data {
96 int gf_w8_neon_cfm_init(gf_t *gf);
97 void gf_w8_neon_split_init(gf_t *gf);
99 #endif /* GF_COMPLETE_GF_W8_H */