From 91056b1976bfb7b755e53b1302f4ede2b5cbc05d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 21 Jun 2010 10:01:24 +0000 Subject: Implement export of pkcs#12 objects using a direct agent connection. --- common/ChangeLog | 10 ++++++++++ common/sexputil.c | 6 +++--- common/util.h | 7 ++++++- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/ChangeLog b/common/ChangeLog index e5815738c..1f5637845 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,13 @@ +2010-06-21 Werner Koch + + * util.h (xfree_fnc): New. + +2010-06-18 Werner Koch + + * util.h (GPG_ERR_MISSING_KEY) [!GPG_ERR_MISSING_KEY]: New. + + * sexputil.c (make_canon_sexp_pad): Add arg SECURE. + 2010-06-17 Werner Koch * sexputil.c (make_canon_sexp_pad): New. diff --git a/common/sexputil.c b/common/sexputil.c index b336145c4..1e9c766e9 100644 --- a/common/sexputil.c +++ b/common/sexputil.c @@ -72,9 +72,9 @@ make_canon_sexp (gcry_sexp_t sexp, unsigned char **r_buffer, size_t *r_buflen) /* Same as make_canon_sexp but pad the buffer to multiple of 64 - bits. */ + bits. If SECURE is set, secure memory will be allocated. */ gpg_error_t -make_canon_sexp_pad (gcry_sexp_t sexp, +make_canon_sexp_pad (gcry_sexp_t sexp, int secure, unsigned char **r_buffer, size_t *r_buflen) { size_t len; @@ -88,7 +88,7 @@ make_canon_sexp_pad (gcry_sexp_t sexp, if (!len) return gpg_error (GPG_ERR_BUG); len += (8 - len % 8) % 8; - buf = xtrycalloc (1, len); + buf = secure? xtrycalloc_secure (1, len) : xtrycalloc (1, len); if (!buf) return gpg_error_from_syserror (); if (!gcry_sexp_sprint (sexp, GCRYSEXP_FMT_CANON, buf, len)) diff --git a/common/util.h b/common/util.h index 519bc5d68..2735cef3d 100644 --- a/common/util.h +++ b/common/util.h @@ -23,6 +23,10 @@ #include /* We need this for the memory function protos. */ #include /* We need errno. */ #include /* We need gpg_error_t. */ +/* Add error codes available only in newer versions of libgpg-error. */ +#ifndef GPG_ERR_MISSING_KEY +#define GPG_ERR_MISSING_KEY 181 +#endif /* Hash function used with libksba. */ #define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write) @@ -77,6 +81,7 @@ typedef char **rl_completion_func_t (const char *, int, int); #define xtryrealloc(a,b) gcry_realloc ((a),(b)) #define xtrystrdup(a) gcry_strdup ((a)) #define xfree(a) gcry_free ((a)) +#define xfree_fnc gcry_free #define xmalloc(a) gcry_xmalloc ((a)) #define xmalloc_secure(a) gcry_xmalloc_secure ((a)) @@ -146,7 +151,7 @@ gpg_error_t b64dec_finish (struct b64state *state); /*-- sexputil.c */ gpg_error_t make_canon_sexp (gcry_sexp_t sexp, unsigned char **r_buffer, size_t *r_buflen); -gpg_error_t make_canon_sexp_pad (gcry_sexp_t sexp, +gpg_error_t make_canon_sexp_pad (gcry_sexp_t sexp, int secure, unsigned char **r_buffer, size_t *r_buflen); gpg_error_t keygrip_from_canon_sexp (const unsigned char *key, size_t keylen, unsigned char *grip); -- cgit v1.2.3