sm: Handle gcry_pk_encrypt return value.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 15 Dec 2015 03:38:25 +0000 (12:38 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 15 Dec 2015 03:44:41 +0000 (12:44 +0900)
* sm/encrypt.c (encrypt_dek): Don't ignore failure of gcry_pk_encrypt.

--

Thanks to Sami Farin.

GnuPG-bug-id: 2154

(backport commit of 4ee881bff4c8fdfa4b3b7a4b7afab611471e97f1)

sm/encrypt.c

index 42a438a..ab74fa2 100644 (file)
@@ -208,8 +208,11 @@ encrypt_dek (const DEK dek, ksba_cert_t cert, unsigned char **encval)
   gcry_sexp_release (s_pkey);
   
   /* Reformat it. */
-  rc = make_canon_sexp (s_ciph, encval, NULL);
-  gcry_sexp_release (s_ciph);
+  if (!rc)
+    {
+      rc = make_canon_sexp (s_ciph, encval, NULL);
+      gcry_sexp_release (s_ciph);
+    }
   return rc;
 }