linux/lib/bch.c
<<
>>
Prefs
   1/*
   2 * Generic binary BCH encoding/decoding library
   3 *
   4 * This program is free software; you can redistribute it and/or modify it
   5 * under the terms of the GNU General Public License version 2 as published by
   6 * the Free Software Foundation.
   7 *
   8 * This program is distributed in the hope that it will be useful, but WITHOUT
   9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  11 * more details.
  12 *
  13 * You should have received a copy of the GNU General Public License along with
  14 * this program; if not, write to the Free Software Foundation, Inc., 51
  15 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  16 *
  17 * Copyright © 2011 Parrot S.A.
  18 *
  19 * Author: Ivan Djelic <ivan.djelic@parrot.com>
  20 *
  21 * Description:
  22 *
  23 * This library provides runtime configurable encoding/decoding of binary
  24 * Bose-Chaudhuri-Hocquenghem (BCH) codes.
  25 *
  26 * Call init_bch to get a pointer to a newly allocated bch_control structure for
  27 * the given m (Galois field order), t (error correction capability) and
  28 * (optional) primitive polynomial parameters.
  29 *
  30 * Call encode_bch to compute and store ecc parity bytes to a given buffer.
  31 * Call decode_bch to detect and locate errors in received data.
  32 *
  33 * On systems supporting hw BCH features, intermediate results may be provided
  34 * to decode_bch in order to skip certain steps. See decode_bch() documentation
  35 * for details.
  36 *
  37 * Option CONFIG_BCH_CONST_PARAMS can be used to force fixed values of
  38 * parameters m and t; thus allowing extra compiler optimizations and providing
  39 * better (up to 2x) encoding performance. Using this option makes sense when
  40 * (m,t) are fixed and known in advance, e.g. when using BCH error correction
  41 * on a particular NAND flash device.
  42 *
  43 * Algorithmic details:
  44 *
  45 * Encoding is performed by processing 32 input bits in parallel, using 4
  46 * remainder lookup tables.
  47 *
  48 * The final stage of decoding involves the following internal steps:
  49 * a. Syndrome computation
  50 * b. Error locator polynomial computation using Berlekamp-Massey algorithm
  51 * c. Error locator root finding (by far the most expensive step)
  52 *
  53 * In this implementation, step c is not performed using the usual Chien search.
  54 * Instead, an alternative approach described in [1] is used. It consists in
  55 * factoring the error locator polynomial using the Berlekamp Trace algorithm
  56 * (BTA) down to a certain degree (4), after which ad hoc low-degree polynomial
  57 * solving techniques [2] are used. The resulting algorithm, called BTZ, yields
  58 * much better performance than Chien search for usual (m,t) values (typically
  59 * m >= 13, t < 32, see [1]).
  60 *
  61 * [1] B. Biswas, V. Herbert. Efficient root finding of polynomials over fields
  62 * of characteristic 2, in: Western European Workshop on Research in Cryptology
  63 * - WEWoRC 2009, Graz, Austria, LNCS, Springer, July 2009, to appear.
  64 * [2] [Zin96] V.A. Zinoviev. On the solution of equations of degree 10 over
  65 * finite fields GF(2^q). In Rapport de recherche INRIA no 2829, 1996.
  66 */
  67
  68#include <linux/kernel.h>
  69#include <linux/errno.h>
  70#include <linux/init.h>
  71#include <linux/module.h>
  72#include <linux/slab.h>
  73#include <linux/bitops.h>
  74#include <asm/byteorder.h>
  75#include <linux/bch.h>
  76
  77#if defined(CONFIG_BCH_CONST_PARAMS)
  78#define GF_M(_p)               (CONFIG_BCH_CONST_M)
  79#define GF_T(_p)               (CONFIG_BCH_CONST_T)
  80#define GF_N(_p)               ((1 << (CONFIG_BCH_CONST_M))-1)
  81#else
  82#define GF_M(_p)               ((_p)->m)
  83#define GF_T(_p)               ((_p)->t)
  84#define GF_N(_p)               ((_p)->n)
  85#endif
  86
  87#define BCH_ECC_WORDS(_p)      DIV_ROUND_UP(GF_M(_p)*GF_T(_p), 32)
  88#define BCH_ECC_BYTES(_p)      DIV_ROUND_UP(GF_M(_p)*GF_T(_p), 8)
  89
  90#ifndef dbg
  91#define dbg(_fmt, args...)     do {} while (0)
  92#endif
  93
  94/*
  95 * represent a polynomial over GF(2^m)
  96 */
  97struct gf_poly {
  98        unsigned int deg;    /* polynomial degree */
  99        unsigned int c[0];   /* polynomial terms */
 100};
 101
 102/* given its degree, compute a polynomial size in bytes */
 103#define GF_POLY_SZ(_d) (sizeof(struct gf_poly)+((_d)+1)*sizeof(unsigned int))
 104
 105/* polynomial of degree 1 */
 106struct gf_poly_deg1 {
 107        struct gf_poly poly;
 108        unsigned int   c[2];
 109};
 110
 111/*
 112 * same as encode_bch(), but process input data one byte at a time
 113 */
 114static void encode_bch_unaligned(struct bch_control *bch,
 115                                 const unsigned char *data, unsigned int len,
 116                                 uint32_t *ecc)
 117{
 118        int i;
 119        const uint32_t *p;
 120        const int l = BCH_ECC_WORDS(bch)-1;
 121
 122        while (len--) {
 123                p = bch->mod8_tab + (l+1)*(((ecc[0] >> 24)^(*data++)) & 0xff);
 124
 125                for (i = 0; i < l; i++)
 126                        ecc[i] = ((ecc[i] << 8)|(ecc[i+1] >> 24))^(*p++);
 127
 128                ecc[l] = (ecc[l] << 8)^(*p);
 129        }
 130}
 131
 132/*
 133 * convert ecc bytes to aligned, zero-padded 32-bit ecc words
 134 */
 135static void load_ecc8(struct bch_control *bch, uint32_t *dst,
 136                      const uint8_t *src)
 137{
 138        uint8_t pad[4] = {0, 0, 0, 0};
 139        unsigned int i, nwords = BCH_ECC_WORDS(bch)-1;
 140
 141        for (i = 0; i < nwords; i++, src += 4)
 142                dst[i] = (src[0] << 24)|(src[1] << 16)|(src[2] << 8)|src[3];
 143
 144        memcpy(pad, src, BCH_ECC_BYTES(bch)-4*nwords);
 145        dst[nwords] = (pad[0] << 24)|(pad[1] << 16)|(pad[2] << 8)|pad[3];
 146}
 147
 148/*
 149 * convert 32-bit ecc words to ecc bytes
 150 */
 151static void store_ecc8(struct bch_control *bch, uint8_t *dst,
 152                       const uint32_t *src)
 153{
 154        uint8_t pad[4];
 155        unsigned int i, nwords = BCH_ECC_WORDS(bch)-1;
 156
 157        for (i = 0; i < nwords; i++) {
 158                *dst++ = (src[i] >> 24);
 159                *dst++ = (src[i] >> 16) & 0xff;
 160                *dst++ = (src[i] >>  8) & 0xff;
 161                *dst++ = (src[i] >>  0) & 0xff;
 162        }
 163        pad[0] = (src[nwords] >> 24);
 164        pad[1] = (src[nwords] >> 16) & 0xff;
 165        pad[2] = (src[nwords] >>  8) & 0xff;
 166        pad[3] = (src[nwords] >>  0) & 0xff;
 167        memcpy(dst, pad, BCH_ECC_BYTES(bch)-4*nwords);
 168}
 169
 170/**
 171 * encode_bch - calculate BCH ecc parity of data
 172 * @bch:   BCH control structure
 173 * @data:  data to encode
 174 * @len:   data length in bytes
 175 * @ecc:   ecc parity data, must be initialized by caller
 176 *
 177 * The @ecc parity array is used both as input and output parameter, in order to
 178 * allow incremental computations. It should be of the size indicated by member
 179 * @ecc_bytes of @bch, and should be initialized to 0 before the first call.
 180 *
 181 * The exact number of computed ecc parity bits is given by member @ecc_bits of
 182 * @bch; it may be less than m*t for large values of t.
 183 */
 184void encode_bch(struct bch_control *bch, const uint8_t *data,
 185                unsigned int len, uint8_t *ecc)
 186{
 187        const unsigned int l = BCH_ECC_WORDS(bch)-1;
 188        unsigned int i, mlen;
 189        unsigned long m;
 190        uint32_t w, r[l+1];
 191        const uint32_t * const tab0 = bch->mod8_tab;
 192        const uint32_t * const tab1 = tab0 + 256*(l+1);
 193        const uint32_t * const tab2 = tab1 + 256*(l+1);
 194        const uint32_t * const tab3 = tab2 + 256*(l+1);
 195        const uint32_t *pdata, *p0, *p1, *p2, *p3;
 196
 197        if (ecc) {
 198                /* load ecc parity bytes into internal 32-bit buffer */
 199                load_ecc8(bch, bch->ecc_buf, ecc);
 200        } else {
 201                memset(bch->ecc_buf, 0, sizeof(r));
 202        }
 203
 204        /* process first unaligned data bytes */
 205        m = ((unsigned long)data) & 3;
 206        if (m) {
 207                mlen = (len < (4-m)) ? len : 4-m;
 208                encode_bch_unaligned(bch, data, mlen, bch->ecc_buf);
 209                data += mlen;
 210                len  -= mlen;
 211        }
 212
 213        /* process 32-bit aligned data words */
 214        pdata = (uint32_t *)data;
 215        mlen  = len/4;
 216        data += 4*mlen;
 217        len  -= 4*mlen;
 218        memcpy(r, bch->ecc_buf, sizeof(r));
 219
 220        /*
 221         * split each 32-bit word into 4 polynomials of weight 8 as follows:
 222         *
 223         * 31 ...24  23 ...16  15 ... 8  7 ... 0
 224         * xxxxxxxx  yyyyyyyy  zzzzzzzz  tttttttt
 225         *                               tttttttt  mod g = r0 (precomputed)
 226         *                     zzzzzzzz  00000000  mod g = r1 (precomputed)
 227         *           yyyyyyyy  00000000  00000000  mod g = r2 (precomputed)
 228         * xxxxxxxx  00000000  00000000  00000000  mod g = r3 (precomputed)
 229         * xxxxxxxx  yyyyyyyy  zzzzzzzz  tttttttt  mod g = r0^r1^r2^r3
 230         */
 231        while (mlen--) {
 232                /* input data is read in big-endian format */
 233                w = r[0]^cpu_to_be32(*pdata++);
 234                p0 = tab0 + (l+1)*((w >>  0) & 0xff);
 235                p1 = tab1 + (l+1)*((w >>  8) & 0xff);
 236                p2 = tab2 + (l+1)*((w >> 16) & 0xff);
 237                p3 = tab3 + (l+1)*((w >> 24) & 0xff);
 238
 239                for (i = 0; i < l; i++)
 240                        r[i] = r[i+1]^p0[i]^p1[i]^p2[i]^p3[i];
 241
 242                r[l] = p0[l]^p1[l]^p2[l]^p3[l];
 243        }
 244        memcpy(bch->ecc_buf, r, sizeof(r));
 245
 246        /* process last unaligned bytes */
 247        if (len)
 248                encode_bch_unaligned(bch, data, len, bch->ecc_buf);
 249
 250        /* store ecc parity bytes into original parity buffer */
 251        if (ecc)
 252                store_ecc8(bch, ecc, bch->ecc_buf);
 253}
 254EXPORT_SYMBOL_GPL(encode_bch);
 255
 256static inline int modulo(struct bch_control *bch, unsigned int v)
 257{
 258        const unsigned int n = GF_N(bch);
 259        while (v >= n) {
 260                v -= n;
 261                v = (v & n) + (v >> GF_M(bch));
 262        }
 263        return v;
 264}
 265
 266/*
 267 * shorter and faster modulo function, only works when v < 2N.
 268 */
 269static inline int mod_s(struct bch_control *bch, unsigned int v)
 270{
 271        const unsigned int n = GF_N(bch);
 272        return (v < n) ? v : v-n;
 273}
 274
 275static inline int deg(unsigned int poly)
 276{
 277        /* polynomial degree is the most-significant bit index */
 278        return fls(poly)-1;
 279}
 280
 281static inline int parity(unsigned int x)
 282{
 283        /*
 284         * public domain code snippet, lifted from
 285         * http://www-graphics.stanford.edu/~seander/bithacks.html
 286         */
 287        x ^= x >> 1;
 288        x ^= x >> 2;
 289        x = (x & 0x11111111U) * 0x11111111U;
 290        return (x >> 28) & 1;
 291}
 292
 293/* Galois field basic operations: multiply, divide, inverse, etc. */
 294
 295static inline unsigned int gf_mul(struct bch_control *bch, unsigned int a,
 296                                  unsigned int b)
 297{
 298        return (a && b) ? bch->a_pow_tab[mod_s(bch, bch->a_log_tab[a]+
 299                                               bch->a_log_tab[b])] : 0;
 300}
 301
 302static inline unsigned int gf_sqr(struct bch_control *bch, unsigned int a)
 303{
 304        return a ? bch->a_pow_tab[mod_s(bch, 2*bch->a_log_tab[a])] : 0;
 305}
 306
 307static inline unsigned int gf_div(struct bch_control *bch, unsigned int a,
 308                                  unsigned int b)
 309{
 310        return a ? bch->a_pow_tab[mod_s(bch, bch->a_log_tab[a]+
 311                                        GF_N(bch)-bch->a_log_tab[b])] : 0;
 312}
 313
 314static inline unsigned int gf_inv(struct bch_control *bch, unsigned int a)
 315{
 316        return bch->a_pow_tab[GF_N(bch)-bch->a_log_tab[a]];
 317}
 318
 319static inline unsigned int a_pow(struct bch_control *bch, int i)
 320{
 321        return bch->a_pow_tab[modulo(bch, i)];
 322}
 323
 324static inline int a_log(struct bch_control *bch, unsigned int x)
 325{
 326        return bch->a_log_tab[x];
 327}
 328
 329static inline int a_ilog(struct bch_control *bch, unsigned int x)
 330{
 331        return mod_s(bch, GF_N(bch)-bch->a_log_tab[x]);
 332}
 333
 334/*
 335 * compute 2t syndromes of ecc polynomial, i.e. ecc(a^j) for j=1..2t
 336 */
 337static void compute_syndromes(struct bch_control *bch, uint32_t *ecc,
 338                              unsigned int *syn)
 339{
 340        int i, j, s;
 341        unsigned int m;
 342        uint32_t poly;
 343        const int t = GF_T(bch);
 344
 345        s = bch->ecc_bits;
 346
 347        /* make sure extra bits in last ecc word are cleared */
 348        m = ((unsigned int)s) & 31;
 349        if (m)
 350                ecc[s/32] &= ~((1u << (32-m))-1);
 351        memset(syn, 0, 2*t*sizeof(*syn));
 352
 353        /* compute v(a^j) for j=1 .. 2t-1 */
 354        do {
 355                poly = *ecc++;
 356                s -= 32;
 357                while (poly) {
 358                        i = deg(poly);
 359                        for (j = 0; j < 2*t; j += 2)
 360                                syn[j] ^= a_pow(bch, (j+1)*(i+s));
 361
 362                        poly ^= (1 << i);
 363                }
 364        } while (s > 0);
 365
 366        /* v(a^(2j)) = v(a^j)^2 */
 367        for (j = 0; j < t; j++)
 368                syn[2*j+1] = gf_sqr(bch, syn[j]);
 369}
 370
 371static void gf_poly_copy(struct gf_poly *dst, struct gf_poly *src)
 372{
 373        memcpy(dst, src, GF_POLY_SZ(src->deg));
 374}
 375
 376static int compute_error_locator_polynomial(struct bch_control *bch,
 377                                            const unsigned int *syn)
 378{
 379        const unsigned int t = GF_T(bch);
 380        const unsigned int n = GF_N(bch);
 381        unsigned int i, j, tmp, l, pd = 1, d = syn[0];
 382        struct gf_poly *elp = bch->elp;
 383        struct gf_poly *pelp = bch->poly_2t[0];
 384        struct gf_poly *elp_copy = bch->poly_2t[1];
 385        int k, pp = -1;
 386
 387        memset(pelp, 0, GF_POLY_SZ(2*t));
 388        memset(elp, 0, GF_POLY_SZ(2*t));
 389
 390        pelp->deg = 0;
 391        pelp->c[0] = 1;
 392        elp->deg = 0;
 393        elp->c[0] = 1;
 394
 395        /* use simplified binary Berlekamp-Massey algorithm */
 396        for (i = 0; (i < t) && (elp->deg <= t); i++) {
 397                if (d) {
 398                        k = 2*i-pp;
 399                        gf_poly_copy(elp_copy, elp);
 400                        /* e[i+1](X) = e[i](X)+di*dp^-1*X^2(i-p)*e[p](X) */
 401                        tmp = a_log(bch, d)+n-a_log(bch, pd);
 402                        for (j = 0; j <= pelp->deg; j++) {
 403                                if (pelp->c[j]) {
 404                                        l = a_log(bch, pelp->c[j]);
 405                                        elp->c[j+k] ^= a_pow(bch, tmp+l);
 406                                }
 407                        }
 408                        /* compute l[i+1] = max(l[i]->c[l[p]+2*(i-p]) */
 409                        tmp = pelp->deg+k;
 410                        if (tmp > elp->deg) {
 411                                elp->deg = tmp;
 412                                gf_poly_copy(pelp, elp_copy);
 413                                pd = d;
 414                                pp = 2*i;
 415                        }
 416                }
 417                /* di+1 = S(2i+3)+elp[i+1].1*S(2i+2)+...+elp[i+1].lS(2i+3-l) */
 418                if (i < t-1) {
 419                        d = syn[2*i+2];
 420                        for (j = 1; j <= elp->deg; j++)
 421                                d ^= gf_mul(bch, elp->c[j], syn[2*i+2-j]);
 422                }
 423        }
 424        dbg("elp=%s\n", gf_poly_str(elp));
 425        return (elp->deg > t) ? -1 : (int)elp->deg;
 426}
 427
 428/*
 429 * solve a m x m linear system in GF(2) with an expected number of solutions,
 430 * and return the number of found solutions
 431 */
 432static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
 433                               unsigned int *sol, int nsol)
 434{
 435        const int m = GF_M(bch);
 436        unsigned int tmp, mask;
 437        int rem, c, r, p, k, param[m];
 438
 439        k = 0;
 440        mask = 1 << m;
 441
 442        /* Gaussian elimination */
 443        for (c = 0; c < m; c++) {
 444                rem = 0;
 445                p = c-k;
 446                /* find suitable row for elimination */
 447                for (r = p; r < m; r++) {
 448                        if (rows[r] & mask) {
 449                                if (r != p) {
 450                                        tmp = rows[r];
 451                                        rows[r] = rows[p];
 452                                        rows[p] = tmp;
 453                                }
 454                                rem = r+1;
 455                                break;
 456                        }
 457                }
 458                if (rem) {
 459                        /* perform elimination on remaining rows */
 460                        tmp = rows[p];
 461                        for (r = rem; r < m; r++) {
 462                                if (rows[r] & mask)
 463                                        rows[r] ^= tmp;
 464                        }
 465                } else {
 466                        /* elimination not needed, store defective row index */
 467                        param[k++] = c;
 468                }
 469                mask >>= 1;
 470        }
 471        /* rewrite system, inserting fake parameter rows */
 472        if (k > 0) {
 473                p = k;
 474                for (r = m-1; r >= 0; r--) {
 475                        if ((r > m-1-k) && rows[r])
 476                                /* system has no solution */
 477                                return 0;
 478
 479                        rows[r] = (p && (r == param[p-1])) ?
 480                                p--, 1u << (m-r) : rows[r-p];
 481                }
 482        }
 483
 484        if (nsol != (1 << k))
 485                /* unexpected number of solutions */
 486                return 0;
 487
 488        for (p = 0; p < nsol; p++) {
 489                /* set parameters for p-th solution */
 490                for (c = 0; c < k; c++)
 491                        rows[param[c]] = (rows[param[c]] & ~1)|((p >> c) & 1);
 492
 493                /* compute unique solution */
 494                tmp = 0;
 495                for (r = m-1; r >= 0; r--) {
 496                        mask = rows[r] & (tmp|1);
 497                        tmp |= parity(mask) << (m-r);
 498                }
 499                sol[p] = tmp >> 1;
 500        }
 501        return nsol;
 502}
 503
 504/*
 505 * this function builds and solves a linear system for finding roots of a degree
 506 * 4 affine monic polynomial X^4+aX^2+bX+c over GF(2^m).
 507 */
 508static int find_affine4_roots(struct bch_control *bch, unsigned int a,
 509                              unsigned int b, unsigned int c,
 510                              unsigned int *roots)
 511mask =  * 4l *bch< >+code=elp_copy" class="ssol[pd ,  49616e" n{0,}="+code=m" class="sref5 f="lib/bc     404                                         43804" class="line" name="L404"> 404                                        /* di+1 = 5(2i+351OLY_SZ(2* 4960> 467                        (2*d 5 syn[2* 4*
elp-5gt;deg; ry Berlekamp-Massey algorithm */

r = elp->syn5/a>[2*i+2- 496           f">elp-> 368                 dega>[[ 4964 href="+code=c" class="sref">c[ 368                 dega>[[ 496="+code=r" classod_s="line" name="Lsod_s                                      368                 dega>[[ 496="+code=r" classod_s="line" name="Lsod_s                                     j <=  = * 438deg;
 426}
syn[2* c over GF(2^m).
      if5h.c#L428" id="L428" clas5="lin5" name="L428"> 428
-530"> 430 * and return the number occcccccc*+c over GF(2^m).
i+2- class="sref">i+2];
!#L402" id="L402" class="line" name="L402"> /bch.c#L46bch.c#L436" id="L436" class="line" name="L43#L362h.c#L436" id="L436" class="line" name="L43#bch.c#L484" id="L484" cl"+c512" id="L512" cla""+code=deg" class="sref"5ef="+code5bch" class="sref">bchi+ne" name="L438"> 438
 438 438j <= so53>r] ^= rows[elp-ram" class="sref">param<"+c512" id="L512" cla"^=rows" class="sref">rows[elpj <= nsol)
rows[elp-L362h.c#L436" id="Le>                cla/bch.c#L484" id="L484" cl"+c512" id="L512" cla"="+code=param" class="5"rrows[elpj <=                 cla="+code=param" class="5" 506 456                5ef">k5 m];
="comment"> */
+code=l" class="e=bch.c#L510" id="L510" class, 4"="+code=param" class="5" id="L435" class="line" name="L435"> 435  56                5  = 1 << m;
 c over GF(2^m).
 442   5    <5pan clear system for finding ro92
<10"  rline" name=" 1e

 444 5     5      "L507"> 507
 508static int find_affine4_r href="+code=elp" class="sref">elp;
elp;
p = c-c,
 51"> 446r5< m; bch);
[r != ref">j++) {
elp;
 51f">tmprows[rem) {

r5 = rows[,
 467          sod_s="line" name="Lsod_s                                      380        const unsigned int p                 dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="href">elp;
[p] = ,
dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="href">elp;
 4ss="line" name="L500"> a>);
re56                5/bch.c#L455" id="L455" class="line5 name55>k,  458   5     55 name="L428"> 428
/* "L507"> 507
 508static int find_affine4_r href="+code=elp" class="sref">elp;
elp;
tmprows[c,
 51ef">r5< mcode=deg" class="sref"5ws[r<5a>] & bch);
 511mask =  511mask =  511mask =  511rows[pd ,  511mask =  511+code=l" class="e.c#L510" id="L51b/bcref="+code=syn" class=5flass="li5lib/bch.c#L464" id="L4645 clas56c#L374" id="L374" class="l5}
j++) {
elp;
elp;
/*5elimi56"line" name="L486"> 486para5[k++] =  =  511mame="L368"> 368                 dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="href">elp;
[ 468 l1me="L511"> 511mame="L368"> 368                 dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="href">elp;
 469           5    <57, unsigned int  =  511 368                 dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="href">elp;
tmp   5    rows[k<2" clz=a/bX, transref="="lib/bch.="+o zlibz+u (u=ac/b^2ame="L417"> 417             52" class=5line" name="L472"> 472    5   if ( 511ma/a>04" class="line" " class="sref">c[j+ 511maode=a_pow" class=2me="L511"> 511 380        const unsigned int pl1me="L511"> 511ma;s\n",        5        p =  c over GF(2^m).
-1; r<57 name="L504"> 504sum(li.a^i) i=0..mnametheno92
<1/a>sum(li.xi):c over GF(2^m).
sum(li.(xilibxi))/a>sum(li.(a^i+Tr(a^i).a^k))/ac over GF(2^m).
sum(li.Tr(a^i).a^k)/a>u+a^k.Tr(sum(li.a^i))/a>u+a^k.Tr(u"c over GF(2^m).

[ 428 417             5a> == [[r- =  51104" class="lineume="L511"> 511ma/bch.c#L494" id="L494"5s1   5a href="lib/bch.c#L481" 5d="L458ref">rows[j++) {
 511p] =  511ma3" id="L413" class=> j++) {
 511       582        }
r] ^= degxi_taib/bch.c#L509" ixi_tailasse=param" class="class="sref">c[-1; ns5l5!= (1 <<  =  511c[                /* unexpecte56                5
 416           verify<10"  *="L417"> 417             5a.c#L477"5      return 0;
k++] = r--gf_sqref="+code=dbg" clasqr href="+code=j" class="sref">j+ 511ma"+code=deg" class="sref"5 /a>[nsol;  416           reverselz=a/bX transref=="lib/r of92
 417             59"> 489                /* set parametcode=tmpde=k" class="sre/bch.c#L510" id="L510" classe=param" class="/a>);
 467          sodulo="line" name="Lsodulo href="+code=j" class="sref">j+ 380        const unsigned int pl1me="L511"> 511ma- 417             59s="sref"5> < k; dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="              511p<5a> &g59ef">m;  467          sodulo="line" name="Lsodulo href="+code=j" class="sref">j+ 380        const unsigned int pl1me="L511"> 511ma- 417             59        5) & 1);
dega>log_taib/bch.c#L509" ia>log_tailasse=param" class="              511       5"> 493              5 /* co56                5class="li5e" name="L494"> 494 5     5                        5c
r<5a> >= 0;  a>);
[ 477               5>r);
5a href="lib/bch.c#L498" 5d="L459 name="L428"> 428 c over GF(2^m).
[p6/a>] 60n GF(2) with an expected numbe92
<10" "line" name=" 3e
 * and return the number of found solutions
 501    60name="L431"> 431 508static int find_affine4_r href="+code=elp" class="sref">elp;
elp;
nsol;
c,
 56ne" name=6L502"> 502}
, int  511mask = );
 *6this function builds and6solve60>GF_M(,
 511,
 511,
 511,
 511,
 5066span class="comment"> * 6 affi60"line" name="L486"> 486m; j++) {
elp;
, unsigned int  416           transref="

b, unsigned int ,
 511elp;
    6                        6unsig61="sref">r- =  511 511j+elp;
 511roots)
rows[,
 511 511j+elp;
 511 511 511j+elp;
 511k(X+a2)(X^3+a2X^2+b2X+c2)/a>href="lib/bch.(.c#L50) *="L417"> 417             6
static int j+ 511,
 511kh.L4a2c2oooooo*="L417"> 417             6
 5066a href="lib/bch.c#L416" 6d="L461" class="line" name="La>,
static int j+ 511,
 511 511kb.L4a2b2 + c2of found solutions
/* di+1 = 6(2i+361ef">k++] =  = j+ 511 511ka.L4a2^2 + b2of found solutions
(2*d 6 kthe 4<10" "liness="cs of a 

elp-6gt;r-j++) {
 */
j+,
syn6/a>[2*i+2-remove4a2 from>k
 class="6a href="lib/bch.c#L422" 6d="L462>] & 

elp->j++) {
                elp->!#Lde=k" class="srd2me="L511"> 511 467          a_iname="L404"> 404i                                        elp-> = *deg;
 456                6ne" name=6L426"> 426}
syn[2*<56                6n* a>);
  56                6"elp-630"> 430 = 1 <<  c over GF(2^m).
bch
<10" "line" name=" 4e
so63.c#L503" id="L503" class="lc*+c over GF(2^m).
nsol)
 507
 508static int find_affine4_r href="+code=elp" class="sref">elp;
elp;
c,
 56" 5066a href="+code=tmp" class6"sref63ment"code=deg" class="sref"6ef">k6  511mask = static int mask = );
m];
,
,
 511,
 511,
 511,
 511,
 511 436  ef="+code=syn" class=6"elp-6+code=mask" class="sref"6mask<64="sref">rref">j++) {
elp;
 56de=m" cla6s="sref">m;
i+2- 442   6    <64c#L502" id="L502" class="l6a        6<  416           transref="

 444 6     64       ,
 511elp;
p =  511j+elp;
 511 446 511j+elp;
 511k6< m; ,
 511j+elp;
 511m; ,
 511j+elp;
 511tmprowsa"+code=k" class="sref">k<2e Y=1/X transref=="lib/+o get cods of a 

r6 = rowsref">j++) {
p] = k

r] ^= j++) {
[ 492

r
 511j+ 446tmpa>static int ma/a>04" class="line" name="L404"> 404                                        k6a href="lib/bch.c#L457" 6d="L465ef">k++] = tmpa>static int ma/+362h.c#L436" id="La>static int ma/lass="sr ?="L368"> 368" class="line" name="L380"> 380        const unsigned int  458   6     65>nsol;  511c[j+/* set parametcode=tmpdss="line" name="L492"> c over GF(2^m).
tmp * and return the number occcccccccccccccccccccccc>k<2e transref=="lib/z=X+e:c over GF(2^m).
r6< kz^4+e^4 + a(z^3+ezlibe^2zbe^3) + b(zlibe^2) +cz+ce+dc over GF(2^m).
r<66an clear system for finding cccccccccccccccccccccccc>kz^4 + az^3 + (ae+b)z^2 + (ae^2+c)zbe^4+be^2+ae^3+ce+dc over GF(2^m).
[ 504kz^4 + az^3 +     b'z^2 + d'c over GF(2^m).
+c over GF(2^m).
/*6elimi66 & (tmpd93" id="L393" cdlasslib/bch.c#L447" id" " class="sref">c[j+static int mao^=rows" class="srefmua>static int j+
k6[k++] = tmpib/bch.c#L509" id="L5lib/bch.c#L447" idrefmua>static int j+,
 511 469           6    <67, unsigned int  4now,k<2e Y=1/X to get Y^4 + b/dY^2 + a/dY + 1/dc*+c over GF(2^m).
tmpr-j++) {
 5671   6    rows[ 4an ume all<10" "lhave muatiplicity 1c*+c over GF(2^m).
 472    6   if (-1; r<67        511 511j+ = * 511 511j+,
 511 511j+k6id="L477" class="line" n6me="L678>syn[2*<5 el2e code=deg" class="sref"6h/a>[ 416           

 == [ 511[r- =  511rows[,
 511p] =                 6s>       682        }
r] ^=  416           kthe 4<10" "liness="cs of a 

-1; ns6l6!= (1 <<"ef">j++) {
 */
j+ 511,
 511,
 511,
                /* unexpectery Berlekamp-Massey algorithm */

elp-> 416            417             6a.c#L477"6      return 0;
k++] = ,
 368refinvme="L511"> 511j+elp->elp->[nsol; elp->          a_iname="L404"> 404i                                         511 489                /* set paramet56                69s="sref"6> < k;    6+code=p" class="sref">p<6a> &g69ef">m;                 69        6) & 1);
 a>);
       6"> 493              6                 69a>-1;  494 6     69c#L374" id="L374" class="l6c
r<69a linear system for finding> c over GF(2^m).
[

 417             6>r);
6a href="lib/bch.c#L498" 6d="L469 name"L507">void"+code=elp" class="sref>   sspme="L511"> 511   ssp      class="line" name="L508"> 508static int find_affine4_ 417             7>[p7/a>] 70mment">/* set parametcode=tmpppp="+str href="+code=elp" class="sref">elp;
c,
 511 57 >7gt; 1;
 * code=deg" class="sref"71" class=7line" name="L501"> 501    70ref">rowsr11" class="line" name="L511"> 511mask =  380        const unsigned int p" name="L404"> 404                                        nsol;
 502}
r] ^=  416           sspresaX^ 0 values.ch.c#namewarning, ssp[d] =s notr et to 1c*+c over GF(2^m).
elp-> 511elp->          ae=bch_control" classelp-> 368sod_s="line" name="Lsod_s                                      404                                        elp->static int ma" :onamGF(2^m).
 477               7 * 428 c over GF(2^m).
b
<
r106" id="[X]c over GF(2^m).
 >7                        7unsig71"> * and return the number of found solutions
roots)
void"+code=elp" class="sref>sodme="L511"> 511sod      class="line" name="L508"> 508static int find_affine4_r href="+code=elp" class="sref">elp;

elp;
c,
 511 57 e" name=7      , int ,
 511,
 511mask =  511mask/a>,
/* di+1 = 7(2i+3717"> 477               7d*nsol; j++) {
 57f">d 7 elp-7gt;syn7/a>[2*i+2-L416"> 416           ss<2e y B92

naty Bf found solutions
 class="7a href="lib/bch.c#L422" 7d="L472>] & ,
 511,
 511 368                 degcacheme="L511"> 511 511   ssp                                      511 = *                7f 5067sref">deg;
 486 426}
syn[2* 511malib/bch.c#L447" id"e=bch_control" class 511mala hrib/bch.c#L447" idd93" id="L393" cdlass/f/bch.c#L447" idjme="L511"> 511ma--=+code=deg" class="sref"7s*j++) {
[ 511mai=+code=deg" class="sref"7"comment"7 * solve a m x m linear 7ystem73mment">/* set parametcode=tmpde=k" class="srlde=bch_control" lclass/a>04" class="line" name="L404"> 404                                         511mai=ref="+code=syn" class=7"elp-730"> 430k;  51104" class="linejme="L511"> 511ma-/bch.c#L447" idd93" id="L393" cdlass/ef="+code=syn" class=7"ref">syn7.c#L431" id="L431" class7"line73ref">rows[

elp->,
 511bch,
 511elp->so73>r] ^= j++) {
 57" class="7ref">nsol)
+2- 511dega>[[ 57"7a href="+code=tmp" class7"sref73" class="line" name="t                 7ef">k7 k++] =                 7e*m];
 4374mment">/* set>j++) {

-7+code=mask" class="sref"7mask<74="sref">rwhilef"!a>,
 57de=m" cla7s="sref">m;
i+2-
 442   7    <74c#L5056                7"        7<  444 7     74 name="L504"> 504 c over GF(2^m).
p = 
<
 446k7< m"L431">void"+code=elp" class="sref>divme="L511"> 511div      class="line" name="L508"> 508static int find_affine4_r href="+code=elp" class="sref">elp;

elp;
elp;
elp;
 57         7 if (tmprowsref">j++) {
r7 = i+2-elp;
[p] = 92
 417             7="lib/bch7c#L453" id="L453" class=7line"75>r] ^=  511sod                                     ,
quotiaX^ rs9 hor+code upper partline

elp;
elp;
elp;
 446k7a href="lib/bch.c#L457" 7d="L475ef">k++] = elp;
 458   7     75>nsol; elp;
/* set56                7f">tmp * 56                7ff">r7< r<76an clear system for finding> c over GF(2^m).
[ 504
 href="+code=elp" class="sref">elp;
 511gcd      class="line" name="L508"> 508static int find_affine4_r href="+code=elp" class="sref">elp;

/*7elimi76 & (elp;
 57 f">k7[kcode=deg" class="sref"7       if7a href="lib/bch.c#L468" 7d="L478" class="line href="+code=elp" class="sref">elp;
 469           7    <77/a>  ef="+code=syn" class=7e">tmpref="lib/bch.c#L=bgt;  504< hring">"gcd(%s,%s)="c over 09ef="lib/bch.c#Lrefsref> hrme="L511"> 511 hr                    de=bch_control" classf09ef="lib/bch.c#Lrefsref> hrme="L511"> 511 hr                    ib/bch.c#L509" id="L5==ref="+code=syn" class=771   7     472    77>] & j++) {
       7                        -1; r<77        = *                k7id="L477" class="line" n7me="L777"> 477               7h/a>[ == [sodme="L511"> 511sod                                     ,
[r- =                    7a href="lib/bch.c#L481" 7d="L478ref">rows[,
p] =                        782        }
r] ^=                 7a>6< <7de=nsol" class="sref">ns7ode=rL494"7         7     }

 hrme="L511"> 511 hr                    ib/bch.c#L509" id="L5==ref="+code=syn" class=771 lib/bch.c#L447" idib/bch./a>      bs) *="L417"> 417   7     78bch.c#L447" id"e=bch_contro=bch_cont7ol" class ?="L368"> 368<7a>ref7nvme="L511"> 5        69a>-1;        ref="+cod->7     7   a_i     }
k<7a>; 7904"> 504< hring">"gcd(1   67code=p" class="sref">p<67> &g679" class="sref>sodme="L511">GreatestrCclaib/Divisor) r106" " id="ss=7line" name="L500"> a>);
7a hre79>
            f andde=binteger k, clas76 nTr(a^kX)ass="featestrCclaib/Divisor) r106" "                       6 so63.c#L5T="co"cous/e=k" BerlekampnTrac====gorithmef="+splitt>++)          seatestrCclaib/Divisor) r106" "     7   l6c

 c over GF(2^m).elp;


elp;
elp;
elp;
 511,
;
elp;
ezclass="sref">elp;
      m).
 57 f">klp;
elp;
eout68" 7d="L478" class="line hc#L498" 67="L469 name"L507">void"+7ode=e79ref="lib/bch.c#L383" id="L38s="line" 7ame="L508"> 508stati7 int 79sref"7a> == e="+code=syn" class=       7ef="+code=sol" class="sr7f">so7GF_M      7ef="+codGF_Mlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+lib/bch.c#L447" idib/bc8="lib/bch8c#L383" id="L38de=bch_co8trol"8class=<">cL447" id"e=bch_control" classp<68>mask80"sspresaX^="lib/inedean>
n8cdlasslib8bch.c#L447" id"e=bch_con8rol" 80="7a href="lib/bch.c#L422" 7d="L472>] z 416           sspresaX^ 0 8alues80     782 t" c="line" namz83" id="L38q">ezclas href="+               q">elp;

ezclas href="+             7f">tmp * 58*/8ezclas href="+             7f">tmp 368sod_s="li                                  57"
->          ae8bch_c8ntrol"
+eout68"  href="+               q">elp;
 c over GF(2^m).+ememsetlib/bch.c#LNULLb/bchout83" id="L38q">eout68" , 511,
ref="++code=elp" clas                 508stati8cted 8umbe92b/bch.c#L447" idib/bc8d="[X]c o8er GF(2^m).
 810"7a href="lib/bch.c#L422" 7d="L472>] clas76 nf>,
void"+8ode=e81c#Lrefsref> hrme="L511"> 5119ef="lib/bch.c#Lbspme="L511"> 511 511,
 5lib/bch.c#L447" idib/bc8e" name="8508"> 508static int 8a hre81ef="lib/bch.c#L=> c,
elp->,
 511 511mas=ecc" class="bspme="L511"> 511sod           81" class=8line" nlde=bch_control" 8class811;     6   if (8/a>,
 511mala hrib/bch.c#L447" iddz83" id="L38q">ezclas href="+               q">elp;
 5118ja>mask/a>,
j+eout68"  href="+            ef">k;  511ezclas href="+             7f">tmp,
 511 57ame="Lsod_s    z83" id="L38q">ezclas href="+             7f">tmp 511ezclas href="+             7f">tmp,
 511 511ezclas href="+             7f">tmp 511<+1"+code=rows" 7lass=76"> * 58f="+code=8" ca href/bch.c#L447" id893" i817         7               }
8yn7/a>[2*ezclas href="+               q">elp;
 5ode=k" class="sout83" id="L38q">eout68"  href="+               q">elp;
 416           ss<2e y B92<8a>
sout83" id="L38q">eout68"  href="+               q">elp;
ezclas href="+               q">elp;
 511 511ma-1""/bch.c#L447" idjme="L58         8 de8c8cheme="L511"> 511ezclas href="+               q">elp;

 486 42682lass="sref">j+ezclasslp" class=7sref"1"> 511,
 5lib/bch.c#L447" idib/bc8Berlekamp8Massey jme="L511"> 511mali82id="L5="line" name="L     }
 == eout68"  href="+            ef">k; eout68"  href="+               q">elp;
m;
eout68"  href="+               q">elp;
 404            8     8                     <>;
eout68"  href="+               q">elp;
8511ma-/bch.c#L447" i8d93" 83"sspresaX^="lib/inedean>
n8assey alg8rithm */
 511
 511 hr                    ib/bch.c#L509" id="L5==ref="+coout83" id="L38q">eout68" 7lib/bch.c#L447" idib/bc8="linebsp8e="L511"> 511 7     74 name="L504"> 58="line" n8me="L510"> 57" class="7r8f">ns83lass="sre7">p =  511
<
k++] =     83" class="sref>divme="L511"> 511div      class="li8h.c#L438"8id="56              8 7" i83"+code=find_affine4_roots" classfac 511elp;


;
elp;
 511,
div      class="li8h="+code=8a>++) {
elp;
elclasselp;
elp;

;
elp;
                6s>    ef"7gf_po72       ebch.c2t href="ib/bch.c#L447" idib/bc8 href="+c8de=t" c--mGF(2^m).tmp    ef"7gf_po72       ebch.c2t href1"ib/bch.c#L447" idib/bc8 "linebsp8"7class="li7e" name="L448"> 44843f="+code7 naif (tmp
    ef"7gf_po72       ebch.c2t href2"ib/bch.c#L447" idib/bc8 "line" n8 > c over GF(2^m).tmpezclas             6s>    ef"7gf_po72       ebch.c2t href3"ib/bch.c#L447" idib/bc8 .c#L447"8 cl74a linear system for8findi845f="+code7 naif (tmp
m"L431">void"+8ode=e84>+++)bch.c#...\nefsref> hrme="L511"> 511 hr                    ib/bch.c#L509" id="L5==ref="+co1"> 511,
7lib/bch.c#L447" idib/bc8e" name="8508"> 508static int 8a hre84 href="lib/bch.c#L=> elclas            6s>   1"> 511,
ib/bch.c#L447" idib/bc8f">j+8) {

   f=                div      class="li8417  8          7="lib/bch7c#L853" i85     782 t" c="line" namclas76 _trac=_bk="lib/bch.c#L509" iclas76 _trac=_bk="lip" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7k/span>
 511 511,
ezclasslp" class=7sref"tk/span>
p = 
8 5tk/span>
sodme="L511"> 511sod           8>elp;8 511sod           8ef">k8+] = e85id="L5="line" name="L511"> 511 hr  co"e=bch_control" cef> hr  co"e09" id="L5==ref="+co1     sL511"> 511 511,
lib/bch.c#L447" idib/bc8 " name="8de=t" caibr of solutions8*/ 458   find_affine4_r hrefcm */find_affine4_r href="+code=elp" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=71     sL511"> 511
 5find_affine4_r hrefcm */<=t" c"+code=deg" class="sref"7a>       7         511,
ref="++code=elp" clas                sod           8     8          7ff">r7<8 sody f anddq11"> 511sod           8         8 7fss="line7href="+code=8" cla86="L393" cdlass/ef="+code=syn" class=7"ref">s="sref">find_affine4_r href="+code=elp" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=71"> 511,
 c over GF(2^m).++)f511"> 511sod           8r" clas7=8sre76.c#L503" id="L503" 8lass=86ass="f">elp->
melp;
 511 511,
lcode=c/a>,
       7     ].ode+code=elp" cbch.83" id="L38q">ebch.a hrib/bch.c#L447" idib/bc8id="[X]c 8ver GF(2^m).
 511 hr  co"e=bch_control" cef> hr  co"e09" ine4_roots" class=83" id="L38q">elclasseode=c/a>,

 href=8+code86ode=l" class="ib/bch.v href="+code=j" class=ef> hr  co"e=bch_control" cef> hr  co"e09" ine4_roots" class
;8me="L511"> 511g8d    86" id="L393" class="+l     74 name="L504"> 58ef="lib/b8h.c#L383" id="L38ib/bch.8#L50986 0;
elp;
 5 finddroots7           , us>++)BTZ===gorithm; seea =e begin-Mas7
