aboutsummaryrefslogtreecommitdiffstats
path: root/sm
diff options
context:
space:
mode:
Diffstat (limited to 'sm')
-rw-r--r--sm/ChangeLog4
-rw-r--r--sm/encrypt.c18
2 files changed, 7 insertions, 15 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog
index 150d680a3..c59ef06ea 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-27 Werner Koch <[email protected]>
+
+ * encrypt.c (encrypt_dek): Make use of make_canon_sexp.
+
2009-05-18 Werner Koch <[email protected]>
* server.c (option_handler): New option "no-encrypt-to".
diff --git a/sm/encrypt.c b/sm/encrypt.c
index 016e98fd5..a526a649e 100644
--- a/sm/encrypt.c
+++ b/sm/encrypt.c
@@ -207,22 +207,10 @@ encrypt_dek (const DEK dek, ksba_cert_t cert, unsigned char **encval)
gcry_sexp_release (s_data);
gcry_sexp_release (s_pkey);
- /* reformat it */
- len = gcry_sexp_sprint (s_ciph, GCRYSEXP_FMT_CANON, NULL, 0);
- assert (len);
- buf = xtrymalloc (len);
- if (!buf)
- {
- gpg_error_t tmperr = out_of_core ();
- gcry_sexp_release (s_ciph);
- return tmperr;
- }
- len = gcry_sexp_sprint (s_ciph, GCRYSEXP_FMT_CANON, (char*)buf, len);
- assert (len);
+ /* Reformat it. */
+ rc = make_canon_sexp (s_ciph, encval, NULL);
gcry_sexp_release (s_ciph);
-
- *encval = buf;
- return 0;
+ return rc;
}