summaryrefslogtreecommitdiff
path: root/libs/libaxolotl/src/curve25519/ed25519/additions/fe_isequal.c
blob: 67c5d33c96b49304e08d87b53e0d32dcb4bcf94d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "fe.h"
#include "crypto_verify_32.h"

/*
return 1 if f == g
return 0 if f != g
*/

int fe_isequal(const fe f, const fe g)
{
  fe h;
  fe_sub(h, f, g);
  return 1 ^ (1 & (fe_isnonzero(h) >> 8));
}