so63.c#L"> 511sod           8.c#L509" 8d="L5/bch.c#L494" id="L484"7/a8-1;  hr  roots"> 511 hr  roots09" iass="sref">elp;


elp;
tmpebch.a hr7tmp 511ecnta hrib/bch.c#L447" idib/bc8lef"/bch.8#L447" idib/bch.c#L509" 8d="L587n7       if7 lp;
elp;
    ib/bch.c#L447" idib/bc8lb/bch.c#8e=t" ca  hr 0"+code=deg"8class87mbe92b/bch.c#L447" idib/bc8         8                5bch.83" id="L38q">ebch.a hrref="++code=elp" clas                sod           8.c#L509" 8d="L5/bch.c#L494" id="L484"7s18/a>   7a href="lib/bch./bch.c#L422" 7d="L472>] handla>,
whdegre name="L504"rery Beaddhoc techniq hreL"> 511sod           8trol" cla8s/bch.c#L494" id="L494"78     8  7     }
sod           8t="+code=88      782        }
ecnta hr            6s>   1ind> hr  =eg1 roots"> 511 hr  =eg1 rootsp" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7bch.83" id="L38q">ebch.a hr7<"7f">tmp 511 511sod           8t        8
ecnta hr            6s>   1ind> hr  =eg2 roots"> 511 hr  =eg2 rootsp" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7bch.83" id="L38q">ebch.a hr7<"7f">tmp 511     8bs) *="L417"> 417   8     88id="L5="line" name="Lbreakib/bch.c#L447" idib/bc8 ef"/bch.8ol" class ?="L368"> 368<8a>ref8nvme="L511"> 5case 3:efsref>sod           8tb/bch.c#8->8     887         7            ecnta hr            6s>   1ind> hr  =eg3 roots"> 511 hr  =eg3 rootsp" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7bch.83" id="L38q">ebch.a hr7<"7f">tmp 511k<8a>; 89                       68code=p" class="sref">p<68> &g6891me="L511"> 5case 4:efsref>sod           8" id="ss=8line" name="L500"> a>);
8a hre89 7     }
cnt83" id="L38q">ecnta hr            6s>   1ind> hr  =eg4 roots"> 511 hr  =eg4 rootsp" clch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7bch.83" id="L38q">ebch.a hr7<"7f">tmp 511 default:efsref>sod           8"rol" cla8g> c over GF(2^m). 511sod           8s="sref6>8cnt83" id="L38q">ecnta hr   de=rows" 7lass=76"> * 58s/a>     8m).
 5bch.83" id="L38q">ebch.a hrref="++code=elp" clas                m 5k/span>
