mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-19 04:48:12 +00:00
ed25519_cosi: small changes to code style
This commit is contained in:
parent
d3d88591d0
commit
b666039f66
@ -55,16 +55,19 @@ ed25519_cosi_combine_publickeys(ed25519_public_key res, const ed25519_public_key
|
|||||||
memcpy(res, pks, sizeof(ed25519_public_key));
|
memcpy(res, pks, sizeof(ed25519_public_key));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++]))
|
if (!ge25519_unpack_negative_vartime(&P, pks[i++])) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
ge25519_full_to_pniels(&sump, &P);
|
ge25519_full_to_pniels(&sump, &P);
|
||||||
while (i < n - 1) {
|
while (i < n - 1) {
|
||||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++]))
|
if (!ge25519_unpack_negative_vartime(&P, pks[i++])) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
ge25519_pnielsadd(&sump, &P, &sump);
|
ge25519_pnielsadd(&sump, &P, &sump);
|
||||||
}
|
}
|
||||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++]))
|
if (!ge25519_unpack_negative_vartime(&P, pks[i++])) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
ge25519_pnielsadd_p1p1(&sump1, &P, &sump, 0);
|
ge25519_pnielsadd_p1p1(&sump1, &P, &sump, 0);
|
||||||
ge25519_p1p1_to_partial(&P, &sump1);
|
ge25519_p1p1_to_partial(&P, &sump1);
|
||||||
curve25519_neg(P.x, P.x);
|
curve25519_neg(P.x, P.x);
|
||||||
@ -75,9 +78,8 @@ ed25519_cosi_combine_publickeys(ed25519_public_key res, const ed25519_public_key
|
|||||||
void
|
void
|
||||||
ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, const ed25519_cosi_signature *sigs, size_t n) {
|
ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, const ed25519_cosi_signature *sigs, size_t n) {
|
||||||
bignum256modm s, t;
|
bignum256modm s, t;
|
||||||
size_t i;
|
size_t i = 0;
|
||||||
|
|
||||||
i = 0;
|
|
||||||
expand256_modm(s, sigs[i++], 32);
|
expand256_modm(s, sigs[i++], 32);
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
expand256_modm(t, sigs[i++], 32);
|
expand256_modm(t, sigs[i++], 32);
|
||||||
|
4
tests.c
4
tests.c
@ -2651,13 +2651,13 @@ START_TEST(test_ed25519) {
|
|||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_ed25519_cosi) {
|
START_TEST(test_ed25519_cosi) {
|
||||||
int MAXN=10;
|
const int MAXN = 10;
|
||||||
ed25519_secret_key keys[MAXN];
|
ed25519_secret_key keys[MAXN];
|
||||||
ed25519_public_key pubkeys[MAXN];
|
ed25519_public_key pubkeys[MAXN];
|
||||||
ed25519_secret_key nonces[MAXN];
|
ed25519_secret_key nonces[MAXN];
|
||||||
ed25519_public_key Rs[MAXN];
|
ed25519_public_key Rs[MAXN];
|
||||||
ed25519_cosi_signature sigs[MAXN];
|
ed25519_cosi_signature sigs[MAXN];
|
||||||
unsigned char msg[32];
|
uint8_t msg[32];
|
||||||
rfc6979_state rng;
|
rfc6979_state rng;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user