mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
common: Rename remaining symbols in ksba-io-support.
* common/ksba-io-support.c (gpgsm_reader_eof_seen): Rename to ... (gnupg_ksba_reader_eof_seen): this. Change all callers. (gpgsm_destroy_reader): Rename to ... (gnupg_ksba_destroy_reader): this. Change all callers. (gpgsm_finish_writer): Rename to ... (gnupg_ksba_finish_writer): this. Change all callers. (gpgsm_destroy_writer): Rename to ... (gnupg_ksba_destroy_writer): this. Change all callers. * common/ksba-io-support.c (struct base64_context_s): Rename to ... (gnupg_ksba_io_s): this. * common/ksba-io-support.h (base64_context_s): Ditto. (Base64Context): Rename this typedef to ... (gnupg_ksba_io_t): this. Change all users. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
28c31524be
commit
e1dfd86236
@ -101,8 +101,8 @@ struct writer_cb_parm_s
|
||||
};
|
||||
|
||||
|
||||
/* context for this module's functions */
|
||||
struct base64_context_s {
|
||||
/* Context for this module's functions. */
|
||||
struct gnupg_ksba_io_s {
|
||||
union {
|
||||
struct reader_cb_parm_s rparm;
|
||||
struct writer_cb_parm_s wparm;
|
||||
@ -475,7 +475,7 @@ base64_writer_cb (void *cb_value, const void *buffer, size_t count)
|
||||
}
|
||||
|
||||
|
||||
/* This callback is only used in stream mode. Hiowever, we don't
|
||||
/* This callback is only used in stream mode. However, we don't
|
||||
restrict it to this. */
|
||||
static int
|
||||
plain_writer_cb (void *cb_value, const void *buffer, size_t count)
|
||||
@ -553,7 +553,7 @@ base64_finish_write (struct writer_cb_parm_s *parm)
|
||||
/* Create a reader for the stream FP. FLAGS can be used to specify
|
||||
* the expected input encoding.
|
||||
*
|
||||
* The function returns a Base64Context object which must be passed to
|
||||
* The function returns a gnupg_ksba_io_t object which must be passed to
|
||||
* the gpgme_destroy_reader function. The created ksba_reader_t
|
||||
* object is stored at R_READER - the caller must not call the
|
||||
* ksba_reader_release function on.
|
||||
@ -571,7 +571,7 @@ base64_finish_write (struct writer_cb_parm_s *parm)
|
||||
* which in turn has a gight priority than the AUTODETECT flag.
|
||||
*/
|
||||
gpg_error_t
|
||||
gnupg_ksba_create_reader (Base64Context *ctx,
|
||||
gnupg_ksba_create_reader (gnupg_ksba_io_t *ctx,
|
||||
unsigned int flags, estream_t fp,
|
||||
ksba_reader_t *r_reader)
|
||||
{
|
||||
@ -624,14 +624,17 @@ gnupg_ksba_create_reader (Base64Context *ctx,
|
||||
}
|
||||
|
||||
|
||||
/* Return True if an EOF as been seen. */
|
||||
int
|
||||
gpgsm_reader_eof_seen (Base64Context ctx)
|
||||
gnupg_ksba_reader_eof_seen (gnupg_ksba_io_t ctx)
|
||||
{
|
||||
return ctx && ctx->u.rparm.eof_seen;
|
||||
}
|
||||
|
||||
|
||||
/* Destroy a reader object. */
|
||||
void
|
||||
gpgsm_destroy_reader (Base64Context ctx)
|
||||
gnupg_ksba_destroy_reader (gnupg_ksba_io_t ctx)
|
||||
{
|
||||
if (!ctx)
|
||||
return;
|
||||
@ -647,7 +650,7 @@ gpgsm_destroy_reader (Base64Context ctx)
|
||||
* and footer lines; if PEM_NAME is NULL the string "CMS OBJECT" is
|
||||
* used.
|
||||
*
|
||||
* The function returns a Base64Context object which must be passed to
|
||||
* The function returns a gnupg_ksba_io_t object which must be passed to
|
||||
* the gpgme_destroy_writer function. The created ksba_writer_t
|
||||
* object is stored at R_WRITER - the caller must not call the
|
||||
* ksba_reader_release function on it.
|
||||
@ -660,7 +663,7 @@ gpgsm_destroy_reader (Base64Context ctx)
|
||||
*
|
||||
*/
|
||||
gpg_error_t
|
||||
gnupg_ksba_create_writer (Base64Context *ctx, unsigned int flags,
|
||||
gnupg_ksba_create_writer (gnupg_ksba_io_t *ctx, unsigned int flags,
|
||||
const char *pem_name, estream_t stream,
|
||||
ksba_writer_t *r_writer)
|
||||
{
|
||||
@ -718,8 +721,10 @@ gnupg_ksba_create_writer (Base64Context *ctx, unsigned int flags,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gpgsm_finish_writer (Base64Context ctx)
|
||||
/* Flush a writer. This is for example required to write the padding
|
||||
* or the PEM footer. */
|
||||
gpg_error_t
|
||||
gnupg_ksba_finish_writer (gnupg_ksba_io_t ctx)
|
||||
{
|
||||
struct writer_cb_parm_s *parm;
|
||||
|
||||
@ -735,8 +740,9 @@ gpgsm_finish_writer (Base64Context ctx)
|
||||
}
|
||||
|
||||
|
||||
/* Destroy a writer object. */
|
||||
void
|
||||
gpgsm_destroy_writer (Base64Context ctx)
|
||||
gnupg_ksba_destroy_writer (gnupg_ksba_io_t ctx)
|
||||
{
|
||||
if (!ctx)
|
||||
return;
|
||||
|
@ -34,31 +34,31 @@
|
||||
* gnupg_ksba_create_writer. */
|
||||
#define GNUPG_KSBA_IO_PEM 1 /* X.509 PEM format. */
|
||||
#define GNUPG_KSBA_IO_BASE64 2 /* Plain Base64 format. */
|
||||
#define GNUPG_KSBA_IO_AUTODETECT 4 /* Try toautodeect the format. */
|
||||
#define GNUPG_KSBA_IO_AUTODETECT 4 /* Try to autodetect the format. */
|
||||
#define GNUPG_KSBA_IO_MULTIPEM 8 /* Allow more than one PEM chunk. */
|
||||
|
||||
|
||||
/* Context object. */
|
||||
typedef struct base64_context_s *Base64Context;
|
||||
typedef struct gnupg_ksba_io_s *gnupg_ksba_io_t;
|
||||
|
||||
|
||||
|
||||
gpg_error_t gnupg_ksba_create_reader (Base64Context *ctx,
|
||||
gpg_error_t gnupg_ksba_create_reader (gnupg_ksba_io_t *ctx,
|
||||
unsigned int flags,
|
||||
estream_t fp,
|
||||
ksba_reader_t *r_reader);
|
||||
|
||||
int gpgsm_reader_eof_seen (Base64Context ctx);
|
||||
void gpgsm_destroy_reader (Base64Context ctx);
|
||||
int gnupg_ksba_reader_eof_seen (gnupg_ksba_io_t ctx);
|
||||
void gnupg_ksba_destroy_reader (gnupg_ksba_io_t ctx);
|
||||
|
||||
gpg_error_t gnupg_ksba_create_writer (Base64Context *ctx,
|
||||
gpg_error_t gnupg_ksba_create_writer (gnupg_ksba_io_t *ctx,
|
||||
unsigned int flags,
|
||||
const char *pem_name,
|
||||
estream_t stream,
|
||||
ksba_writer_t *r_writer);
|
||||
|
||||
int gpgsm_finish_writer (Base64Context ctx);
|
||||
void gpgsm_destroy_writer (Base64Context ctx);
|
||||
gpg_error_t gnupg_ksba_finish_writer (gnupg_ksba_io_t ctx);
|
||||
void gnupg_ksba_destroy_writer (gnupg_ksba_io_t ctx);
|
||||
|
||||
|
||||
|
||||
|
@ -737,7 +737,7 @@ proc_parameters (ctrl_t ctrl, struct para_data_s *para,
|
||||
|
||||
if (!outctrl->dryrun)
|
||||
{
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
ksba_writer_t writer;
|
||||
int create_cert ;
|
||||
|
||||
@ -756,7 +756,7 @@ proc_parameters (ctrl_t ctrl, struct para_data_s *para,
|
||||
rc = create_request (ctrl, para, cardkeyid, public, sigkey, writer);
|
||||
if (!rc)
|
||||
{
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
else
|
||||
@ -766,7 +766,7 @@ proc_parameters (ctrl_t ctrl, struct para_data_s *para,
|
||||
create_cert?"":" request");
|
||||
}
|
||||
}
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
}
|
||||
}
|
||||
|
||||
|
10
sm/decrypt.c
10
sm/decrypt.c
@ -243,8 +243,8 @@ int
|
||||
gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp)
|
||||
{
|
||||
int rc;
|
||||
Base64Context b64reader = NULL;
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64reader = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
ksba_reader_t reader;
|
||||
ksba_writer_t writer;
|
||||
ksba_cms_t cms = NULL;
|
||||
@ -564,7 +564,7 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp)
|
||||
}
|
||||
while (stopreason != KSBA_SR_READY);
|
||||
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
@ -582,8 +582,8 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp)
|
||||
gpg_strerror (rc), gpg_strsource (rc));
|
||||
}
|
||||
ksba_cms_release (cms);
|
||||
gpgsm_destroy_reader (b64reader);
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_reader (b64reader);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
keydb_release (kh);
|
||||
es_fclose (in_fp);
|
||||
if (dfparm.hd)
|
||||
|
@ -299,7 +299,7 @@ int
|
||||
gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp)
|
||||
{
|
||||
int rc = 0;
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
gpg_error_t err;
|
||||
ksba_writer_t writer;
|
||||
ksba_reader_t reader = NULL;
|
||||
@ -502,7 +502,7 @@ gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp)
|
||||
}
|
||||
|
||||
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
@ -513,7 +513,7 @@ gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp)
|
||||
|
||||
leave:
|
||||
ksba_cms_release (cms);
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
ksba_reader_release (reader);
|
||||
keydb_release (kh);
|
||||
xfree (dek);
|
||||
|
18
sm/export.c
18
sm/export.c
@ -133,7 +133,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream)
|
||||
KEYDB_HANDLE hd = NULL;
|
||||
KEYDB_SEARCH_DESC *desc = NULL;
|
||||
int ndesc;
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
ksba_writer_t writer;
|
||||
strlist_t sl;
|
||||
ksba_cert_t cert = NULL;
|
||||
@ -284,13 +284,13 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream)
|
||||
if (ctrl->create_pem)
|
||||
{
|
||||
/* We want one certificate per PEM block */
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
b64writer = NULL;
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream)
|
||||
log_error ("keydb_search failed: %s\n", gpg_strerror (rc));
|
||||
else if (b64writer)
|
||||
{
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
@ -311,7 +311,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream)
|
||||
}
|
||||
|
||||
leave:
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
ksba_cert_release (cert);
|
||||
xfree (desc);
|
||||
keydb_release (hd);
|
||||
@ -331,7 +331,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode)
|
||||
gpg_error_t err = 0;
|
||||
KEYDB_HANDLE hd;
|
||||
KEYDB_SEARCH_DESC *desc = NULL;
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
ksba_writer_t writer;
|
||||
ksba_cert_t cert = NULL;
|
||||
const unsigned char *image;
|
||||
@ -463,13 +463,13 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode)
|
||||
if (ctrl->create_pem)
|
||||
{
|
||||
/* We want one certificate per PEM block */
|
||||
err = gpgsm_finish_writer (b64writer);
|
||||
err = gnupg_ksba_finish_writer (b64writer);
|
||||
if (err)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (err));
|
||||
goto leave;
|
||||
}
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
b64writer = NULL;
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode)
|
||||
cert = NULL;
|
||||
|
||||
leave:
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
ksba_cert_release (cert);
|
||||
xfree (desc);
|
||||
keydb_release (hd);
|
||||
|
@ -272,7 +272,7 @@ static int
|
||||
import_one (ctrl_t ctrl, struct stats_s *stats, int in_fd)
|
||||
{
|
||||
int rc;
|
||||
Base64Context b64reader = NULL;
|
||||
gnupg_ksba_io_t b64reader = NULL;
|
||||
ksba_reader_t reader;
|
||||
ksba_cert_t cert = NULL;
|
||||
ksba_cms_t cms = NULL;
|
||||
@ -380,14 +380,14 @@ import_one (ctrl_t ctrl, struct stats_s *stats, int in_fd)
|
||||
|
||||
ksba_reader_clear (reader, NULL, NULL);
|
||||
}
|
||||
while (!gpgsm_reader_eof_seen (b64reader));
|
||||
while (!gnupg_ksba_reader_eof_seen (b64reader));
|
||||
|
||||
leave:
|
||||
if (any && gpg_err_code (rc) == GPG_ERR_EOF)
|
||||
rc = 0;
|
||||
ksba_cms_release (cms);
|
||||
ksba_cert_release (cert);
|
||||
gpgsm_destroy_reader (b64reader);
|
||||
gnupg_ksba_destroy_reader (b64reader);
|
||||
es_fclose (fp);
|
||||
return rc;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
|
||||
{
|
||||
int i, rc;
|
||||
gpg_error_t err;
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
ksba_writer_t writer;
|
||||
ksba_cms_t cms = NULL;
|
||||
ksba_stop_reason_t stopreason;
|
||||
@ -763,7 +763,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
|
||||
}
|
||||
while (stopreason != KSBA_SR_READY);
|
||||
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
@ -781,7 +781,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
|
||||
if (release_signerlist)
|
||||
gpgsm_release_certlist (signerlist);
|
||||
ksba_cms_release (cms);
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
keydb_release (kh);
|
||||
gcry_md_close (data_md);
|
||||
return rc;
|
||||
|
10
sm/verify.c
10
sm/verify.c
@ -90,8 +90,8 @@ int
|
||||
gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
|
||||
{
|
||||
int i, rc;
|
||||
Base64Context b64reader = NULL;
|
||||
Base64Context b64writer = NULL;
|
||||
gnupg_ksba_io_t b64reader = NULL;
|
||||
gnupg_ksba_io_t b64writer = NULL;
|
||||
ksba_reader_t reader;
|
||||
ksba_writer_t writer = NULL;
|
||||
ksba_cms_t cms = NULL;
|
||||
@ -253,7 +253,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
|
||||
|
||||
if (b64writer)
|
||||
{
|
||||
rc = gpgsm_finish_writer (b64writer);
|
||||
rc = gnupg_ksba_finish_writer (b64writer);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write failed: %s\n", gpg_strerror (rc));
|
||||
@ -650,8 +650,8 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
|
||||
|
||||
leave:
|
||||
ksba_cms_release (cms);
|
||||
gpgsm_destroy_reader (b64reader);
|
||||
gpgsm_destroy_writer (b64writer);
|
||||
gnupg_ksba_destroy_reader (b64reader);
|
||||
gnupg_ksba_destroy_writer (b64writer);
|
||||
keydb_release (kh);
|
||||
gcry_md_close (data_md);
|
||||
es_fclose (in_fp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user