Helper to input a single field element in the checksum engine. */
| 113 | |
| 114 | /* Helper to input a single field element in the checksum engine. */ |
| 115 | static void input_fe(const u8 *generator, u8 *residue, uint8_t e, size_t len) |
| 116 | { |
| 117 | size_t res_len = len; |
| 118 | u8 xn = residue[0]; |
| 119 | |
| 120 | for(size_t i = 1; i < res_len; i++) { |
| 121 | residue[i - 1] = residue[i]; |
| 122 | } |
| 123 | |
| 124 | residue[res_len - 1] = e; |
| 125 | |
| 126 | for(size_t i = 0; i < res_len; i++) { |
| 127 | u8 x = generator[i]; |
| 128 | multiply_gf32(&x, xn); |
| 129 | addition_gf32(&residue[i], x); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /* Helper to input the HRP of codex32 string into the checksum engine */ |
| 134 | static void input_hrp(const u8 *generator, u8 *residue, const char *hrp, size_t len) |
no test coverage detected