summaryrefslogtreecommitdiff
path: root/libs/libsignal/src/curve25519/ed25519/additions/generalized/sc_isreduced.c
blob: 24193808adedf3184b957aa9eff2808a45359142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <string.h>
#include "fe.h"
#include "sc.h"
#include "crypto_additions.h"
#include "crypto_verify_32.h"

int sc_isreduced(const unsigned char* s)
{
  unsigned char strict[64];

  memset(strict, 0, 64);
  memmove(strict, s, 32);
  sc_reduce(strict);
  if (crypto_verify_32(strict, s) != 0)
    return 0;
  return 1;
}