aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/misc.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-09-26 04:34:50 +0000
committerNIIBE Yutaka <[email protected]>2023-09-26 04:34:50 +0000
commit26939ea2227b8c05b5721cc4b1ad88117e62d468 (patch)
treed482514d0f8e25ac50c79a235044cd1fc5a095aa /dirmngr/misc.c
parentgpg: Fix last commit. (diff)
downloadgnupg-26939ea2227b8c05b5721cc4b1ad88117e62d468.tar.gz
gnupg-26939ea2227b8c05b5721cc4b1ad88117e62d468.zip
Use gpgrt_b64* API of libgpg-error.
* common/Makefile.am (common_sources): Remove b64enc.c and b64dec.c. (module_maint_tests): Remove t-b64. (t_b64_LDADD): Remove. * common/util.h: Remove the internal API. * common/ssh-utils.c (get_fingerprint): Use the gpgrt_b64 API. (ssh_public_key_in_base64): Likewise. * dirmngr/crlfetch.c (my_es_read, crl_close_reader): Likewise. * dirmngr/dirmngr-client.c (data_cb, do_lookup): Likewise. * dirmngr/misc.c (armor_data): Likewise. * g10/export.c (export_one_ssh_key, export_secret_ssh_key): Likewise. * tools/gpg-card.c (cmd_writecert): Likewise. * tools/mime-parser.c (parse_message_cb, mime_parser_release) (process_part_data): Likewise. * tools/wks-util.c (wks_armor_key): Likewise. -- GnuPG-bug-id: 6734 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'dirmngr/misc.c')
-rw-r--r--dirmngr/misc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dirmngr/misc.c b/dirmngr/misc.c
index 9cedf911c..d1830237d 100644
--- a/dirmngr/misc.c
+++ b/dirmngr/misc.c
@@ -583,7 +583,7 @@ gpg_error_t
armor_data (char **r_string, const void *data, size_t datalen)
{
gpg_error_t err;
- struct b64state b64state;
+ gpgrt_b64state_t b64state;
estream_t fp;
long length;
char *buffer;
@@ -595,9 +595,15 @@ armor_data (char **r_string, const void *data, size_t datalen)
if (!fp)
return gpg_error_from_syserror ();
- if ((err=b64enc_start_es (&b64state, fp, "PGP PUBLIC KEY BLOCK"))
- || (err=b64enc_write (&b64state, data, datalen))
- || (err = b64enc_finish (&b64state)))
+ b64state = gpgrt_b64enc_start (fp, "PGP PUBLIC KEY BLOCK");
+ if (!b64state)
+ {
+ es_fclose (fp);
+ return gpg_error_from_syserror ();
+ }
+
+ if ((err = gpgrt_b64enc_write (b64state, data, datalen))
+ || (err = gpgrt_b64enc_finish (b64state)))
{
es_fclose (fp);
return err;