Fix integer underflow when writing updated sk
This caused secret key files to become close to MAXINT bytes, as the unsigned int that is the private key size would be subtracted from MAXINT when its negative was used as offset.
This commit is contained in:
parent
8970c4933c
commit
998137622a
@ -43,7 +43,7 @@ int main(int argc, char **argv) {
|
|||||||
fread(m, 1, MLEN, stdin);
|
fread(m, 1, MLEN, stdin);
|
||||||
xmss_core_sign(¶ms, sk, sm, &smlen, m, MLEN);
|
xmss_core_sign(¶ms, sk, sm, &smlen, m, MLEN);
|
||||||
|
|
||||||
fseek(keypair, -params.privatekey_bytes, SEEK_CUR);
|
fseek(keypair, -((long int)params.privatekey_bytes), SEEK_CUR);
|
||||||
fwrite(sk, 1, params.privatekey_bytes, keypair);
|
fwrite(sk, 1, params.privatekey_bytes, keypair);
|
||||||
fwrite(sm, 1, params.bytes + MLEN, stdout);
|
fwrite(sm, 1, params.bytes + MLEN, stdout);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user