fix checkpoint loading (use carry for add)

This commit is contained in:
cathugger 2023-08-06 05:13:37 +03:00
parent 2b417046b6
commit 6a2b5e60bf
No known key found for this signature in database
GPG Key ID: 9BADDA2DAF6F01A8
2 changed files with 7 additions and 2 deletions

7
main.c
View File

@ -612,8 +612,11 @@ int main(int argc,char **argv)
fclose(checkout);
// Apply checkpoint to determseed
for (int i = 0; i < SEED_LEN; i++)
determseed[i] += checkpoint[i];
bool carry = 0;
for (int i = 0; i < SEED_LEN; i++) {
determseed[i] += checkpoint[i] + carry;
carry = determseed[i] < checkpoint[i];
}
}
}
}

View File

@ -150,6 +150,7 @@ union pubonionunion {
} i;
} ;
/*
// little endian inc
static void addsk32(u8 *sk)
{
@ -160,6 +161,7 @@ static void addsk32(u8 *sk)
if (!c) break;
}
}
*/
// 0123 4567 xxxx --3--> 3456 7xxx
// 0123 4567 xxxx --1--> 1234 567x