aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-06-23 07:48:54 +0000
committerWerner Koch <[email protected]>2016-06-23 07:51:41 +0000
commitf8b8027ae63c957557ed6bdc7e5a30ef1bdd8e77 (patch)
tree8a7e9fac4452e8f1ef7c7e1148062f2b0d91b9e5 /src/util.h
parentcore: Detect compressed signed OpenPGP data. (diff)
downloadgpgme-f8b8027ae63c957557ed6bdc7e5a30ef1bdd8e77.tar.gz
gpgme-f8b8027ae63c957557ed6bdc7e5a30ef1bdd8e77.zip
core: Add a base 64 decoder.
* src/b64dec.c: New. Taken from gnupg. Prefix function names with _gpgme_ and change to use standard C malloc functions. * src/util.h.h (struct b64state): New. * src/Makefile.am (main_sources): Add file. -- The file b64dec.c has been taken from gnupg commit e430ff6ad0b7dcfcebd92b825dd5168205447ff3 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 9c62f57d..5a0f7906 100644
--- a/src/util.h
+++ b/src/util.h
@@ -147,6 +147,26 @@ gpgme_error_t _gpgme_map_gnupg_error (char *err);
int _gpgme_map_pk_algo (int algo, gpgme_protocol_t protocol);
+/*-- b64dec.c --*/
+
+struct b64state
+{
+ int idx;
+ int quad_count;
+ char *title;
+ unsigned char radbuf[4];
+ int stop_seen:1;
+ int invalid_encoding:1;
+ gpg_error_t lasterr;
+};
+
+gpg_error_t _gpgme_b64dec_start (struct b64state *state, const char *title);
+gpg_error_t _gpgme_b64dec_proc (struct b64state *state,
+ void *buffer, size_t length, size_t *r_nbytes);
+gpg_error_t _gpgme_b64dec_finish (struct b64state *state);
+
+
+
/* Retrieve the environment variable NAME and return a copy of it in a
malloc()'ed buffer in *VALUE. If the environment variable is not
set, return NULL in *VALUE. */