From a7b2402bdb09a42f497945fb95e2407b3ac28bc4 Mon Sep 17 00:00:00 2001 From: TamtamHero <10632523+TamtamHero@users.noreply.github.com> Date: Thu, 4 Nov 2021 16:48:23 +0100 Subject: [PATCH] Apply clang-format-10 --- src/stark_utils.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/stark_utils.c b/src/stark_utils.c index 25fb407..f94d506 100644 --- a/src/stark_utils.c +++ b/src/stark_utils.c @@ -95,22 +95,20 @@ void pedersen(FieldElement res, /* out */ } #ifdef TARGET_NANOX -void shift_stark_hash(FieldElement hash){ +void shift_stark_hash(FieldElement hash) { uint256_t hash256, final_hash256; readu256BE(hash, &hash256); uint32_t bits_count = bits256(&hash256); - if(bits_count < 248){ + if (bits_count < 248) { return; - } - else if(bits_count >= 248 && bits_count%8 >= 1 && bits_count%8 <= 4){ + } else if (bits_count >= 248 && bits_count % 8 >= 1 && bits_count % 8 <= 4) { shiftl256(&hash256, 4, &final_hash256); write_u64_be(hash, UPPER(UPPER_P((&final_hash256)))); - write_u64_be(hash+8, LOWER(UPPER_P((&final_hash256)))); - write_u64_be(hash+16, UPPER(LOWER_P((&final_hash256)))); - write_u64_be(hash+24, LOWER(LOWER_P((&final_hash256)))); + write_u64_be(hash + 8, LOWER(UPPER_P((&final_hash256)))); + write_u64_be(hash + 16, UPPER(LOWER_P((&final_hash256)))); + write_u64_be(hash + 24, LOWER(LOWER_P((&final_hash256)))); return; - } - else{ + } else { THROW(0x6A80); } } @@ -141,7 +139,7 @@ int stark_sign(uint8_t *signature, /* out */ PRINTF("Pedersen hash 2 %.*H\n", 32, hash); #ifdef TARGET_NANOX shift_stark_hash(hash); -#endif // TARGET_NANOX +#endif cx_ecfp_init_private_key(CX_CURVE_Stark256, privateKeyData, 32, &privateKey); io_seproxyhal_io_heartbeat(); int signatureLength = cx_ecdsa_sign(&privateKey,