aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Makefile.am5
-rw-r--r--common/ssh-utils.c24
-rw-r--r--common/util.h29
3 files changed, 14 insertions, 44 deletions
diff --git a/common/Makefile.am b/common/Makefile.am
index 0d5af3e5c..189874ab5 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -65,7 +65,7 @@ common_sources = \
homedir.c \
gettime.c gettime.h \
yesno.c \
- b64enc.c b64dec.c zb32.c zb32.h \
+ zb32.c zb32.h \
convert.c \
percent.c \
mbox-util.c mbox-util.h \
@@ -169,7 +169,7 @@ module_tests += t-exectool
endif
if MAINTAINER_MODE
-module_maint_tests = t-helpfile t-b64
+module_maint_tests = t-helpfile
else
module_maint_tests =
endif
@@ -196,7 +196,6 @@ t_gettime_LDADD = $(t_common_ldadd)
t_sysutils_LDADD = $(t_common_ldadd)
t_helpfile_LDADD = $(t_common_ldadd)
t_sexputil_LDADD = $(t_common_ldadd)
-t_b64_LDADD = $(t_common_ldadd)
t_exechelp_LDADD = $(t_common_ldadd)
t_exectool_LDADD = $(t_common_ldadd)
t_session_env_LDADD = $(t_common_ldadd)
diff --git a/common/ssh-utils.c b/common/ssh-utils.c
index ab29558cf..d27e2e200 100644
--- a/common/ssh-utils.c
+++ b/common/ssh-utils.c
@@ -259,7 +259,7 @@ get_fingerprint (gcry_sexp_t key, int algo,
}
else
{
- struct b64state b64s;
+ gpgrt_b64state_t b64s;
estream_t stream;
char *p;
long int len;
@@ -273,15 +273,15 @@ get_fingerprint (gcry_sexp_t key, int algo,
goto leave;
}
- err = b64enc_start_es (&b64s, stream, "");
- if (err)
+ b64s = gpgrt_b64enc_start (stream, "");
+ if (!b64s)
{
es_fclose (stream);
goto leave;
}
- err = b64enc_write (&b64s,
- gcry_md_read (md, algo), gcry_md_get_algo_dlen (algo));
+ err = gpgrt_b64enc_write (b64s, gcry_md_read (md, algo),
+ gcry_md_get_algo_dlen (algo));
if (err)
{
es_fclose (stream);
@@ -289,7 +289,7 @@ get_fingerprint (gcry_sexp_t key, int algo,
}
/* Finish, get the length, and close the stream. */
- err = b64enc_finish (&b64s);
+ err = gpgrt_b64enc_finish (b64s);
len = es_ftell (stream);
es_fclose (stream);
if (err)
@@ -566,7 +566,7 @@ ssh_public_key_in_base64 (gcry_sexp_t key, estream_t stream,
const char *identifier = NULL;
void *blob = NULL;
size_t bloblen;
- struct b64state b64_state;
+ gpgrt_b64state_t b64_state;
algo = get_pk_algo_from_key (key);
if (algo == 0)
@@ -624,15 +624,15 @@ ssh_public_key_in_base64 (gcry_sexp_t key, estream_t stream,
es_fprintf (stream, "%s ", identifier);
- err = b64enc_start_es (&b64_state, stream, "");
- if (err)
+ b64_state = gpgrt_b64enc_start (stream, "");
+ if (!b64_state)
{
es_free (blob);
- return err;
+ return gpg_error_from_syserror ();
}
- err = b64enc_write (&b64_state, blob, bloblen);
- b64enc_finish (&b64_state);
+ err = gpgrt_b64enc_write (b64_state, blob, bloblen);
+ gpgrt_b64enc_finish (b64_state);
es_free (blob);
if (err)
return err;
diff --git a/common/util.h b/common/util.h
index 6b948510e..764030ad8 100644
--- a/common/util.h
+++ b/common/util.h
@@ -143,35 +143,6 @@ ssize_t read_line (FILE *fp,
char **addr_of_buffer, size_t *length_of_buffer,
size_t *max_length);
-
-/*-- b64enc.c and b64dec.c --*/
-struct b64state
-{
- unsigned int flags;
- int idx;
- int quad_count;
- FILE *fp;
- estream_t stream;
- char *title;
- unsigned char radbuf[4];
- u32 crc;
- int stop_seen:1;
- int invalid_encoding:1;
- gpg_error_t lasterr;
-};
-
-gpg_error_t b64enc_start (struct b64state *state, FILE *fp, const char *title);
-gpg_error_t b64enc_start_es (struct b64state *state, estream_t fp,
- const char *title);
-gpg_error_t b64enc_write (struct b64state *state,
- const void *buffer, size_t nbytes);
-gpg_error_t b64enc_finish (struct b64state *state);
-
-gpg_error_t b64dec_start (struct b64state *state, const char *title);
-gpg_error_t b64dec_proc (struct b64state *state, void *buffer, size_t length,
- size_t *r_nbytes);
-gpg_error_t b64dec_finish (struct b64state *state);
-
/*-- sexputil.c */
char *canon_sexp_to_string (const unsigned char *canon, size_t canonlen);
void log_printcanon (const char *text,