mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-19 19:33:38 +08:00
Fix bugs
This commit is contained in:
@@ -171,6 +171,10 @@ bad:
|
||||
while ((len = fread(buf, 1, sizeof(buf), infp)) > 0) {
|
||||
ghash_update(&ghash_ctx, buf, len);
|
||||
}
|
||||
if (ferror(infp)) {
|
||||
fprintf(stderr, "gmssl %s: read failure : %s\n", prog, strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
memset(buf, 0, sizeof(buf));
|
||||
}
|
||||
ghash_finish(&ghash_ctx, dgst);
|
||||
|
||||
@@ -137,6 +137,10 @@ bad:
|
||||
}
|
||||
}
|
||||
|
||||
// SPHINCS+ requires two passes over the input data (prepare then update),
|
||||
// so stdin streaming is not directly supported here. If infp == stdin,
|
||||
// input should be buffered into memory with calloc/malloc before the first pass.
|
||||
// TODO: buffer input to support stdin in a future version
|
||||
rewind(infp);
|
||||
while (1) {
|
||||
uint8_t buf[1024];
|
||||
|
||||
@@ -123,6 +123,10 @@ bad:
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (ferror(infp)) {
|
||||
fprintf(stderr, "%s: read failure : %s\n", prog, strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
if (zuc_encrypt_finish(&zuc_ctx, outbuf, &outlen) != 1) {
|
||||
fprintf(stderr, "%s: inner error\n", prog);
|
||||
goto end;
|
||||
|
||||
Reference in New Issue
Block a user