mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-19 19:33:38 +08:00
Fix return without clean
This commit is contained in:
@@ -819,7 +819,7 @@ endif()
|
|||||||
#
|
#
|
||||||
set(CPACK_PACKAGE_NAME "GmSSL")
|
set(CPACK_PACKAGE_NAME "GmSSL")
|
||||||
set(CPACK_PACKAGE_VENDOR "GmSSL develop team")
|
set(CPACK_PACKAGE_VENDOR "GmSSL develop team")
|
||||||
set(CPACK_PACKAGE_VERSION "3.2.0-dev.1078")
|
set(CPACK_PACKAGE_VERSION "3.2.0-dev.1079")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README.md)
|
set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README.md)
|
||||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
#define GMSSL_VERSION_NUM 30200
|
#define GMSSL_VERSION_NUM 30200
|
||||||
#define GMSSL_VERSION_STR "GmSSL 3.2.0-dev.1078"
|
#define GMSSL_VERSION_STR "GmSSL 3.2.0-dev.1079"
|
||||||
|
|
||||||
int gmssl_version_num(void);
|
int gmssl_version_num(void);
|
||||||
const char *gmssl_version_str(void);
|
const char *gmssl_version_str(void);
|
||||||
|
|||||||
@@ -144,12 +144,15 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(crl, crl_len, 1, outfp);
|
if (fwrite(crl, crl_len, 1, outfp) != 1) {
|
||||||
|
error_print();
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
end:
|
end:
|
||||||
if (cert) free(cert);
|
if (cert) free(cert);
|
||||||
|
if (crl) free(crl);
|
||||||
if (outfile && outfp) fclose(outfp);
|
if (outfile && outfp) fclose(outfp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ int hsskeygen_main(int argc, char **argv)
|
|||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
lms_types = *(++argv);
|
lms_types = *(++argv);
|
||||||
strncpy(lms_types_str, lms_types, sizeof(lms_types_str));
|
strncpy(lms_types_str, lms_types, sizeof(lms_types_str));
|
||||||
|
lms_types_str[sizeof(lms_types_str) - 1] = 0;
|
||||||
|
|
||||||
tok = strtok(lms_types_str, ":");
|
tok = strtok(lms_types_str, ":");
|
||||||
while (tok) {
|
while (tok) {
|
||||||
|
|||||||
@@ -103,11 +103,11 @@ bad:
|
|||||||
|
|
||||||
if (x509_key_generate(&key, OID_ec_public_key, &curve_oid, sizeof(curve_oid)) != 1) {
|
if (x509_key_generate(&key, OID_ec_public_key, &curve_oid, sizeof(curve_oid)) != 1) {
|
||||||
fprintf(stderr, "gmssl %s: inner failure\n", prog);
|
fprintf(stderr, "gmssl %s: inner failure\n", prog);
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
if (x509_private_key_info_encrypt_to_pem(&key, pass, outfp) != 1) {
|
if (x509_private_key_info_encrypt_to_pem(&key, pass, outfp) != 1) {
|
||||||
fprintf(stderr, "gmssl %s: inner failure\n", prog);
|
fprintf(stderr, "gmssl %s: inner failure\n", prog);
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
if (x509_public_key_info_to_pem(&key, puboutfp) != 1) {
|
if (x509_public_key_info_to_pem(&key, puboutfp) != 1) {
|
||||||
fprintf(stderr, "gmssl %s: inner failure\n", prog);
|
fprintf(stderr, "gmssl %s: inner failure\n", prog);
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ bad:
|
|||||||
|
|
||||||
if ((ret = sdf_sign(&key, dgst, sig, &siglen)) != 1) {
|
if ((ret = sdf_sign(&key, dgst, sig, &siglen)) != 1) {
|
||||||
fprintf(stderr, "%s: inner error\n", prog);
|
fprintf(stderr, "%s: inner error\n", prog);
|
||||||
|
ret = -1;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (fwrite(sig, 1, siglen, outfp) != siglen) {
|
if (fwrite(sig, 1, siglen, outfp) != siglen) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ int sm9decrypt_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
bad:
|
bad:
|
||||||
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
||||||
return 1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ int sm9encrypt_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
bad:
|
bad:
|
||||||
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
||||||
return 1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
@@ -103,7 +103,7 @@ bad:
|
|||||||
}
|
}
|
||||||
if (sm9_enc_master_public_key_from_pem(&mpk, mpkfp) != 1) {
|
if (sm9_enc_master_public_key_from_pem(&mpk, mpkfp) != 1) {
|
||||||
error_print();
|
error_print();
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
if ((inlen = fread(inbuf, 1, sizeof(inbuf), infp)) <= 0) {
|
if ((inlen = fread(inbuf, 1, sizeof(inbuf), infp)) <= 0) {
|
||||||
error_print();
|
error_print();
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ int sm9keygen_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
bad:
|
bad:
|
||||||
fprintf(stderr, "%s: illegal option '%s'\n", prog, *argv);
|
fprintf(stderr, "%s: illegal option '%s'\n", prog, *argv);
|
||||||
return 1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,5 +147,5 @@ end:
|
|||||||
gmssl_secure_clear(&enc_key, sizeof(enc_key));
|
gmssl_secure_clear(&enc_key, sizeof(enc_key));
|
||||||
if (infile && infp) fclose(infp);
|
if (infile && infp) fclose(infp);
|
||||||
if (outfile && outfp) fclose(outfp);
|
if (outfile && outfp) fclose(outfp);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ int sm9setup_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
bad:
|
bad:
|
||||||
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
||||||
return 1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
@@ -142,7 +142,7 @@ end:
|
|||||||
gmssl_secure_clear(&enc_msk, sizeof(enc_msk));
|
gmssl_secure_clear(&enc_msk, sizeof(enc_msk));
|
||||||
if (outfile && outfp) fclose(outfp);
|
if (outfile && outfp) fclose(outfp);
|
||||||
if (puboutfile && puboutfp) fclose(puboutfp);
|
if (puboutfile && puboutfp) fclose(puboutfp);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ int sm9sign_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
bad:
|
bad:
|
||||||
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
||||||
return 1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
@@ -107,7 +107,7 @@ bad:
|
|||||||
|
|
||||||
if (sm9_sign_key_info_decrypt_from_pem(&key, pass, keyfp) != 1) {
|
if (sm9_sign_key_info_decrypt_from_pem(&key, pass, keyfp) != 1) {
|
||||||
error_print();
|
error_print();
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sm9_sign_init(&ctx) != 1) {
|
if (sm9_sign_init(&ctx) != 1) {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ int sm9verify_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
bad:
|
bad:
|
||||||
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
fprintf(stderr, "gmssl %s: illegal option '%s'\n", prog, *argv);
|
||||||
return 1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ bad:
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
end:
|
end:
|
||||||
//xmss_key_cleanup(&key);
|
xmss_key_cleanup(&key);
|
||||||
if (out) {
|
if (out) {
|
||||||
gmssl_secure_clear(out, outlen);
|
gmssl_secure_clear(out, outlen);
|
||||||
free(out);
|
free(out);
|
||||||
|
|||||||
Reference in New Issue
Block a user