so7GF_M      7ef="+codGF_Mlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+l)rsod           8c#L498" 68="L469 name"L507">void"+8ode=e89vme="L511"> 511 511
 511ebch.a hr7<"lib/bch.c#L=>     7ib/bch.c#L447" idib/bc8"b/bch.c#8ame="L508"> 508stati8 int 89509 href="+code=elp" class="ss="srd2me="L511"> 511d_affine4_r href1a hr7d="L478" class="line 9="lib/bch9c#L383" id="L38de=bch_co9trol"90                    cnt83" id="L38q">ecnta hr +           6s>   1ind> hr  roots"> 511 hr  roots09" ich.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7k/span>
tmp 511p<69>mask90="L393" cdlass/ef="+code=syn"s="srd2me="L511"> 51     7b/bch.c#L447" idib/bc9=2lib/bch9cine" name="L500"> a>);
9rol" 9047" idd93" id="L393" cdlass/el" lclas/bch.7#L48278">cnt83" id="L38q">ecnta hr +           6s>   1ind> hr  roots"> 511 hr  roots09" ich.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7k/span>
    sL511"> 511 511 446ecnta hr7ib/bch.c#L447" idib/bc9=3lib/bch9c/a>              6         }lib/b77, unsigned inwh9notr et t9 1c*+c over GF(2^m).
 5119ecnta hrib/bch.c#L447" idib/bc9a7->
