| 511 | } |
| 512 | |
| 513 | txBigInt *fxBigInt_mont_exp_LR(txMachine *the, txBigInt *r, txBigInt *b, txBigInt *e, txBigInt *m) |
| 514 | { |
| 515 | int i; |
| 516 | txBigInt *t; |
| 517 | txU4 u; |
| 518 | pool_t pool; |
| 519 | |
| 520 | if (r == NULL) |
| 521 | r = fxBigInt_alloc(the, m->size); |
| 522 | pool_init(&pool); |
| 523 | u = mont_init(m); |
| 524 | t = pool_get(the, m->size, &pool); |
| 525 | mont_exp_init(the, t, m, &pool); |
| 526 | if (fxBigInt_ucomp(b, m) > 0) |
| 527 | b = fxBigInt_mod(the, pool_get(the, m->size, &pool), b, m); |
| 528 | b = mont_in(the, pool_get(the, m->size, &pool), b, m); |
| 529 | for (i = fxBigInt_bitsize(e); --i >= 0;) { |
| 530 | mont_square(the, t, t, m, u, &pool); |
| 531 | if (fxBigInt_isset(e, i)) |
| 532 | mont_mul(the, t, t, b, m, u, &pool); |
| 533 | } |
| 534 | mont_out(the, r, t, m, u); |
| 535 | pool_dispose(the, &pool); |
| 536 | return r; |
| 537 | } |
| 538 | |
| 539 | txBigInt *fxBigInt_mont_exp_SW(txMachine *the, txBigInt *r, txBigInt *b, txBigInt *e, txBigInt *m, int param) |
| 540 | { |
no test coverage detected