[libbdplus-devel] Check gcry_sexp_build() result

anonymous git at videolan.org
Thu Mar 16 11:41:18 CET 2017


libbdplus | branch: master | anonymous <anonymous at anonymous.org> | Thu Mar 16 12:29:34 2017 +0200| [d078c62296e880f1581f808307237f33e0bc8f0b] | committer: anonymous

Check gcry_sexp_build() result

> http://git.videolan.org/gitweb.cgi/libbdplus.git/?a=commit;h=d078c62296e880f1581f808307237f33e0bc8f0b
---

 src/libbdplus/bdsvm/trap.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/libbdplus/bdsvm/trap.c b/src/libbdplus/bdsvm/trap.c
index 7581150..d8fc942 100644
--- a/src/libbdplus/bdsvm/trap.c
+++ b/src/libbdplus/bdsvm/trap.c
@@ -426,7 +426,7 @@ uint32_t TRAP_PrivateKey(bdplus_config_t *config, uint32_t keyID, uint8_t *dst,
     }
 
     /* Build an s-expression for the hash */
-    gcry_sexp_build(&sexp_data, NULL,
+    gcry_err = gcry_sexp_build(&sexp_data, NULL,
                     "(data"
 #if defined(GCRYPT_VERSION_NUMBER) && GCRYPT_VERSION_NUMBER >= 0x010600
                     /*
@@ -442,6 +442,15 @@ uint32_t TRAP_PrivateKey(bdplus_config_t *config, uint32_t keyID, uint8_t *dst,
                     mpi_hash
                     );
 
+    if (gcry_err)
+    {
+      memset(errstr, 0, sizeof(errstr));
+      gpg_strerror_r(gcry_err, errstr, sizeof(errstr));
+      BD_DEBUG(DBG_BDPLUS|DBG_CRIT,"[TRAP] TRAP_PrivateKey(%X, %08X) error building "
+            "sexp_data: %s\n",
+            keyID, controlWord, errstr);
+    }
+
     /* Dump information about the data s-expression when debugging */
     if (GCRYPT_DEBUG)
     {



More information about the libbdplus-devel mailing list