+void"+9
 508stati9cted 9umbe92#s="++code=elp" clasvoid"+9ode=e91" class="sref>sodme="L511"> 5 exhausaive root search"sChien) implem"libspme=- not us/e7<="cluded="nly=forwitdivislib/quotiaX^ r106" i9a2lib/bch9508"> 508static int 9a hre91>
so63.c#L"> 511sod           91" class=9line" nlde=bch_control" 9class911; echien_search09" iass="sref">elp;


elp;
9/a>,
tmpeba hr7tmp 511 5119ja>mask/a>,
 511masefsref>sod           9e8-> 5e=t" cref="+code=syn" class=rol" class

ecounta hr   de=rows" 7lass=76"> * 59f="+code=9" ca href/bch.c#L447" id993" i917         7  ref">ee=t" cref="+code=syn" class=k/span>
tmp
 446 511masefsref>sod           9ass="72> 9 1 << 9204"> 504< hring">"gcd96"> 416           ss<2e y B92<9a>
elp;L"> 511sod           96" name="9d solutions
 cla9247" idd93" id="+            9ef="lib/bch.c#Lbspme="L511"> 511eba hr7 446 5lib/bch.c#L447" idib/bc9       7 9   }
 5code=c/a>,
eba hr href="+               q">elp;
 * 59         9 de9c9cheme="L511"> bch.c#L393" id=syn0/span>
eba hr href="+             7f">tmpeba hr href="+             7f">tmp,
eba hr href="+               q">elp;
9                      486 42692lass="sref">jf="+code=rem" cf">elp->,lass="sr7f">so7GF_N      7ef="+codGF_Nlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+l+code=p" cla7s="k/span>
 511,lass="sr7f">so7GF_N      7ef="+codGF_Nlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+ls=ecc" class="bspme="L511"> 511sod           9Berlekamp9Massey jme="L511"> 511mali92id="L5="line" name="L+/bch.c#L422" 7d="L472>] clas76 nelp(a^i)aL"> 511sod           968-> 511 511mala hrib/1code=syn" class=7syn/span>
,lass="sr7f">so7syn0/span>
,lass="sr7f">so7b83" id="L38q">eba hr href="+               q">elp;
sod           9B="+code=9>mai=+code=deg" class="s9ef"7"92509 href="+code=elp" class="sode=syn" class=ame="L511"> 511ma            6s>    ef"7gf_po72        5code=c/a>,
 511 404            9     9                      5ame="L511"> 511ma id="L4
7d="L478" class="line 9e="L511">9511ma-/bch.c#L447" i9d93" 93="L393" cdlass/ef="+code=syn""L511"> bch.c#L393" id=syn/span>
 511ma7e> 446 511tmp 511
 511        }=511sod           9="line" n9me="L510"> 57" class="7r9f">ns93heme="L511"> 511 511,
ecounta hr++pe09ef="lib/bch.c#LGF_N      7ef="+codGF_Nlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+l+code=p" cla7s="me="L511"> 5119idpme="L511"> 511ecounta hr  >,lass="sr7f">so7b83" id="L38q">eba hr href="+               q">elp;
k++] =     93id="L5="line" name="L     }
ecounta hr  >,lass="sr7f">so7b83" id="L38q">eba hr href="+               q">elp;
ecounta hr : de=rows" 7lass=76"> * 59code=t" c9ib/bch.c#L447" idd93" id9"L39394ref="     }
   1ind> hr  roots"> 511 hr  roots09" ich.c#LNULLb/bch_b83" id="L38q">e_ba hr7 446
 511
 511tmpechien_search09" ich.c#LNULLb/bch_b83" id="L38q">e_ba hr7 446
 511
 511tmp 511sod           9 "linebsp9"7class="li7e" name="L449"> 44943f="+efsref>sod           9 "line" n9 > c over GF(2^m).
<
m"L431">void"+9ode=e94" class="sref>divme="L511"> 5 @data:="+co  ceivedddata, ignorref=f @calc_ecco"coprovide"09testrCclaib/Divisor) r106"9=.c#L438"9508"> 508static int 9a hre94 hrefss="sref>divme="L511"> 5 @len:f="+codata length in bytes, must always beoprovide"09testrCclaib/Divisor) r106"9=="+code=9383" id="L38ib/bch.c#L509" id=9L509 hss="sref>divme="L511"> 5 @  cv_ecc:o  ceiveddecc,f=f    diume it was XOR/e=k" @calc_ecc09testrCclaib/Divisor) r106"9f">j+9) {
 5 @syn:f="+cohwoclas76 ddsyndromeodata (=f    <,dsyndromeo"cocalculated)witdivislib/quotiaX^ r106" i9 href="+c9de=t" caib/bch.c#L447" i9"e=bc95>
  9          7="lib/bch7c#L953" i95de=sol" class="sr6f">so63.c#LeatestrCclaib/Divisor) r106"94"line" n9               9
