PageRenderTime 27ms CodeModel.GetById 24ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/src/sqr/fp_sqrmod.c

http://github.com/libtom/tomsfastmath
C | 12 lines | 8 code | 1 blank | 3 comment | 0 complexity | 9107021fb4bf56df06b6e54e5835cae6 MD5 | raw file
Possible License(s): Unlicense
 1/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
 2/* SPDX-License-Identifier: Unlicense */
 3#include <tfm_private.h>
 4
 5/* c = a * a (mod b) */
 6int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c)
 7{
 8  fp_int tmp;
 9  fp_zero(&tmp);
10  fp_sqr(a, &tmp);
11  return fp_mod(&tmp, b, c);
12}