aboutsummaryrefslogtreecommitdiffstats
path: root/src/zmodmul.c
blob: 26d11787f551012679795bc44fa4b1e234b2c2bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* See LICENSE file for copyright and license details. */
#include "internals.h"


void
zmodmul(z_t a, z_t b, z_t c, z_t d)
{
	/* TODO Montgomery modular multiplication */
	if (unlikely(a == d)) {
		zset(libzahl_tmp_modmul, d);
		zmul(a, b, c);
		zmod(a, a, libzahl_tmp_modmul);
	} else {
		zmul(a, b, c);
		zmod(a, a, d);
	}
}