-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdachshund.h
59 lines (53 loc) · 1.97 KB
/
dachshund.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
58
59
#ifndef DACHSHUND_H
#define DACHSHUND_H
#include <stdint.h>
#include "poly.h"
#include "polx.h"
#include "polz.h"
#include "labrador.h"
#include "chihuahua.h"
typedef struct {
size_t r;
size_t *n;
size_t fu;
size_t bu;
size_t kappa;
size_t kappa1;
polz *u;
polx *alpha;
} commitment;
typedef struct {
size_t r;
size_t *n;
size_t k;
sparsecnst *cnst;
uint64_t *betasq;
uint8_t h[16];
polx *u0;
polx *alpha;
} smplstmnt;
/* allocate statement for r witness vectors of ranks n[r] and l2-norm bounds betasq[r] (0 for 0/1),
* consisting of k linear constraints (rows of constraint matrix) */
#define init_smplstmnt_raw NAMESPACE(init_smplstmnt_raw)
__attribute__((visibility("default")))
int init_smplstmnt_raw(smplstmnt *st, size_t r, const size_t n[r], const uint64_t betasq[r], size_t k);
/* set j-th linear constraint (j <= k) where the nz sub-vectors of indices idx[nz] (0 <= idx[nz] < r) are non-zero;
* phi is the concatenation of the non-zero sub vectors (of length \sum_{i=0}^{nz-1} n[i]) */
#define set_smplstmnt_lincnst_raw NAMESPACE(set_smplstmnt_lincnst_raw)
__attribute__((visibility("default")))
int set_smplstmnt_lincnst_raw(smplstmnt *st, size_t i, size_t nz, const size_t idx[nz],
const size_t n[nz], size_t deg, int64_t *phi, int64_t *b);
void print_smplstmnt_pp(const smplstmnt *st);
#define free_smplstmnt NAMESPACE(free_smplstmnt)
__attribute__((visibility("default")))
void free_smplstmnt(smplstmnt *st);
#define free_commitment NAMESPACE(free_commitment)
__attribute__((visibility("default")))
void free_commitment(commitment *com);
int simple_prove(statement *ost, witness *owt, proof *pi, commitment *com,
const smplstmnt *ist, const witness *iwt, int tail);
int simple_reduce(statement *ost, const proof *pi, const commitment *com, const smplstmnt *ist);
#define simple_verify NAMESPACE(simple_verify)
__attribute__((visibility("default")))
int simple_verify(const smplstmnt *st, const witness *wt);
#endif