<
k9+] = e95" class="sref>divme="L511"> 509testrCclaib/Divisor) r106"9e.c#L438"9de=t" caibr of solutions9*/ 5 Dependsas7 5 separltely (us>++)enrefs_r10()),a ="cofuncspme=should beocalledery Beone ofeatestrCclaib/Divisor) r106"9     9          7ff">r7<9 ++) arlibtecade=figurbspmes -eatestrCclaib/Divisor) r106"9 5eatestrCclaib/Divisor) r106"9 c over GF(2^m).
++)@data andd@  cv_ecc="nly:eatestrCclaib/Divisor) r106"9r" clas7=9sre76.c#L503" id="L503" 9lass=96de=sol" class="sr6f">so63.c#L5  derefs_r10(@) r,)@data, @len,d@  cv_ecc,    <,d   <,d@errlo )witdivislib/quotiaX^ r106" i9id="[X]c 9ver GF(2^m).

witdivislib/quotiaX^ r106" i9i.c#L447"9 cla76a lin"L431"> href=9+code96 be92
<
++)@  cv_ecc=andd@calc_ecc:witdivislib/quotiaX^ r106" i9i"[X]c ov9me="L511"> 511g9d    96a7                k9h.c#L383" id="L38ib/bch.9#L50996" class="sref>divme="L511"> 509testrCclaib/Divisor) r106"9ref="+cod9=elp" class="sref">elp;
 5 byoprovid>++)ecc==   cv_ecc=XOR calc_ecc:witdivislib/quotiaX^ r106" i9i="+code=9           5 = derefs_r10(@) r,)   <,d@len,d   <,decc,d   <,d@errlo )witdivislib/quotiaX^ r106" i9"lib/bch.9#L=bgt;  5 byoprovid>++)syndromeoresults @syn:09testrCclaib/Divisor) r106"9&href="+c9 {

so63.c#Lwitdivislib/quotiaX^ r106" i9"d="[X]c 9d="L5/bch.c#L494" id="L494"7/a97class="comss="snam */
 Onc   siaive value,perrbcwitdivislib/quotiaX^ r106" i9".c#L447"9s/bch.c#L494" id="L494"79ass="97 be92
<
k9         7h/a>[ 5 divme="L511"> 5 data cor  cspme5witdivislib/quotiaX^ r106" i9l="+code=9e=t" ca  hr 0"+code=deg"9class97509 hss="sref>divme="L511"> 5witdivislib/quotiaX^ r106" i9         9                5 cor  csedery Bee=fiem"li data[errlo [n]/8pe" n1 i 
98de=sol" class="sr6f">so63.c#L5Notea =ata ="cofuncspme=does not perform any data cor  cspme byoitself,oiteatestrCclaib/Divisor) r106"9.d="[X]c 9  }

 merely inds bsesperrbchlo bspmes.eatestrCclaib/Divisor) r106"9..c#L447"9  7     }

<
 511sod           9t        9
elp;
elp;

el" class=olutiou="+8_t83" id="L38q">eu="+8_tcontrol" class=olutiodataq">elp;

elp;
     9bs) *="L417"> 417   9     98id="L5="line" name="ref">el" class=olutiou="+8_t83" id="L38q">eu="+8_tcontrol" class=olutio  cv_ecc"> 511el" class=olutiou="+8_t83" id="L38q">eu="+8_tcontrol" class=olutiocalc_ecc"sref>   sspme="Llc_ecc09ass="sref">elp;
 368<9a>ref98vme="L511"> 511ee=t" cref="+col" class=olutiosyn/span>

->9     987    refsref>sod           9"sref">k<9a>; 99             ref">ee=t" cref="+code=syn" class=ecc_words"> 511ma            6s>   BCH_ECC_WORDS"> 511sod           9"c#L509" 9code=p" class="sref">p<69> &g6991me="L511"> 5e=t" cref="+code=syn" class=nbits"> 511masefsref>sod           9" id="ss=9line" name="L500"> a>);
9a hre99 7     }

 511sod           9"" clas7=9              6  t" c="line" namu="+32_t83" id="L38q">eu="+32_t    7l" class=olutiosuame="L511"> 511sod           9"d="[X]c 9l6c
p =  c over GF(2^m). 511sod           9s="sref6>9tmp
 5bch.c#LNULLb/bch.c#L509" iNULL    =ref="+ href="+            n/span>
 511ma)7    }
     9m).
 511sod           9"ef"/bch.9="L469 name"L507">void"+9ode=e99 href="lib/bch.c#L=>  508stati9 int 99509 href="+co+/bch.c#L422" 7d="L472>]  511sod           10="lib/bch10="li"L508"> 508stati10="l>10="e=bch_contro
p<610=od>10=="L393" cdlass/ef="+c   sspme="Llc_ecc09as1sod           10=2lib/bch10=ine" name="L500"> a>);
10=in>10=47" idd93" id="L393" cdlass/e+/bch.c#L422" 7d="L472>] clas76 n  ceivedddata ecc=="+o anointecnal buffer=*"> 511sod           10=3lib/bch10=/a>              6 10=ass="f">elp->elp;
 511 511 511sod           10=5lib/bch10=> c over GF(2^m). >10=ode=l" class="ib/bch.v href="+code=j" class=enrefs_r10"> 511elp;
 446
 511                sod           10=6lib/bch10=/a69 monic polynomial X10=/a>10=" id="L393" class="+l  elsesod           10=7lib/bch10=).
10=id="L5="line" name="Lcdlass/e+/bch.c#L422" 7d="L472>] loadoprovide" calculateddecc=*"> 511sod           10=8lib/bch10="L469 name"L507">void"+10="L>10=vme="L511"> 511
 511   sspme="Llc_ecc09as1sefsref>sod           10=9lib/bch10=me="L508"> 508stati10=me>10=509 href="+code=elp"      }

10er09 href="+code=elp" +/bch.c#L422" 7d="L472>] loado  ceiveddecc bchadiume it was XOR/e=k" calc_ecco*"> 511sod           1011lib/bch10b/bc71name="L431">void"+10b/b>10e="L393" cdlass/ef="+c 511sod           1012lib/bch10508"> 508static int 10508>10e47" idd93" id="L393" cdlass/e+code=j" class=load_ecc8/span>
 511sod           1013lib/bch10383" id="L38ib/bch.c#L5010383>10eass="f">elp-> 511sod           1014lib/bch10line" nlde=bch_control" 10lin>10eheme="L511"> 511elp->,0code=syn" class=7suame="L511"> 511 511 511 511mas=ecc" class="bspme="L511"> 511sod           10e5lib/bch10/a>,
>10ee7p;  511,
 511 511sod           1016lib/bch10ja>mask/a>,
 511 511,
 511sod           1017lib/bch10L509" id="L510evme="L511"> 511 51110e509 href="+code=elp" class="sssssss/e+/bch.c#L422" 7d="L472>] noperrbchfound=*"> 511sod           102"lib/bch10 1 <<  511 * 510 1lib/bch10>           ss<2e y B92<10>  >10 ="L393" cdlass/ef="+c     }

10  7     }
clas76 _syndromes"sref>   sspme="las76 _syndromeslib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+b/bch.c#L393" id= ef"7gf_po72        511
 * 510 3lib/bch10   }
,lass="sr7f">so7 ef"7gf_po72       
 * 510 4lib/bch10 de10 10 heme="L511">      }
10 }
 486 >10 de=bch_controbch.c#L393" id=err/span>
so7"las76 _errbc_lo bsss_          "> 511
 * 510 7lib/bch10Massey jme="L511"> 51110  0;
 511sod           10 8lib/bch10 href="lib/bch.c#L=> 10 hr>10 n7       if7 name="L458"> 458   nroots"> 511   1ind> hr  roots"> 511 hr  roots09" ich.c#LNULLb/bch.c#L509" iNULL    =ref="+co1code=syn" class=7 ef"7gf_po72       
 511
 * 510 9lib/bch10>mai=+code=deg" class="s10>ma>10 7         7          s="srd2me="L511"> 5err/span>
 511 404            1004">1004de=l" class="ib/bch.v href="+code=j" class=err/span>
 * 51031lib/bch10511ma-/bch.c#L447" i10511>1001eme="L511">      }

10020;
 511sod           1033lib/bch10e="L511"> 511100     782        }
/bch.c#L422" 7d="L472>] post-process rawperrbchlo bspmes"f="+easiecader  cspme *"> 511sod           1034lib/bch10me="L510"> 57" class="7r10me=>100heme="L511"> 511 511maa>,hss="/bch.c#L447len/span>
 446 511masefsref>sod           1005lib/bch10idpme="L511"> 511100e7p; elp->,0ea href="lpme="L511"> 511 511sod           1036lib/bch10e" name="Lsb/bcode=a_pow10e" >100de=bch_control" lclass)]/ef="=a hss="/bch.c#L447errlo /span>
,
 511 511ma=sod           1037lib/bch10f">k++] = >100id="L5="line" name="Lcdlass/ev href="+code=j" class=err/span>
 * 51038lib/bch10id="56              10id=>100vme="L511"> 511++) {
+>100509 href="+code=elp" class="s     }
10ibde=l" class="ib/bch.v href="+code=j" class=errlo /span>
,
 511 511ma-1+code=p" cla7s="errlo /span>
,
 511serrlo /span>
,
 511,
 511m
,
 511m * 51042lib/bch10de=t" c--mGF(2^m).10i47" idd93" id="L393" lib/b77, unsigned inwh10i3lib/bch10"7class="li7e" name="L4410"7c>10i     782 lib/b77, unsigned inwh10i4lib/bch10 > c over GF(2^m). >10iheme="L511">        href="lib/bch.c#err/span>
 =511
 511masefsref>sod           1045lib/bch10 cl74a linear system for10 cl>10ie7p; lib/b77, unsigned inwh10i6lib/bch10r GF(2^m).
10ia7    ode=p" cla7s="EXPORT_SYMBOL_GPL"> 511elp;
 * 51047lib/bch10ss="7ref">m"L431">void"+10ss=>10i7
 508static int 10508>10i hrefss="sref>divme="L511">dewitdivislib/quotiaX^ r106" i10i9lib/bch10383" id="L38ib/bch.c#L5010383>10i509 hss="sref>divme="L511"> 5 generlte Galo"cofieldhlookup tableseatestrCclaib/Divisor) r106"105"lib/bch10) {
10) 09 hss="sref>divme="L511"> 5"> 511sod           1051lib/bch10" ca  hrib/bch.c#L447" i10" c>10)="L39e=find_="+code=syn" class=build_gf_tables"7gf_po72       uild_gf_tables09" iass="sref">elp;

ebch.a hr7    }
10)47" irefsref>sod           1053lib/bch10          7="lib/bch7c#L10   >10)     782 e=t" cref="+code=syn" class=rol" class * 51054lib/bch10                ref">ee=t" cref="+code=syn" class=k/span>
elp;
 5bch.83" id="L38q">ebch.a hr7e=rows" 7lass=76"> * 51055lib/bch10X+c over GF(2^m).10X+c>10)}
elp;must be ofhdegre nm *"> 511sod           1057lib/bch10+] = 10) 0;
sod           1058lib/bch10de=t" caibr of solutions10de=>10)vme="L511"> 511 * 51059lib/bch10ss="li obr of solutions 10ss=>10)mbe92b/bch.c#L447" idib/bc106"lib/bch10          7ff">r7<10   >10  me="L511"> 5f="+code=rem" cf">elp->,0ea href="lpme="L511"> 511 511sod           10 1lib/bch10 7fss="line7href="+code=10 7f>10 a>   7a href="lib/bch.> 446,
 511 * 51062lib/bch10g> c over GF(2^m). >10  7     }
 ef"7gf_po72       ,
 51110      782        } 511m 5xol" class 511 511sod           10 5lib/bch10 cla76a lin"L431"> href=10 cl>10 e7p;  * 51066lib/bch10me="L511"> 511g10me=>10 de=bch_control" lclas/bch.7#L48278">xol" class * 51067lib/bch10h.c#L383" id="L38ib/bch.10h.c>10 id="L5="line" name="Ls="srd2me="L511"> 5xol" class
sod           1068lib/bch10=elp" class="sref">elp10 vme="L511"> 511ebch.a hre=rows" 7lass=76"> * 51069lib/bch10          10 509 href="+colib/b77, unsigned inwh107"lib/bch10#L=bgt; ,
,1e=rows" 7lass=76"> * 51071lib/bch107;s)="c over 09ef="107;s>10#1e=bch_controbch.c#L393" id= ef"7gf_po72        * 510#2lib/bch10 {
10#2be92b/bch.c#L447" idib/bc1073lib/bch10" ca href/bch.c#L447" id10" c>10#     782        de=rows" 7lass=76"> * 51074lib/bch10d="L5/bch.c#L494" id="L410d=">10#47p; lib/b77, unsigned inwh1075lib/bch10s/bch.c#L494" id="L494"710s/b>10#}
10#a7                [10#" class="sref>divme="L511"> 5 clas76 ngenerltssp           remainder tables5f="+fast enrefingwitdivislib/quotiaX^ r106" i1078lib/bch10#L447" idib/bch.c#L509" 10#L4>10# hrefss="sref>divme="L511"> 5"> 511sod           1079lib/bch10e=t" ca  hr 0"+code=deg"10e=t>10#9"L39e=find_voidcode=syn" class=build_mod8_tables"7gf_po72       uild_mod8_tables09" iass="sref">elp;

