Skip to content

Commit 4140f28

Browse files
committed
Indentation.
1 parent 15f8236 commit 4140f28

14 files changed

+149
-130
lines changed

.indent.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@
6262
-T dis_t
6363
-T rsa_pub_t
6464
-T rsa_prv_t
65+
-T ers_t
66+
-T etrs_t
67+
-T smlers_t

src/cp/relic_cp_ecies.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ int cp_ecies_dec(uint8_t *out, size_t *out_len, const ec_t r, const uint8_t *in,
141141
if (util_cmp_const(h, in + in_len - RLC_MD_LEN, RLC_MD_LEN)) {
142142
result = RLC_ERR;
143143
} else {
144-
if (bc_aes_cbc_dec(out, out_len, in, in_len - RLC_MD_LEN, key, size, iv)
145-
!= RLC_OK) {
144+
if (bc_aes_cbc_dec(out, out_len, in, in_len - RLC_MD_LEN,
145+
key, size, iv) != RLC_OK) {
146146
result = RLC_ERR;
147147
}
148148
}

src/cp/relic_cp_ecss.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ int cp_ecss_ver(bn_t e, bn_t s, const uint8_t *msg, size_t len, const ec_t q) {
166166

167167
bn_mod(ev, ev, n);
168168

169-
result = dv_cmp_const(ev->dp, e->dp, RLC_MIN(ev->used, e->used));
169+
result = dv_cmp_const(ev->dp, e->dp, RLC_MIN(ev->used,
170+
e->used));
170171
result = (result == RLC_NE ? 0 : 1);
171172

172173
if (ev->used != e->used) {

src/cp/relic_cp_ers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ int cp_ers_ver(const bn_t td, const ers_t *s, size_t size, const uint8_t *msg,
123123
ec_mul_gen(t, td);
124124

125125
for (int i = 0; i < size; i++) {
126-
ec_add(t, t, s[i]->h);
127-
}
126+
ec_add(t, t, s[i]->h);
127+
}
128128
if (ec_cmp(pp, t) == RLC_EQ) {
129129
flag = 1;
130130
for (int i = 0; i < size; i++) {
131131
ec_copy(y[0], s[i]->h);
132132
ec_copy(y[1], s[i]->pk);
133133
flag &= cp_sokor_ver(s[i]->c, s[i]->r, msg, len, y, NULL);
134-
}
134+
}
135135
}
136136
result = flag;
137137
}

src/cp/relic_cp_etrs.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int cp_etrs_sig(bn_t *td, bn_t *y, size_t max, etrs_t p, const uint8_t *msg,
6262
if (_v == NULL || v == NULL) {
6363
RLC_THROW(ERR_NO_MEMORY);
6464
}
65-
for(int i = 0; i < max; i++) {
65+
for (int i = 0; i < max; i++) {
6666
bn_null(v[i]);
6767
bn_null(_v[i]);
6868
bn_new(v[i]);
@@ -73,11 +73,11 @@ int cp_etrs_sig(bn_t *td, bn_t *y, size_t max, etrs_t p, const uint8_t *msg,
7373
bn_rand_mod(p->y, n);
7474

7575
bn_set_dig(l, 1);
76-
for(int j = 0; j < max; j++) {
76+
for (int j = 0; j < max; j++) {
7777
bn_copy(_v[j], y[j]);
7878
}
7979
bn_mod_inv_sim(_v, _v, n, max);
80-
for(int j = 0; j < max; j++) {
80+
for (int j = 0; j < max; j++) {
8181
bn_sub(u, y[j], p->y);
8282
bn_mul(u, u, _v[j]);
8383
bn_mod(u, u, n);
@@ -88,18 +88,18 @@ int cp_etrs_sig(bn_t *td, bn_t *y, size_t max, etrs_t p, const uint8_t *msg,
8888

8989
bn_zero(z);
9090
bn_mod_inv_sim(v, y, n, max);
91-
for(int i = 0; i < max; i++) {
91+
for (int i = 0; i < max; i++) {
9292
bn_mul(u, v[i], p->y);
9393
bn_mod(v[i], u, n);
94-
for(int j = 0; j < max; j++) {
94+
for (int j = 0; j < max; j++) {
9595
bn_set_dig(_v[j], 1);
9696
if (j != i) {
9797
bn_sub(_v[j], y[j], y[i]);
9898
bn_mod(_v[j], _v[j], n);
9999
}
100100
}
101101
bn_mod_inv_sim(_v, _v, n, max);
102-
for(int j = 0; j < max; j++) {
102+
for (int j = 0; j < max; j++) {
103103
if (j != i) {
104104
bn_sub(u, y[j], p->y);
105105
bn_mul(u, u, _v[j]);
@@ -190,8 +190,8 @@ int cp_etrs_ver(size_t thres, const bn_t *td, const bn_t *y, size_t max,
190190

191191
flag = 1;
192192
ec_set_infty(w[0]);
193-
for(i = 0; i < d; i++) {
194-
for(int j = 0; j < d; j++) {
193+
for (i = 0; i < d; i++) {
194+
for (int j = 0; j < d; j++) {
195195
bn_set_dig(_v[j], 1);
196196
if (j != i) {
197197
bn_sub(_v[j], _y[j], _y[i]);
@@ -200,7 +200,7 @@ int cp_etrs_ver(size_t thres, const bn_t *td, const bn_t *y, size_t max,
200200
}
201201
bn_mod_inv_sim(_v, _v, n, d);
202202
bn_set_dig(v[i], 1);
203-
for(int j = 0; j < d; j++) {
203+
for (int j = 0; j < d; j++) {
204204
if (j != i) {
205205
bn_mul(u, _y[j], _v[j]);
206206
bn_mod(u, u, n);
@@ -216,7 +216,7 @@ int cp_etrs_ver(size_t thres, const bn_t *td, const bn_t *y, size_t max,
216216
ec_copy(w[0], s[i]->h);
217217
ec_copy(w[1], s[i]->pk);
218218
flag &= cp_sokor_ver(s[i]->c, s[i]->r, msg, len, w, NULL);
219-
}
219+
}
220220
result = flag;
221221
}
222222
RLC_CATCH_ANY {
@@ -348,8 +348,8 @@ int cp_etrs_uni(int thres, bn_t *td, bn_t *y, int max, etrs_t *p, size_t *size,
348348
bn_rand_mod(p[*size]->y, n);
349349

350350
ec_set_infty(p[*size]->h);
351-
for(i = 0; i < d; i++) {
352-
for(int j = 0; j < d; j++) {
351+
for (i = 0; i < d; i++) {
352+
for (int j = 0; j < d; j++) {
353353
bn_set_dig(_v[j], 1);
354354
if (j != i) {
355355
bn_sub(_v[j], _y[j], _y[i]);
@@ -358,7 +358,7 @@ int cp_etrs_uni(int thres, bn_t *td, bn_t *y, int max, etrs_t *p, size_t *size,
358358
}
359359
bn_mod_inv_sim(_v, _v, n, d);
360360
bn_set_dig(l, 1);
361-
for(int j = 0; j < d; j++) {
361+
for (int j = 0; j < d; j++) {
362362
if (j != i) {
363363
bn_sub(u, _y[j], p[*size]->y);
364364
bn_mul(u, u, _v[j]);

src/cp/relic_cp_ibe.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int cp_ibe_enc(uint8_t *out, size_t *out_len, const uint8_t *in, size_t in_len,
8181
g2_null(q);
8282
gt_null(e);
8383

84-
if (pub == NULL || in_len <= 0 || in_len > RLC_MD_LEN ) {
84+
if (pub == NULL || in_len <= 0 || in_len > RLC_MD_LEN) {
8585
return RLC_ERR;
8686
}
8787

@@ -127,9 +127,11 @@ int cp_ibe_enc(uint8_t *out, size_t *out_len, const uint8_t *in, size_t in_len,
127127
}
128128

129129
*out_len = in_len + (2 * RLC_FP_BYTES + 1);
130-
} RLC_CATCH_ANY {
130+
}
131+
RLC_CATCH_ANY {
131132
result = RLC_ERR;
132-
} RLC_FINALLY {
133+
}
134+
RLC_FINALLY {
133135
bn_free(n);
134136
bn_free(r);
135137
g1_free(p);
@@ -182,9 +184,11 @@ int cp_ibe_dec(uint8_t *out, size_t *out_len, const uint8_t *in, size_t in_len,
182184
}
183185

184186
*out_len = in_len;
185-
} RLC_CATCH_ANY {
187+
}
188+
RLC_CATCH_ANY {
186189
result = RLC_ERR;
187-
} RLC_FINALLY {
190+
}
191+
RLC_FINALLY {
188192
g1_free(p);
189193
gt_free(e);
190194
RLC_FREE(buf);

src/cp/relic_cp_mklhs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int cp_mklhs_sig(g1_t s, const bn_t m, const char *data, const char *id,
6363
g1_t a;
6464
int result = RLC_OK;
6565
uint8_t *str = RLC_ALLOCA(uint8_t,
66-
strlen(id) + RLC_MAX(strlen(data), strlen(tag)));
66+
strlen(id) + RLC_MAX(strlen(data), strlen(tag)));
6767

6868
bn_null(n);
6969
g1_null(a);

src/cp/relic_cp_mpss.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@ int cp_mpss_ver(gt_t e, const g1_t a, const g1_t b[2], const bn_t m[2],
190190
/* Now combine shares and multiply. */
191191
gt_mul(e, beta[0], beta[1]);
192192
}
193-
} RLC_CATCH_ANY {
193+
}
194+
RLC_CATCH_ANY {
194195
result = RLC_ERR;
195-
} RLC_FINALLY {
196+
}
197+
RLC_FINALLY {
196198
bn_free(n);
197199
for (int i = 0; i < 2; i++) {
198200
bn_free(d[i]);
@@ -299,9 +301,11 @@ int cp_mpsb_sig(g1_t a, g1_t b[2], const bn_t m[][2], const bn_t r[2],
299301
g1_norm(a, a);
300302
g1_mul(b[0], a, d[0]);
301303
g1_mul(b[1], a, d[1]);
302-
} RLC_CATCH_ANY {
304+
}
305+
RLC_CATCH_ANY {
303306
result = RLC_ERR;
304-
} RLC_FINALLY {
307+
}
308+
RLC_FINALLY {
305309
bn_free(n);
306310
for (int i = 0; i < 2; i++) {
307311
bn_free(d[i]);
@@ -351,23 +355,23 @@ int cp_mpsb_ver(gt_t e, const g1_t a, const g1_t b[2], const bn_t m[][2],
351355
gt_new(alpha[i]);
352356
gt_new(beta[i]);
353357
for (int j = 0; j < l; j++) {
354-
g2_null(_y[l*i + j]);
355-
g2_new(_y[l*i + j]);
356-
bn_null(_m[l*i + j]);
357-
bn_new(_m[l*i + j]);
358+
g2_null(_y[l * i + j]);
359+
g2_new(_y[l * i + j]);
360+
bn_null(_m[l * i + j]);
361+
bn_new(_m[l * i + j]);
358362
}
359363
}
360364
g1_get_ord(n);
361365
if (v == NULL) {
362366
for (int i = 0; i < 2; i++) {
363367
for (int j = 0; j < l; j++) {
364-
bn_copy(_m[l*i + j], m[j][i]);
365-
g2_copy(_y[l*i + j], y[j][i]);
368+
bn_copy(_m[l * i + j], m[j][i]);
369+
g2_copy(_y[l * i + j], y[j][i]);
366370
}
367371
}
368372
/* Compute Z = X + [m] * Y. */
369373
for (int i = 0; i < 2; i++) {
370-
g2_mul_sim_lot(z[i], &_y[l*i], &_m[l*i], l);
374+
g2_mul_sim_lot(z[i], &_y[l * i], &_m[l * i], l);
371375
}
372376
} else {
373377
/* Compute Z = X + [m] * [y_i] * G. */
@@ -421,9 +425,11 @@ int cp_mpsb_ver(gt_t e, const g1_t a, const g1_t b[2], const bn_t m[][2],
421425
/* Now combine shares and multiply. */
422426
gt_mul(e, beta[0], beta[1]);
423427
}
424-
} RLC_CATCH_ANY {
428+
}
429+
RLC_CATCH_ANY {
425430
result = RLC_ERR;
426-
} RLC_FINALLY {
431+
}
432+
RLC_FINALLY {
427433
bn_free(n);
428434
bn_free(_t);
429435
for (int i = 0; i < 2; i++) {
@@ -437,8 +443,8 @@ int cp_mpsb_ver(gt_t e, const g1_t a, const g1_t b[2], const bn_t m[][2],
437443
gt_free(alpha[i]);
438444
gt_free(beta[i]);
439445
for (int j = 0; j < l; j++) {
440-
g2_free(_y[l*i + j]);
441-
bn_free(_m[l*i + j]);
446+
g2_free(_y[l * i + j]);
447+
bn_free(_m[l * i + j]);
442448
}
443449
}
444450
RLC_FREE(_y);

src/cp/relic_cp_phpe.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ int cp_phpe_gen(bn_t pub, phpe_t prv, size_t bits) {
5151
/* Fix g = n + 1. */
5252

5353
/* Precompute dp = 1/(pow(g, p-1, p^2)//p mod p.
54-
with g=1+n, this is also 1/((p-1)q) mod p.
55-
*/
56-
bn_sub_dig(prv->dp, prv->p, 1); //p-1
57-
bn_mul(prv->dp, prv->dp, prv->q); //(p-1)q
58-
bn_mod(prv->dp, prv->dp, prv->p); //(p-1)q mod p
54+
* with g=1+n, this is also 1/((p-1)q) mod p.
55+
*/
56+
bn_sub_dig(prv->dp, prv->p, 1); //p-1
57+
bn_mul(prv->dp, prv->dp, prv->q); //(p-1)q
58+
bn_mod(prv->dp, prv->dp, prv->p); //(p-1)q mod p
5959
bn_mod_inv(prv->dp, prv->dp, prv->p); //((p-1)q)^{-1} mod p
6060

61-
/* Precompute dq = 1/(pow(g, q-1, q^2)//q mod q.
62-
with g=1+n, this is also 1/((q-1)p) mod q.
63-
*/
64-
bn_sub_dig(prv->dq, prv->q, 1); //q-1
65-
bn_mul(prv->dq, prv->dq, prv->p); //(q-1)p
66-
bn_mod(prv->dq, prv->dq, prv->q); //(q-1)p mod q
61+
/* Precompute dq = 1/(pow(g, q-1, q^2)//q mod q.
62+
* with g=1+n, this is also 1/((q-1)p) mod q.
63+
*/
64+
bn_sub_dig(prv->dq, prv->q, 1); //q-1
65+
bn_mul(prv->dq, prv->dq, prv->p); //(q-1)p
66+
bn_mod(prv->dq, prv->dq, prv->q); //(q-1)p mod q
6767
bn_mod_inv(prv->dq, prv->dq, prv->q); //((q-1)p)^{-1} mod q
6868

6969
/* qInv = q^(-1) mod p. */
@@ -117,12 +117,12 @@ int cp_phpe_enc(bn_t c, const bn_t m, const bn_t pub) {
117117
/* Generate r in Z_n^*. */
118118
bn_rand_mod(r, pub);
119119
/* Compute c = (g^m)(r^n) mod n^2.
120-
with g=1+n, this is also (1+nm)r^n mod n^2.
121-
*/
120+
* With g=1+n, this is also (1 + n*m) * r^n mod n^2.
121+
*/
122122
bn_add_dig(g, pub, 1);
123123
bn_sqr(s, pub);
124124
bn_mul(c, pub, m);
125-
bn_add_dig(c, c, 1);
125+
bn_add_dig(c, c, 1);
126126
bn_mod(c, c, s);
127127
bn_mxp(r, r, pub, s);
128128
bn_mul(c, c, r);
@@ -172,7 +172,8 @@ int cp_phpe_dec(bn_t m, const bn_t c, const phpe_t prv) {
172172
#else
173173
bn_mxp_crt(m, c, t, u, prv, 1);
174174
#endif /* CP_CRT */
175-
} RLC_CATCH_ANY {
175+
}
176+
RLC_CATCH_ANY {
176177
result = RLC_ERR;
177178
}
178179
RLC_FINALLY {

src/cp/relic_cp_pok.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int cp_pokdl_ver(const bn_t c, const bn_t r, const ec_t y) {
134134
return result;
135135
}
136136

137-
int cp_pokor_prv(bn_t c[2], bn_t r[2],const ec_t y[2], const bn_t x) {
137+
int cp_pokor_prv(bn_t c[2], bn_t r[2], const ec_t y[2], const bn_t x) {
138138
bn_t n, v[2], z;
139139
ec_t t;
140140
int l, result = RLC_OK;

0 commit comments

Comments
 (0)