GF-Complete Library - Vendored Snapshot

Source: https://github.com/ceph/gf-complete
Commit: a6862d10c9db467148f20eef2c6445ac9afd94d8
Date:   2017-04-10
License: BSD-3-Clause (see License.txt)

This is a frozen snapshot of GF-Complete (Galois Field arithmetic library)
required by Jerasure for ION's TC (Trusted Collective) component.

ION-specific modifications:
- include/gf_complete.h: Changed gf_error() to gf_error(void) for strict
  prototype compliance (-Wstrict-prototypes)

- src/gf_general.c: Changed sscanf() return checks from == 0 to != 1 to
  properly handle EOF in addition to parse failures (CodeQL fix)

- src/gf_method.c: Changed sscanf() return checks from == 0 to != 1 to
  properly handle EOF in addition to parse failures (CodeQL fix)

- src/gf.c, src/gf_w4.c, src/gf_w8.c, src/gf_w16.c: Added #include <string.h>
  and replaced bzero() with memset() for portability. bzero() is a legacy BSD
  function not declared without <strings.h>, causing implicit function
  declaration errors on Solaris 11 and other strict compilers. memset() is
  C standard and portable across Linux, FreeBSD, macOS, and Solaris.

- src/gf.c: Addressed static analysis warnings to resolve
  uninitialized memory and shift overflows. Initialized mat and inv arrays to
  zero in gf_bitmatrix_inverse to prevent garbage value returns on off-nominal
  paths. Replaced signed literal shifts (1 << i) with unsigned (1U << i) and
  added explicit width boundary guards in gf_invert_binary_matrix to prevent
  signed integer overflow and constrain IPA bounds.

- src/gf.c: Reduced the width dispatch in gf_init_hard() and
  gf_scratch_size() to the widths ION can reach.
  ION enters gf-complete only through tc/library/ion_fec.c, which encodes at
  w=8; jerasure's galois_region_xor() additionally routes blocks of 16 bytes
  or more through a GF(2^32), gf_w32_init() needs gf_w16, and gf_w8_init()
  needs gf_w4 and gf_wgen.
  Widths 64 and 128 and the generic gf_wgen dispatch are unreachable, so the
  cases were removed and their implementations are no longer built.

Build scope:
  Only src/gf.c, gf_w4.c, gf_w8.c, gf_w16.c, gf_w32.c, gf_wgen.c and
  gf_cpu.c are compiled; the rest of the upstream snapshot was deleted as
  unreachable from ION.  See the commit that removed it for which files
  went and why:
    git log --diff-filter=D -- tc/gf-complete
    git checkout <commit>^ -- tc/gf-complete/src/gf_w64.c
  Restoring a file also means adding it back to libgfcomplete_la_SOURCES
  in the top-level Makefile.am, and for a width implementation restoring
  its case in the two width switches in src/gf.c.

  The library is built as a convenience archive absorbed into libionfec
  rather than an installed shared object, and its symbols are hidden, so
  gf-complete's API is not part of ION's published ABI.
  .github/scripts/fec-deadcode-check.sh records which functions in the
  compiled sources remain unreachable and fails if that set changes.