el" class=olutiou="+32_t83" id="L38q">eu="+32_t    7ol" class=olutio q">elp;
sod           1081lib/bch10d="L5/bch.c#L494" id="L410d=">10 1e=bch_contro="+code=syn" class=rol" class * 51082lib/bch10s/bch.c#L494" id="L494"710s/b>10 47" idd93" id="+            u="+32_t83" id="L38q">eu="+32_t    7l" class=olutiodataq">elp;
 446
 * 51083lib/bch1010      782 ref">e="+code=syn" class=l/span>
,ode=syn" class=BCH_ECC_WORDS"> 511sod           10 4lib/bch10  }
10 heme="L511"> ref">e="+code=syn" class=blen/span>
,ode=syn" class=DIV_ROUND_UP/span>
 511ma+1co32lsefsref>sod           10 5lib/bch10  7     }
10 5eme="L511"> ref">e="+code=syn" class=ecclen/span>
,ode=syn" class=DIV_ROUND_UP/span>
 511maco32lsefsref>sod           10 6lib/bch10
 417   10bs)>10 77" idd93" id="+            memset83" id="L38q">ememsetlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+f="+code+code=elp" cmod8_tab83" id="L38q">emod8_taba>maco0, 4*256f"7f">tmp

emod8_taba>ma)7e=rows" 7lass=76"> * 51088lib/bch10ol" class ?="L368"> 368<10ol">10  href="lib/bch.c#L=> ->1010 509 href="+cof="+code=rem" cf">elp->,0ea href="lpme="L511"> 511 511sod           109"lib/bch10a>; ;>10a>e=bch_control" lclas//bch.c#L422" 7d="L472>] p(X)=i;is a smallp           of weight ideg>,8 5"> 511sod           1091lib/bch10code=p" class="sref">p<610cod>10aa>   7a href="lib/bchf="+code=rem" cf">elb"7gf_po72      b"+coa>,0ea href="lpme="L5b"7gf_po72      b"+coa=deg 4ea href="lpme="L5b"7gf_po72      b"+co e=sod           1092lib/bch10line" name="L500"> a>);
10lin>10a47" idd93" id="L393" cdlass/e+/bch.c#L422" 7d="L472>] we wa"+cto clas76 n(p(X).X^(8*b+deg(g))) mod g(X) 5"> 511sod           1093lib/bch10              6 10aass="f">elp->,lass="sr7f">so7 ef"7gf_po72       emod8_taba>ma ++code=rem" cf">elb"7gf_po72      b"+co*2567e> 446 511tmp
 * 51094lib/bch10l6c
 511elp;
 511tmp * 51095lib/bch10g> c over GF(2^m). >10ae7p; eldataq">elp;
sod           1096lib/bch1010ade=bch_control" lclass)]/ef="+code=syde=syn" class=7" id="L393" classa hr L4ode=syn" class=de q">elp;
 5dataq">elp;
 * 51097lib/bch10m).
10aid="L5="line" name="Lcdlass/ev href="+/bch.c#L422" 7d="L472>] fubtra"srX^d.g(X) from p(X).X^(8*b+deg(g)) 5"> 511sod           1098lib/bch10="L469 name"L507">void"+10="L>10avme="L511"> 511elp;
elp;
 5b31+code=p" cla7s="" id="L393" classa hr=e=rows" 7lass=76"> * 51099lib/bch10ame="L508"> 508stati10ame>10a509 href="+code=elp" class="sssssss/e/bch.c#L447" idjme="L511"> 511mala hrib/0ea href="lpme="L5"7s*
sod           11="lib/bch11="li"L508"> 508stati11="l>1101eme="L511"> 511elp;
 * 51101lib/bch11=ode=p" class="sref">p<611=od>11=="L393" cdlass/ef="+cv href=" name="L""""""""+code=j" class=lo/span>

 * 51102lib/bch11=ine" name="L500"> a>);
11=in>11=47" idd93" id="L393" cdlass/ev href=" name="L""""""""+code=j" class= q">elp;
 5b31+code=p" cla7s="" id="L393" classa hr=<: de=rows" 7lass=76"> * 51103lib/bch11=/a>              6 11=ass="f">elp->
 * 51104lib/bch11=6c
 511 c over GF(2^m). >11=ode=l" class="ib/bch.v href="lib/b77, unsigned inwh11=6lib/bch11=/a69 monic polynomial X11=/a>11=" id="L393" class="+l ib/b77, unsigned inwh11=7lib/bch11=).
11=id="L5="line" ib/b77, unsigned inwh11=8lib/bch11="L469 name"L507">void"+11="L>11=vme=" ib/b77, unsigned inwh11=9lib/bch11=me="L508"> 508stati11=me>110mbe92b/bch.c#L447" idib/bc111"lib/bch11er GF(2^m).
111 09 hss="sref>divme="L511">dewitdivislib/quotiaX^ r106" i1111lib/bch11b/bc71name="L431">void"+11b/b>111" class="sref>sodme="L511"> 5 build a base5f="+factor>++)degre n2p          seatestrCclaib/Divisor) r106"1112lib/bch11508"> 508static int 11508>111>
 511sod           1113lib/bch11383" id="L38ib/bch.c#L5011383>11eass="e=find_="+code=syn" class=build_deg2_base"7gf_po72       uild_deg2_base09" iass="sref">elp;

11eheme=refsref>sod           11e5lib/bch11/a>,
>1115eme="L511"> ref">e="+code=syn" class=ame="L511"> 511ma            6s>   GF_M      7ef="+codGF_Mlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+le=rows" 7lass=76"> * 51116lib/bch11ja>mask/a>,

 * 51117lib/bch11L509" id="L5 511ey"+cob/bch.c#L393" id=remain>++/span>
++"+cob/bch.c#L393" id=ak/span>
 511ma]ib/bch.c#L447" idib/bc1118lib/bch11 {
111 href="lib/bch.c#L=> 11e509 href="+co+/bch.c#L422" 7d="L472>] finddk s.t. Tr(a^k)   1 andd0 ideg>,k idegcm *"> 511sod           112"lib/bch11 1 <<  5f="+code=rem" cf">elp->,0ea href="lpme="L511"> 511 511mas=ecc" class="bspme="L511"> 511sod           11 1lib/bch11>           ss<2e y B92<11>  >11 ="L393" cdlass/ef="+c/bch.c#L447" idjme="L511"> 511mala hrib/0code=syn" class=7suame="L511"> 511 511mas=ecc" class="bsp"7s*sod           11 2lib/bch11d solutions
11  7     }
 511 511 * 511 3lib/bch11   }
sod           1124lib/bch11 de11 112heme="L511"> 511 5suame="L511"> 511sod           11 5lib/bch11                     112ode=l" class="ib/bch.v href="+code=j" class=ak/span>
so7 ef"7gf_po72       ,
 511 * 511 6lib/bch11"> 486 >112de=bch_control" lclass)]/ef="breakib/bch.c#L447" idib/bc11 7lib/bch11Massey jme="L511"> 511112id="L5="line" name="L ib/b77, unsigned inwh11 8lib/bch11 href="lib/bch.c#L=> 11 hr>11 n7       if7  ib/b77, unsigned inwh11 9lib/bch11>mai=+code=deg" class="s11>ma>112509 href="+co+/bch.c#L422" 7d="L472>] finddxi, i=0..m-1 sucha =ataxi^2+xi   a^i+Tr(a^i).a^k *"> 511sod           113"lib/bch1104"> 404            1104">113Le=bch_controbch.c#L393" id=remain>++/span>
++"+co   lass="sr7f">so7ame="L511"> 511masefsref>sod           1131lib/bch11511ma-/bch.c#L447" i11511>1131e=bch_controbch.c#L393" id=memset83" id="L38q">ememsetlib/bch.c#LNULLb/bchxrol" class * 51132lib/bch11rithm */
1132be92b/bch.c#L447" idib/bc1133lib/bch11e="L511"> 511110     782 /bch.c#L447" idjme="xol" class 5xol" classm++/span>
++"+co/abch.c#L393" id=xol" class 57" class="7r11me=>110heme="L511"> 511ey"+co   lass="sr7f">so7gf_sqr/span>
 * 51135lib/bch11idpme="L511"> 511110e7p; elp->,0ea href="lpme="L511"> 511 511sod           1136lib/bch11e" name="Lsb/bcode=a_pow11e" >110de=bch_control" lclass)]/ef="bch.c#L393" id=r/span>
so7relog"7gf_po72      reloglib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+code=syn" class=7.83" id="L38q">ey"+co7e=rows" 7lass=76"> * 51137lib/bch11f">k++] = >110id="L5="line" name="Lcdlass/es="srd2me="L511"> 5.83" id="L38q">ey"+co =sref">m 5r/span>
 511ma)e=sref">msod           1138lib/bch11id="56              11id=>110vme="L511"> 511so7 ef"7gf_po72        * 51109lib/bch11a>++) {
+>110509 href="+code=elp" class="s""""""""lass="sr7f">so7xrol" class,1e=rows" 7lass=76"> * 5114"lib/bch11ib/bch.c#L447" idd93" id11ib/>11ibde=l" class="ib/bch.v href="s)]/ef="bch.c#L393" id=remain>++/span>
++"+co--e=rows" 7lass=76"> * 51141lib/bch11a href="lib/bch.c#L=>11a h>11i="L393" cdlass/ef="+code=syn"s)]/ef="bch.c#L393" id=db q">elp;
++">"xich.cda>,ich.cx\n"> 511
 * 51142lib/bch11de=t" c--mGF(2^m).11i47" idd93" id="L393"                 breakib/bch.c#L447" idib/bc11i3lib/bch11"7class="li7e" name="L4411"7c>114ass="f">elp-> c over GF(2^m). >114heme="L511"> 511ey"+co " name="Lsod_s    rk/span>
114e7p; m"L431">void"+11ss=>11477" idd93" id=/bch.c#L422" 7d="L472>] fhould not happen but check anyway *"> 511sod           1148lib/bch11508"> 508static int 11508>114vme="L511"> 5       bch.c#L393" id=remain>++/span>
++"+co ? -1 : de=rows" 7lass=76"> * 511i9lib/bch11383" id="L38ib/bch.c#L5011383>11i509 h ib/b77, unsigned inwh115"lib/bch11) {
11) 09 hib/b77, unsigned inwh1151lib/bch11" ca  hrib/bch.c#L447" i11" c>11)="L39e=find_voidcol" class=olutions<_allo /span>
esize_t"+co ch.c#LNULLb/bchsize83" id="L38q">esize="lico="+col" class=olutioerr83" id="L38q">eerr="li=efsref>sod           1152lib/bch11de=t" caib/bch.c#L447" i11de=>11)47" irefsref>sod           1153lib/bch11          7="lib/bch7c#L11   >11)     782 voidcol" class=olutioptr83" id="L38q">eptrclasib/bch.c#L447" idib/bc1154lib/bch11               p = 11X+c>115ass="sre75" i+" class=olutioptr83" id="L38q">eptrclasaL4ode=syn" class=kmallo /span>
esize="lico         6s>   GFP_KERNEL"> 511 * 51156lib/bch11eptrclasaLL4ode=syn" class=f=                 * 51157lib/bch11+] = 115id="L5="line" name="Lol" class=olutioerr83" id="L38q">eerr="lia>,1e=rows" 7lass=76"> * 51158lib/bch11de=t" caibr of solutions11de=>115vme="L511"> 5       bch.c#L393" id=ptr83" id="L38q">eptrclasib/bch.c#L447" idib/bc1159lib/bch11ss="li obr of solutions 11ss=>115509 h ib/b77, unsigned inwh116"lib/bch11          7ff">r7<11   >116 09 hib/b77, unsigned inwh11 1lib/bch11 7fss="line7href="+code=11 7f>116" class="sref>sodme="L511">dewitdivislib/quotiaX^ r106" i1162lib/bch11g> c over GF(2^m). >116>
116de=sol" class="sr6f">so63.c#L"> 511sod           1164lib/bch11ver GF(2^m).
11 heme=e=find_bch.c#L393" id=u="+32_t83" id="L38q">eu="+32_t    7ol" class=olutio"las76 _generltss_          "> 511elp;

 href=11 cl>11 e7p; refsref>sod           1166lib/bch11me="L511"> 511g11me=>11 de=bch_controref">ee=t" cref="+code=syn" class=ame="L511"> 511ma            6s>   GF_M      7ef="+codGF_Mlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+le=rows" 7lass=76"> * 51167lib/bch11h.c#L383" id="L38ib/bch.11h.c>11 id="L5="line"ref">ee=t" cref="+code=syn" class=t83" id="L38q">eta>ma            6s>   GF_T      7ef="+codGF_Tlib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+le=rows" 7lass=76"> * 51168lib/bch11=elp" class="sref">elp11 vme="L511"> 5="+code=syn" class=nL509" iNULL    nclassL511"> 511eerr="lia>,de=rows" 7lass=76"> * 51169lib/bch11          11 509 href="+coe=t" cref="+code=syn" class=rol" class 511mab/bch.c#L393" id=r/span>

 511sod           117"lib/bch11#L=bgt; elp;
