-
Notifications
You must be signed in to change notification settings - Fork 13
/
peks.h
58 lines (43 loc) · 1.14 KB
/
peks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* peks.h
*
* Created on: Jul 7, 2015
* Author: mahind
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <gmp.h>
#include <pbc.h>
#include <assert.h>
#include <openssl/sha.h>
//#define DEBUG 1
/* Apriv = α and Apub = [g, h=g^α] */
typedef struct key_pub_s {
element_t g;
element_t h;
}key_pub;
typedef struct key_s {
element_t priv;
key_pub pub;
}key;
/* PEKS = [A, B] i.e. A=g^r and B=H2(t) */
typedef struct peks_s {
element_t A;
char* B;
}peks;
void sha512(const char *word, int word_size,
char hashed_word[SHA512_DIGEST_LENGTH*2+1]);
void get_n_bits(char* src, char* out, int bitswanted);
void key_printf(key key);
void peks_printf(peks peks);
void init_pbc_param_pairing(pbc_param_t param, pairing_t pairing);
void KeyGen(key *key, pbc_param_t param, pairing_t pairing);
void PEKS(peks *peks, key_pub *pub, pairing_t pairing,
element_t H1_W, int bitswanted);
void Trapdoor(element_t Tw, pairing_t pairing, element_t alpha,
element_t H1_W);
int Test(char *W2S, int lenW2S, key_pub *pub, element_t Tw, pairing_t pairing);
int peks_scheme(char* W1, char *W2);