Apply clang-format-10

This commit is contained in:
TamtamHero
2021-11-04 16:48:23 +01:00
committed by Edouard Merle
parent 6bad1c4b05
commit a7b2402bdb

View File

@@ -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,