mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +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));
|
||||
return 0;
|
||||
}
|
||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++]))
|
||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++])) {
|
||||
return -1;
|
||||
}
|
||||
ge25519_full_to_pniels(&sump, &P);
|
||||
while (i < n-1) {
|
||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++]))
|
||||
while (i < n - 1) {
|
||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++])) {
|
||||
return -1;
|
||||
}
|
||||
ge25519_pnielsadd(&sump, &P, &sump);
|
||||
}
|
||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++]))
|
||||
if (!ge25519_unpack_negative_vartime(&P, pks[i++])) {
|
||||
return -1;
|
||||
}
|
||||
ge25519_pnielsadd_p1p1(&sump1, &P, &sump, 0);
|
||||
ge25519_p1p1_to_partial(&P, &sump1);
|
||||
curve25519_neg(P.x, P.x);
|
||||
@ -75,9 +78,8 @@ ed25519_cosi_combine_publickeys(ed25519_public_key res, const ed25519_public_key
|
||||
void
|
||||
ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, const ed25519_cosi_signature *sigs, size_t n) {
|
||||
bignum256modm s, t;
|
||||
size_t i;
|
||||
size_t i = 0;
|
||||
|
||||
i = 0;
|
||||
expand256_modm(s, sigs[i++], 32);
|
||||
while (i < n) {
|
||||
expand256_modm(t, sigs[i++], 32);
|
||||
|
4
tests.c
4
tests.c
@ -2651,13 +2651,13 @@ START_TEST(test_ed25519) {
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_ed25519_cosi) {
|
||||
int MAXN=10;
|
||||
const int MAXN = 10;
|
||||
ed25519_secret_key keys[MAXN];
|
||||
ed25519_public_key pubkeys[MAXN];
|
||||
ed25519_secret_key nonces[MAXN];
|
||||
ed25519_public_key Rs[MAXN];
|
||||
ed25519_cosi_signature sigs[MAXN];
|
||||
unsigned char msg[32];
|
||||
uint8_t msg[32];
|
||||
rfc6979_state rng;
|
||||
int res;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user