aboutsummaryrefslogtreecommitdiffstats
path: root/src/zmodmul.c
blob: 5dd3a6c417f8aaa5132818effa69136005a3d9b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* 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 */
	/* TODO Kochanski 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);
	}
}