summaryrefslogtreecommitdiff
path: root/libs/libaxolotl/src/curve25519/ed25519/additions/fe_isreduced.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libaxolotl/src/curve25519/ed25519/additions/fe_isreduced.c')
-rw-r--r--libs/libaxolotl/src/curve25519/ed25519/additions/fe_isreduced.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/libaxolotl/src/curve25519/ed25519/additions/fe_isreduced.c b/libs/libaxolotl/src/curve25519/ed25519/additions/fe_isreduced.c
new file mode 100644
index 0000000000..6fbb3beccd
--- /dev/null
+++ b/libs/libaxolotl/src/curve25519/ed25519/additions/fe_isreduced.c
@@ -0,0 +1,14 @@
+#include "fe.h"
+#include "crypto_verify_32.h"
+
+int fe_isreduced(const unsigned char* s)
+{
+ fe f;
+ unsigned char strict[32];
+
+ fe_frombytes(f, s);
+ fe_tobytes(strict, f);
+ if (crypto_verify_32(strict, s) != 0)
+ return 0;
+ return 1;
+}