[rs-commit] r45 - /redwax-signtext/trunk/src/linux/crypto.c
rs-commit at redwax.eu
rs-commit at redwax.eu
Mon Sep 12 21:00:12 CEST 2022
Author: minfrin at redwax.eu
Date: Mon Sep 12 21:00:11 2022
New Revision: 45
Log:
Don't close the message digest too earlier, we lose the result.
Modified:
redwax-signtext/trunk/src/linux/crypto.c
Modified: redwax-signtext/trunk/src/linux/crypto.c
==============================================================================
--- redwax-signtext/trunk/src/linux/crypto.c (original)
+++ redwax-signtext/trunk/src/linux/crypto.c Mon Sep 12 21:00:11 2022
@@ -646,14 +646,15 @@
digest = gcry_md_read (md, instance->hash_alg);
digest_len = gcry_md_get_algo_dlen (instance->hash_alg);
- gcry_md_close (md);
if (!digest || !digest_len) {
gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_SIGN_ERROR, "gcry_md_read / gcry_md_get_algo_dlen failed");
+ gcry_md_close (md);
goto fatal;
}
if (gcry_md_algo_info(instance->hash_alg, GCRYCTL_GET_ASNOID, NULL, &alg_len)) {
gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_SIGN_ERROR, "gcry_md_algo_info failed.");
+ gcry_md_close (md);
goto fatal;
}
alg = g_malloc(alg_len);
@@ -667,6 +668,8 @@
memcpy(data, alg, alg_len);
memcpy(data + alg_len, digest, digest_len);
g_free(alg);
+
+ gcry_md_close (md);
/*
* Sign on the line.
@@ -1196,10 +1199,6 @@
g_error_free (gerror);
}
-// if (certificate) {
-// g_object_unref(certificate);
-// }
-
-}
-
-
+}
+
+
More information about the rs-commit
mailing list