From 765e4d7747e1e8730c4198d9c3b8315d5f3f2fbc Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Wed, 17 Jun 2026 16:37:14 +0800 Subject: [PATCH] Fix bugs --- CMakeLists.txt | 2 +- include/gmssl/version.h | 2 +- tools/ghash.c | 4 ++++ tools/sphincssign.c | 4 ++++ tools/zuc.c | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 091ad289..53b66043 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -819,7 +819,7 @@ endif() # set(CPACK_PACKAGE_NAME "GmSSL") set(CPACK_PACKAGE_VENDOR "GmSSL develop team") -set(CPACK_PACKAGE_VERSION "3.2.0-dev.1082") +set(CPACK_PACKAGE_VERSION "3.2.0-dev.1083") set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README.md) set(CPACK_NSIS_MODIFY_PATH ON) include(CPack) diff --git a/include/gmssl/version.h b/include/gmssl/version.h index 0699546f..766cc82d 100644 --- a/include/gmssl/version.h +++ b/include/gmssl/version.h @@ -18,7 +18,7 @@ extern "C" { #define GMSSL_VERSION_NUM 30200 -#define GMSSL_VERSION_STR "GmSSL 3.2.0-dev.1082" +#define GMSSL_VERSION_STR "GmSSL 3.2.0-dev.1083" int gmssl_version_num(void); const char *gmssl_version_str(void); diff --git a/tools/ghash.c b/tools/ghash.c index 32d40776..8f452650 100644 --- a/tools/ghash.c +++ b/tools/ghash.c @@ -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); diff --git a/tools/sphincssign.c b/tools/sphincssign.c index 89115936..9a97e5ec 100644 --- a/tools/sphincssign.c +++ b/tools/sphincssign.c @@ -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]; diff --git a/tools/zuc.c b/tools/zuc.c index 797fea96..370e5729 100644 --- a/tools/zuc.c +++ b/tools/zuc.c @@ -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;