egf_bch.control" class=olutio q">elp;
sod           1171lib/bch117;s)="c over 09ef="117;s>11#1e=bch_controbch.c#L393" id=u="+32_t83" id="L38q">eu="+32_t    7ol" class=olutio enbch.83" id="L38q">egenbch." csod           1172lib/bch11 {
11#2be92b/bch.c#L447" idib/bc1173lib/bch11" ca href/bch.c#L447" id11" c>11#     782 l" class=olutio q">elp;
so7 ef_allo /span>
 511maol" class=olutiot83" id="L38q">eta>ma),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           1174lib/bch11d="L5/bch.c#L494" id="L411d=">1174    782 l" class=olutioroots"> 511so7 ef_allo /span>
 511eerr="li=sefsref>sod           1175lib/bch11s/bch.c#L494" id="L494"711s/b>117ass="sre75" i+" class=olutio enbch.83" id="L38q">egenbch." c<   lass="sr7f">so7 ef_allo /span>

 511maol" class=olutiot83" id="L38q">eta>ma+1co32l*sizeof(ol" class=olutio enbch.83" id="L38q">egenbch." c<),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           1176lib/bch111176
[117 0;
sod           1178lib/bch11#L447" idib/bch.c#L509" 11#L4>117n7       if7 name="L458"> 458   kfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch enbch.83" id="L38q">egenbch." c<)sefsref>sod           1179lib/bch11e=t" ca  hr 0"+code=deg"11e=t>117509 href="+code=elp" +" class=olutio enbch.83" id="L38q">egenbch." c<   lass="sr7f">so7f=                sod           118"lib/bch11               so7finis#L509" iNULL    finis#a hrsefsref>sod           1181lib/bch11d="L5/bch.c#L494" id="L411d=">1181eme="L511">      }
1182be92b/bch.c#L447" idib/bc1183lib/bch1111      782 =/bch.c#L422" 7d="L472>] enumerlte allproots of g(X) 5"> 511sod           11 4lib/bch11  }
1184    782 l" class=olutiomemset83" id="L38q">ememsetlib/bch.c#LNULLb/bchroots"> 511 511sod           11 5lib/bch11  7     }
11 5eme="L511"> f="+code=rem" cf">elp->,0ea href="lpme="L511"> 511eta>mas=ecc" class="bspme="L511"> 511sod           11 6lib/bch11
 511mala hrib/0code=syn" class=7r/span>
 511 511mas=ecc" class="bsp"7s*sod           11 7lib/bch11bs) *="L417"> 417   11bs)>118id="L5="line" name="Lcdlass/el" class=olutioroots"> 511,1e=rows" 7lass=76"> * 51188lib/bch11ol" class ?="L368"> 368<11ol">118vme="L511"> 511
so7mod_s"> 511
; ;>11a>e=bch_contro     }
p<611cod>11aa>   7a href==/bch.c#L422" 7d="L472>] build generltssp           g(X) 5"> 511sod           1192lib/bch11line" name="L500"> a>);
11lin>11a47" idd93" idl" class=olutio q">elp;
elp;
,de=rows" 7lass=76"> * 51193lib/bch11              6 119     782 l" class=olutio q">elp;
,1e=rows" 7lass=76"> * 51194lib/bch11l6c
 f="+code=rem" cf">elp->,0ea href="lpme="L511"> 511 511sod           1195lib/bch11g> c over GF(2^m). >11ae7p;  511 511sod           1196lib/bch1111ade=bch_control" lclass)]/ef="=/bch.c#L422" 7d="L472>] multiply g(X) by (X+root) 5"> 511sod           1197lib/bch11m).
11aid="L5="line" name="Lcdlass/e+code=j" class=r/span>
so7 ef"7gf_po72       ,
 511 * 51198lib/bch11="L469 name"L507">void"+11="L>11avme="L511"> 511elp;
elp;
elp;
,1e=rows" 7lass=76"> * 51199lib/bch11ame="L508"> 508stati11ame>11a509 href="+code=elp" class="s/bch.c#L447" idjme="L511"> 511mala hrib/l" class=olutio q">elp;
elp;
 51ea href="lpme="L5"7s* 508stati12="l>1201eme="L511"> 511elp;
so7gf_mul83" id="L38q">egf_mullib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+, l" class=olutio q">elp;

elp;
 * 51201lib/bch12=ode=p" class="sref">p<612=od>12=="L39=rows" 7lass=76"> * 51202lib/bch12=ine" name="L500"> a>);
12=in>12=47" idd93" id="L393" cdlass/el" class=olutio q">elp;
,lass="sr7f">so7gf_mul83" id="L38q">egf_mullib/bch.c#LNULLb/bch.c#L509" iNULL    =ref="+, l" class=olutio q">elp;

 * 51203lib/bch12=/a>              6 12=ass="f">elp->elp;
elp;
 * 51204lib/bch12=6c
 511 c over GF(2^m). >12=ode=l" class=     }
120de=bch_controb/bch.c#L422" 7d="L472>] stsse left-justified binary repres"L4bspme of g(X) 5"> 511sod           12=7lib/bch12=).
12=id="L5="line"="+            n/span>
elp;
elp;
 * 512=8lib/bch12="L469 name"L507">void"+12="L>1208d="L5="line"="+            p->,0e=rows" 7lass=76"> * 512=9lib/bch12=me="L508"> 508stati12=me>120mbe92b/bch.c#L447" idib/bc121"lib/bch12er GF(2^m).
1211eme="L511"> while+code=rem" cf">eln/span>
 511sod           1211lib/bch12b/bc71name="L431">void"+12b/b>121a>   7a href="lib/bch.> 446 511maa>,hss="/bch.c#L447n/span>
 5321
 * 51212lib/bch12508"> 508static int 12508>12147" idd93" id="L393" /bch.c#L447" idjme="L511"> 511mala hrib/0code=syn" class=7word/span>
 511mas=ecc" class="bsp"7s*sod           1213lib/bch12383" id="L38ib/bch.c#L5012383>121ass="f">elp->elp;

121heme="L511"> 511
 * 51215lib/bch12/a>,
>121e7p; >121de=bch_control" lclas/bch.7#L48278"> enbch.83" id="L38q">egenbch." c,
 511,lass="sr7f">so7word/span>
 * 51217lib/bch12L509" id="L5
 511mae=rows" 7lass=76"> * 51218lib/bch12 {
121n7       if7  ib/b77, unsigned inwh1219lib/bch12" ca href/bch.c#L447" id12" c>12e509 href="+co+ass="sr7f">so7 ef"7gf_po72        511maib/l" class=olutio q">elp;
elp;

12247" idd93" idl" class=olutiokfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch q">elp;
 * 512 3lib/bch12   }
ekfreelib/bch.c#LNULLb/bchroots"> 511 * 512 4lib/bch12 de12 122lass="sre7">p = 122ode=l" class=       bch.c#L393" id= enbch.83" id="L38q">egenbch." csod           12 6lib/bch12"> 486 >122de=bc ib/b77, unsigned inwh12 7lib/bch12Massey jme="L511"> 5111227
divme="L511">deewitdivislib/quotiaX^ r106" i12 9lib/bch12>mai=+code=deg" class="s12>ma>122509 hss="sref>divme="L511"> 5 init_r10 - initialize a BCH enrefer/dereferwitdivislib/quotiaX^ r106" i123"lib/bch1204"> 404            1204">123 09 hss="sref>divme="L511"> 5 @m:e" name="LGalois field order, fhould be in the range 5-1e7ptdivislib/quotiaX^ r106" i1231lib/bch12511ma-/bch.c#L447" i12511>123" class="sref>sodme="L511"> 5 @t:e" name="Lmaximum errbchcorrecspme capabilityco=" bitsa>tdivislib/quotiaX^ r106" i1232lib/bch12rithm */
123>
elp;(bch0cto use default)a>tdivislib/quotiaX^ r106" i1233lib/bch12e="L511"> 511123de=sol" class="sr6f">so63.c#La>tdivislib/quotiaX^ r106" i1234lib/bch12me="L510"> 57" class="7r12me=>120heme=hr6ess="line6href="+cod* R     s:a>tdivislib/quotiaX^ r106" i1235lib/bch12idpme="L511"> 511120e7p; hr6ess="line6href="+cod*  a newly allo ated BCH de=bch_oass="suree=a successful,    < otherwise09tdivislib/quotiaX^ r106" i1236lib/bch12e" name="Lsb/bcode=a_pow12e" >123a7                tdivislib/quotiaX^ r106" i1237lib/bch12f">k++] = >123" class="sref>divme="L511"> 5 This initializaspme can take some time, as lookup tables5areebuilt5f="+fasta>tdivislib/quotiaX^ r106" i1238lib/bch12id="56              12id=>123 hrefss="sref>divme="L511"> 5 enrefing/derefing;Lmake sureenot to callpthis funcspme from a time critic  litdivislib/quotiaX^ r106" i1239lib/bch12a>++) {
+>123509 hss="sref>divme="L511"> 5 path. Usuallyco="it_r10() fhould be called me module/drivero="it andlitdivislib/quotiaX^ r106" i124"lib/bch12ib/bch.c#L447" idd93" id12ib/>124 09 hss="sref>divme="L511"> 5 free_r10() fhould be called to release5memory me exit.eatestrCclaib/Divisor) r106"1241lib/bch12a href="lib/bch.c#L=>12a h>124" class="sref>sodme="L511"> 5eatestrCclaib/Divisor) r106"1242lib/bch12de=t" c--mGF(2^m).124>
elp;of)degre n@mo=" arguf="+eatestrCclaib/Divisor) r106"1243lib/bch12"7class="li7e" name="L4412"7c>124de=sol" class="sr6f">so63.c#L @prim_bch., or leto="it_r10() use its default f">elp.eatestrCclaib/Divisor) r106"1244lib/bch12 > c over GF(2^m). >124heme=hr6ess="line6href="+cod*eatestrCclaib/Divisor) r106"1245lib/bch12 cl74a linear system for12 cl>124e7p; hr6ess="line6href="+cod* Onceo="it_r10() has successfully=      ed a pointer to a newly allo atedeatestrCclaib/Divisor) r106"1246lib/bch12r GF(2^m).
124a7                m"L431">void"+12ss=>124" class="sref>divme="L511"> 5 the ass="sure.eatestrCclaib/Divisor) r106"1248lib/bch12508"> 508static int 12508>124 hrefss="sref>divme="L511"> 5"> 511sod           12i9lib/bch12383" id="L38ib/bch.c#L5012383>1249"L39e=s="sref">elp;
 511 511ma,f="+code=syn" class=t83" id="L38q">eta>ma,oe=t" cref="+code=syn" class=prim_bch.83" id="L38q">eprim_bch.09" )efsref>sod           125"lib/bch12) {
125 7" irefsref>sod           1251lib/bch12" ca  hrib/bch.c#L447" i12" c>1251e=bch_contro="+code=syn" class=err83" id="L38q">eerr="lia>,de=rows" 7lass=76"> * 51252lib/bch12de=t" caib/bch.c#L447" i12de=>12547" idd93" ide=t" cref="+code=syn" class=rol" class 511sod           1253lib/bch12          7="lib/bch7c#L12   >125     782 l" class=olutiou="+32_t83" id="L38q">eu="+32_t    7ol" class=olutio enbch.83" id="L38q">egenbch." csod           1254lib/bch12                ass="sref">elp;

so7f=                sod           1255lib/bch12X+c over GF(2^m).12X+c>125}
e="+code=syn" class=ain_ame="L511"> 511sod           1257lib/bch12+] = 125id="L5="line"ref">e="+code=syn" class=aax_ame="L511"> 511sod           1258lib/bch12de=t" caibr of solutions12de=>125 href="lib/bch.c#L=> elps 5"> 511sod           126"lib/bch12          7ff">r7<12   >126Le=bch_controasfind_ref">ee=t" cref="+code=syn" class=prim_bch._tab"7gf_po72      prim_bch._tab" c,refsref>sod           12 1lib/bch12 7fss="line7href="+code=12 7f>126a>   7a href="lib/bch0x25,h0x43,h0x83,h0x11d,h0x211,h0x409,h0x805,h0x1053,h0x201b,efsref>sod           12 2lib/bch12g> c over GF(2^m). >12647" idd93" id="L393" 0x402b,h0x8003,efsref>sod           12 3lib/bch12sre76.c#L503" id="L503" 12sre>126     782 }sefsref>sod           1264lib/bch12ver GF(2^m).
126lass="sre7">p =  href=12 cl>12 e7p; #if"bch.c#L393" id=defL43" id="L393" classefL43"lib/bch.c#LNULLb/bchCONFIG_BCH_CONST_PARAMS"> 511sod           1266lib/bch12me="L511"> 511g12me=>126de=bch_contro 511ma !>,hss="/bch.c#L447CONFIG_BCH_CONST_M      7ef="+codCONFIG_BCH_CONST_M09" )) ||,hss="/bch.c#L447t83" id="L38q">eta>ma !>,hss="/bch.c#L447CONFIG_BCH_CONST_T      7ef="+codCONFIG_BCH_CONST_T09" ))=sod           1267lib/bch12h.c#L383" id="L38ib/bch.12h.c>126id="L5="line" name="Lss="/bch.c#L447printk/span>

