1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/mpi/mp_gf2m.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef _MP_GF2M_H_ 1.9 +#define _MP_GF2M_H_ 1.10 + 1.11 +#include "mpi.h" 1.12 + 1.13 +mp_err mp_badd(const mp_int *a, const mp_int *b, mp_int *c); 1.14 +mp_err mp_bmul(const mp_int *a, const mp_int *b, mp_int *c); 1.15 + 1.16 +/* For modular arithmetic, the irreducible polynomial f(t) is represented 1.17 + * as an array of int[], where f(t) is of the form: 1.18 + * f(t) = t^p[0] + t^p[1] + ... + t^p[k] 1.19 + * where m = p[0] > p[1] > ... > p[k] = 0. 1.20 + */ 1.21 +mp_err mp_bmod(const mp_int *a, const unsigned int p[], mp_int *r); 1.22 +mp_err mp_bmulmod(const mp_int *a, const mp_int *b, const unsigned int p[], 1.23 + mp_int *r); 1.24 +mp_err mp_bsqrmod(const mp_int *a, const unsigned int p[], mp_int *r); 1.25 +mp_err mp_bdivmod(const mp_int *y, const mp_int *x, const mp_int *pp, 1.26 + const unsigned int p[], mp_int *r); 1.27 + 1.28 +int mp_bpoly2arr(const mp_int *a, unsigned int p[], int max); 1.29 +mp_err mp_barr2poly(const unsigned int p[], mp_int *a); 1.30 + 1.31 +#endif /* _MP_GF2M_H_ */