summaryrefslogtreecommitdiff
path: root/verify.c
diff options
context:
space:
mode:
Diffstat (limited to 'verify.c')
-rw-r--r--verify.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/verify.c b/verify.c
new file mode 100644
index 000000000..943e606b5
--- /dev/null
+++ b/verify.c
@@ -0,0 +1,44 @@
1/* $OpenBSD: */
2
3/* Public Domain, from supercop-20130419/crypto_verify/32/ref/verify.c */
4
5#include "crypto_api.h"
6
7int crypto_verify_32(const unsigned char *x,const unsigned char *y)
8{
9 unsigned int differentbits = 0;
10#define F(i) differentbits |= x[i] ^ y[i];
11 F(0)
12 F(1)
13 F(2)
14 F(3)
15 F(4)
16 F(5)
17 F(6)
18 F(7)
19 F(8)
20 F(9)
21 F(10)
22 F(11)
23 F(12)
24 F(13)
25 F(14)
26 F(15)
27 F(16)
28 F(17)
29 F(18)
30 F(19)
31 F(20)
32 F(21)
33 F(22)
34 F(23)
35 F(24)
36 F(25)
37 F(26)
38 F(27)
39 F(28)
40 F(29)
41 F(30)
42 F(31)
43 return (1 & ((differentbits - 1) >> 8)) - 1;
44}