-
Notifications
You must be signed in to change notification settings - Fork 1
/
rtrs.h
37 lines (34 loc) · 1.1 KB
/
rtrs.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
#ifndef __RTRS_H
#define __RTRS_H
#include <openssl/bn.h>
#include <openssl/ec.h>
struct RTRS_CTX {
BN_CTX *bnctx;
EC_GROUP *curve;
};
struct RTRS_comm {
EC_POINT **ki;
size_t ki_len;
EC_POINT ***pk[2];
size_t pk_rows;
size_t pk_cols;
EC_POINT **co;
size_t co_len;
EC_POINT *co1;
char *M;
size_t m_len;
int iasterisk;
unsigned long l; // inputs
unsigned long n; // ring size
};
extern struct RTRS_CTX *RTRS_init(BIGNUM *a, BIGNUM *b, BIGNUM *p,
char *generator, char *order, char *coefficient);
extern void RTRS_free(struct RTRS_CTX *ctx);
extern int RTRS_keygen(struct RTRS_CTX *ctx, BIGNUM **sk, EC_POINT **ki, EC_POINT **pk);
extern void RTRS_sub(struct RTRS_CTX *ctx, struct RTRS_comm *fin,
EC_POINT ***ret, BIGNUM ***f_ret);
extern int RTRS_comm_serialize(struct RTRS_CTX *ctx, struct RTRS_comm *c,
char **ret, char *M, size_t m_len);
extern size_t RTRS_spend(unsigned char **ret, struct RTRS_CTX *ctx, BIGNUM ***sk, int sklen, BIGNUM *s, struct RTRS_comm *f, int d[2]);
extern int RTRS_verify(struct RTRS_CTX *ctx, struct RTRS_comm *comm, EC_POINT **kis, size_t kilen, unsigned char *msg);
#endif