++">"r10 enrefer/derefer was reffigured to support "> 511sod           1268lib/bch12=elp" class="sref">elp126vme="L511"> 511++">"par 511sod           1269lib/bch12          126509 href="+code=elp" class="ss="/bch.c#L447CONFIG_BCH_CONST_M      7ef="+codCONFIG_BCH_CONST_M09" b/bch.c#L393" id=CONFIG_BCH_CONST_T      7ef="+codCONFIG_BCH_CONST_T09" )sefsref>sod           127"lib/bch12#L=bgt; so7fai/bch.c#L383" id=fai/a hrsefsref>sod           1271lib/bch127;s)="c over 09ef="127;s>1271eme="L511">      }
12#2be92#endif    }
12#     782  511ma idegcode=syn" class=ain_ame="L511"> 511 511ma igegcode=syn" class=aax_ame="L511"> 511sod           1274lib/bch12d="L5/bch.c#L494" id="L412d=">127heme="L511"> 511sodme="L511">dewitdivislib/quotiaX^ r106" i1275lib/bch12s/bch.c#L494" id="L494"712s/b>127e7p; hr6ess="line6href="+coddddddddddddddddd* values5of m greater thess155areenot curr="+ly supported;> 511sod           1276lib/bch12127a7                ++)m igegc155would requireechesg>++)table base5type09tdivislib/quotiaX^ r106" i1277lib/bch12         7h/a>[127" class="sref>divme="L511"> dddddddddddddddd* (u="+16_t) andda small patcho=" matr>x transposispme09tdivislib/quotiaX^ r106" i1278lib/bch12#L447" idib/bch.c#L509" 12#L4>127 hrefss="sref>divme="L511"> dddddddddddddddd*"> 511sod           1279lib/bch12e=t" ca  hr 0"+code=deg"12e=t>127509 href="+code=elp" goto lass="sr7f">so7fai/bch.c#L383" id=fai/a hrsefsref>sod           128"lib/bch12               128a>   7a href==/bch.c#L422" 7d="L472>] sanity checks 5"> 511sod           1282lib/bch12s/bch.c#L494" id="L494"712s/b>1282    782 eta>ma idegc1) ||,hss="/bch.c#L447ame="L511"> 511maol" class=olutiot83" id="L38q">eta>ma igeg>,h(1 i  511ma)-1)))efsref>sod           1283lib/bch12128ass="f">elp-><=/bch.c#L422" 7d="L472>] invalid t value 5"> 511sod           1284lib/bch12  }
128heme="L511"> 511so7fai/bch.c#L383" id=fai/a hrsefsref>sod           1285lib/bch12  7     }
128}

elp;f="+generlt>++)GF(2^m) 5"> 511sod           12 7lib/bch12bs) *="L417"> 417   12bs)>128 0;
eprim_bch.09" aLL40)efsref>sod           1288lib/bch12ol" class ?="L368"> 368<12ol">128vme="L511"> 511eprim_bch.09" aLcode=syn" class=prim_bch._tab"7gf_po72      prim_bch._tab" c 511ma+code=p" cla7s="ain_ame="L511"> 511 * 512 9lib/bch12->12128mbe92b/bch.c#L447" idib/bc129"lib/bch12a>; ;>129Le=bch_controbch.c#L393" id=ns
so7kzallo /span>
   GFP_KERNEL"> 511 * 51291lib/bch12code=p" class="sref">p<612cod>12aa>   7a href==a hss="/bch.c#L447ns
                 * 51292lib/bch12line" name="L500"> a>);
12lin>12947" idd93" id="L393" goto lass="sr7f">so7fai/bch.c#L383" id=fai/a hrsefsref>sod           1293lib/bch12              6 1293f="+efsref>sod           1294lib/bch12l6c
 511ma            6s>   ame="L511"> 511masefsref>sod           1295lib/bch12g> c over GF(2^m). >129ass="sre75" i+" class=olutio ef"7gf_po72       eta>ma            6s>   t83" id="L38q">eta>masefsref>sod           1296lib/bch1212ade=bch_contro+" class=olutio ef"7gf_po72       
 511ma)-1sefsref>sod           1297lib/bch12m).
129id="L5="line"="+            words"> 511   DIV_ROUND_UP/span>
 511maol" class=olutiot83" id="L38q">eta>maco32lsefsref>sod           1298lib/bch12="L469 name"L507">void"+12="L>1298d="L5="line"="+             ef"7gf_po72       eecc_bytesa>ma            6s>   DIV_ROUND_UP/span>
 511maol" class=olutiot83" id="L38q">eta>maco8lsefsref>sod           1299lib/bch12ame="L508"> 508stati12ame>129509 href="+co+ass="sr7f">so7 ef"7gf_po72       so7 ef_allo /span>

eerr="li=sefsref>sod           13="lib/bch13="li"L508"> 508stati13="l>130Le=bch_controbch.c#L393" id=ns
so7 ef_allo /span>

eerr="li=sefsref>sod           13=1lib/bch13=ode=p" class="sref">p<613=od>1301e=bch_controbch.c#L393" id= ef"7gf_po72           ef_allo /span>
 511eerr="li=sefsref>sod           13=2lib/bch13=ine" name="L500"> a>);
13=in>13047" idd93" idl" class=olutio ef"7gf_po72       eecc_buf7" idd9           6s>    ef_allo /span>
 511eecc_buf7" i),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           13=3lib/bch13=/a>              6 130     782 l" class=olutio ef"7gf_po72       eecc_buf2" c<             6s>    ef_allo /span>
 511eecc_buf2" c<),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           13=4lib/bch13=6c
    ef_allo /span>
 511maosizeof(ol" class=olutio ef"7gf_po72       eerr="li=sefsref>sod           13=5lib/bch13=> c over GF(2^m). >130ass="sre75" i+" class=olutio ef"7gf_po72       
    ef_allo /span>
eta>maosizeof(ol" class=olutio ef"7gf_po72       
eerr="li=sefsref>sod           13=6lib/bch13=/a69 monic polynomial X13=/a>130de=bch_contro+" class=olutio ef"7gf_po72       ecachee=bch_con           6s>    ef_allo /span>
eta>maosizeof(ol" class=olutio ef"7gf_po72       ecachee=bc),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           13=7lib/bch13=).
13=id="L5="line"="+             ef"7gf_po72       eelpss="sre75"            6s>    ef_allo /span>
eta>ma+1)*sizeof(ass="sref">elp;
egf_bch._deg1e=bc),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           13=8lib/bch13="L469 name"L507">void"+13="L>130 href="lib/bch.c#L=>  508stati13=me>130509 href="+cof="+code=rem" cf">elp->,0ea href="lpme="L511"> 511 511ebch._2t="li=s=ecc" class="bspme="L511"> 511
131bde=l" class="ib/bch.="+             ef"7gf_po72       ebch._2t="licode=c/a>,
 511so7 ef_allo /span>
eta>ma),e=srefl" class=olutioerr83" id="L38q">eerr="li=sefsref>sod           1311lib/bch13b/bc71name="L431">void"+13b/b>131="L39=rows" 7lass=76"> * 51312lib/bch13508"> 508static int 13508>1312    782 eerr="li==rows" 7lass=76"> * 51313lib/bch13383" id="L38ib/bch.c#L5013383>131ass="f">elp->so7fai/bch.c#L383" id=fai/a hrsefsref>sod           1314lib/bch13line" nlde=bch_control" 13lin>131lass="sre7">p = ,
>131ass="sre75" i+" class=olutioerr83" id="L38q">eerr="lia>,lass="sr7f">so7 uild_gf_tables/span>
   prim_bch.83" id="L38q">eprim_bch.09" )sefsref>sod           1316lib/bch13ja>mask/a>,
eerr="li==rows" 7lass=76"> * 51317lib/bch13L509" id="L5so7fai/bch.c#L383" id=fai/a hrsefsref>sod           1318lib/bch13 {
131 href="lib/bch.c#L=> 131509 href="+co+/bch.c#L422" 7d="L472>] use generltssp           f="+"las76>++)enrefing tables55"> 511sod           132"lib/bch13 1 << egenbch." c<   lass="sr7f">so7"las76 _generltss_          "> 511sod           13 1lib/bch13>           ss<2e y B92<13>  >132a>   7a href==a hss="/bch.c#L447 enbch.83" id="L38q">egenbch." c<  L4ode=syn" class=f=                 * 513 2lib/bch13d solutions
13247" idd93" id="L393" goto lass="sr7f">so7fai/bch.c#L383" id=fai/a hrsefsref>sod           13 3lib/bch13   }
sod           13 4lib/bch13 de13 1324    782 l" class=olutio uild_aod8_tables/span>
    enbch.83" id="L38q">egenbch." c<)sefsref>sod           13 5lib/bch13                     132ass="sre75" i+" class=olutiokfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch enbch.83" id="L38q">egenbch." c<)sefsref>sod           13 6lib/bch13"> 486 >1326
 511132id="L5="line"="+            err83" id="L38q">eerr="lia>,lass="sr7f">so7 uild_deg2_base/span>
sod           13 8lib/bch13 href="lib/bch.c#L=> 13 hr>1328e=bch_controeerr="li==rows" 7lass=76"> * 513 9lib/bch13>mai=+code=deg" class="s13>ma>132509 href="+code=elp" goto lass="sr7f">so7fai/bch.c#L383" id=fai/a hrsefsref>sod           133"lib/bch1304"> 404            1304">133 09 hib/b77, unsigned inwh1331lib/bch13511ma-/bch.c#L447" i13511>133a>   7a href=       bch.c#L393" id= ef"7gf_po72       sod           1332lib/bch13rithm */
1332be92b/bch.c#L447" idib/bc1333lib/bch13e="L511"> 511133de=solass="sr7f">so7fai/bch.c#L383" id=fai/a hr:ib/b77, unsigned inwh1334lib/bch13me="L510"> 57" class="7r13me=>1334    782 l" class=olutiofree_r10bch.c#L383" id=free_r10lib/b="+             ef"7gf_po72       sod           1335lib/bch13idpme="L511"> 511133ode=l" class=       bch.c#L393" id=f=                sod           1336lib/bch13e" name="Lsb/bcode=a_pow13e" >133de=bc ib/b77, unsigned inwh1337lib/bch13f">k++] = >133" clasch.c#L393" id=EXPORT_SYMBOL_GP/a>             EXPORT_SYMBOL_GP/lib/b="+            ="it_r10e="L511"> 511sod           1338lib/bch13id="56              13id=>133 href="lib/bch.c#L=> ++) {
+>133509 hss="sref>divme="L511">deewitdivislib/quotiaX^ r106" i134"lib/bch13ib/bch.c#L447" idd93" id13ib/>134 09 hss="sref>divme="L511"> 5  free_r10 - free the BCH de=bch_oass="surewitdivislib/quotiaX^ r106" i1341lib/bch13a href="lib/bch.c#L=>13a h>134" class="sref>sodme="L511"> 5  @r10:e" nBCH de=bch_oass="sureeto releasewitdivislib/quotiaX^ r106" i1342lib/bch13de=t" c--mGF(2^m).134>
 511sod           1343lib/bch13"7class="li7e" name="L4413"7c>134de=sovoid l" class=olutiofree_r10bch.c#L383" id=free_r10lib/bass="sref">elp;

m"L431">void"+13ss=>134 0;
 508static int 13508>134n7       if7 name="L458"> 458   kfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       sod           1349lib/bch13383" id="L38ib/bch.c#L5013383>134509 href="+code=elp" +" class=olutiokfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       sod           135"lib/bch13) {
135bde=l" class="ib/bch.="+            kfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       sod           1351lib/bch13" ca  hrib/bch.c#L447" i13" c>135a>   7a href="lib/bch.> 446ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       eecc_buf7" i)sefsref>sod           1352lib/bch13de=t" caib/bch.c#L447" i13de=>13547" idd93" id="L393" .> 446ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       eecc_buf2" c<)sefsref>sod           1353lib/bch13          7="lib/bch7c#L13   >135ass="f">elp-><=> 446ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       sod           1354lib/bch13                511 446ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       
 446ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       ecachee=bc)sefsref>sod           1356lib/bch13kfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       eelpss=")sefsref>sod           1357lib/bch13+] = 1357
135n7       if7 name="L4f="+code=rem" cf">elp->,0ea href="lpme="L511"> 511 511ebch._2t="li=s=ecc" class="bspme=> 511kfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       ebch._2t="licode=c/a>,
 511sod           136"lib/bch13          7ff">r7<13   >136 09 hib/b77, unsigned inwh13 1lib/bch13 7fss="line7href="+code=13 7f>136a>   7a href="lib/bch/bch.7#L48278">kfree83" id="L38q">ekfreelib/bch.c#LNULLb/bch ef"7gf_po72       sod           1362lib/bch13g> c over GF(2^m). >13647" idd93" id ib/b77, unsigned inwh13 3lib/bch13sre76.c#L503" id="L503" 13sre>136      ib/b77, unsigned inwh13 4lib/bch13ver GF(2^m).
136lass=sch.c#L393" id=EXPORT_SYMBOL_GP/a>             EXPORT_SYMBOL_GP/lib/b="+            free_r10bch.c#L383" id=free_r10lib/)sefsref>sod           1365lib/bch13 cla76a lin"L431"> href=13 cl>136}
 511g13me=>136de=bc="+            MODULE_LICENSE1"> 511++">"GP/"> 511sod           1367lib/bch13h.c#L383" id="L38ib/bch.13h.c>136" clasch.c#L393" id=MODULE_AUTHOR/span>
++">"Ivch.Djelice=degivch.djelic@parrot.com="+c"> 511sod           1368lib/bch13=elp" class="sref">elp136vme="sch.c#L393" id=MODULE_DESCRIPTION      7ef="+codMODULE_DESCRIPTIONlib/b=/bch.c#L422"str>++">"Binary BCH enrefer/derefer"> 511sod           1369lib/bch13          136509 h


The original LXR softwareeby the fsref>sodhttp://sourcef="ge.net/projects/lxr">LXR hrefunity hrecothis experif="+al verspme by fsref>sodmailto:lxr@a hux.no">lxr@a hux.no hre.
lxr.a hux.no kindly hosted by fsref>sodhttp://www.redpill-a hpro.no">Redpill L hpro AS hrecoprovider5of L hux_ref"ulting anddoperlt>ef" service" sinceo1995.