andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: #ifndef _MP_GF2M_H_ andre@0: #define _MP_GF2M_H_ andre@0: andre@0: #include "mpi.h" andre@0: andre@0: mp_err mp_badd(const mp_int *a, const mp_int *b, mp_int *c); andre@0: mp_err mp_bmul(const mp_int *a, const mp_int *b, mp_int *c); andre@0: andre@0: /* For modular arithmetic, the irreducible polynomial f(t) is represented andre@0: * as an array of int[], where f(t) is of the form: andre@0: * f(t) = t^p[0] + t^p[1] + ... + t^p[k] andre@0: * where m = p[0] > p[1] > ... > p[k] = 0. andre@0: */ andre@0: mp_err mp_bmod(const mp_int *a, const unsigned int p[], mp_int *r); andre@0: mp_err mp_bmulmod(const mp_int *a, const mp_int *b, const unsigned int p[], andre@0: mp_int *r); andre@0: mp_err mp_bsqrmod(const mp_int *a, const unsigned int p[], mp_int *r); andre@0: mp_err mp_bdivmod(const mp_int *y, const mp_int *x, const mp_int *pp, andre@0: const unsigned int p[], mp_int *r); andre@0: andre@0: int mp_bpoly2arr(const mp_int *a, unsigned int p[], int max); andre@0: mp_err mp_barr2poly(const unsigned int p[], mp_int *a); andre@0: andre@0: #endif /* _MP_GF2M_H_ */