MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxBigInt_mod_sub

Function fxBigInt_mod_sub

modules/crypt/arith/xsBigIntEx.c:139–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139txBigInt *fxBigInt_mod_sub(txMachine *the, txBigInt *r, txBigInt *a, txBigInt *b, txBigInt *m, pool_t *pool)
140{
141 txBigInt *c = pool_get(the, m->size + 1, pool);
142
143 fxBigInt_sub(the, c, a, b);
144 if (c->sign) {
145 while (c->sign)
146 fxBigInt_add(the, c, c, m);
147 }
148 else {
149 while (fxBigInt_ucomp(c, m) >= 0)
150 fxBigInt_sub(the, c, c, m);
151 }
152 fxBigInt_copy(r, c);
153 pool_put(c, m->size + 1);
154 return r;
155}
156
157txBigInt *fxBigInt_mod_inv(txMachine *the, txBigInt *r, txBigInt *a, txBigInt *m, pool_t *pool)
158{

Callers 3

fxBigInt_mod_invFunction · 0.85
ec_doubleFunction · 0.85
ec_addFunction · 0.85

Calls 6

pool_getFunction · 0.85
fxBigInt_subFunction · 0.85
fxBigInt_addFunction · 0.85
fxBigInt_ucompFunction · 0.85
fxBigInt_copyFunction · 0.85
pool_putFunction · 0.85

Tested by

no test coverage detected