[libfko] return proper GPG error code upon gpg_decrypt() failure
authorMichael Rash <mbr@cipherdyne.org>
Wed, 10 Jul 2013 01:18:45 +0000 (21:18 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Wed, 10 Jul 2013 01:18:45 +0000 (21:18 -0400)
lib/fko_encryption.c

index 28e30a4..d51c792 100644 (file)
@@ -417,10 +417,18 @@ gpg_decrypt(fko_ctx_t ctx, const char *dec_key)
 
     /* Done with cipher...
     */
-    res = zero_free((char *) cipher, ctx->encrypted_msg_len, FKO_SUCCESS);
-
     if(res != FKO_SUCCESS)
-        return(res);
+    {
+        if(zero_free((char *) cipher,
+                    ctx->encrypted_msg_len, FKO_SUCCESS) != FKO_SUCCESS)
+        {
+            return(FKO_ERROR_ZERO_OUT_DATA);
+        }
+        else
+        {
+            return(res);
+        }
+    }
 
     pt_len = strnlen(ctx->encoded_msg, MAX_SPA_ENCODED_MSG_SIZE);