mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
sm: Use estream_t for operations.
* sm/decrypt.c (gpgsm_decrypt): Use estream for the input. * sm/encrypt.c (gpgsm_encrypt): Likewise. * sm/gpgsm.c (open_read): Remove. (main): Use open_es_fread for gpgsm_import_files. Fix call of gpgsm_encrypt, gpgsm_sign, gpgsm_verify and gpgsm_decrypt. (open_es_fread): Use gnupg_check_special_filename and open_stream_nc. * sm/gpgsm.h: Fix function declarations. * sm/import.c (import_one): Use estream for the input. (reimport_one, gpgsm_import, gpgsm_import_files): Likewise. * sm/server.c (cmd_encrypt): Use open_stream_nc to get estream and call gpgsm_encrypt with it. (cmd_decrypt): Likewise for the call of gpgsm_decrypt. (cmd_verify): Likewise for the call of gpgsm_verify. (cmd_sign): Likewise for the call of gpgsm_sign. (cmd_import): Likewise for the call of gpgsm_import. * sm/sign.c (hash_data): Use estream for the input. (hash_and_copy_data): Likewise. (gpgsm_sign): Likewise. * sm/verify.c (gpgsm_verify): Use estream for the input. -- GnuPG-bug-id: 6592 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
a43d0f7d46
commit
3e1357789f
8 changed files with 141 additions and 154 deletions
13
sm/verify.c
13
sm/verify.c
|
@ -80,7 +80,8 @@ hash_data (estream_t fp, gcry_md_hd_t md)
|
|||
must be different than NULL. With OUT_FP given and a non-detached
|
||||
signature, the signed material is written to that stream. */
|
||||
int
|
||||
gpgsm_verify (ctrl_t ctrl, int in_fd, estream_t data_fp, estream_t out_fp)
|
||||
gpgsm_verify (ctrl_t ctrl, estream_t in_fp, estream_t data_fp,
|
||||
estream_t out_fp)
|
||||
{
|
||||
int i, rc;
|
||||
gnupg_ksba_io_t b64reader = NULL;
|
||||
|
@ -96,7 +97,6 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, estream_t data_fp, estream_t out_fp)
|
|||
const char *algoid;
|
||||
int algo;
|
||||
int is_detached, maybe_detached;
|
||||
estream_t in_fp = NULL;
|
||||
char *p;
|
||||
|
||||
audit_set_type (ctrl->audit, AUDIT_TYPE_VERIFY);
|
||||
|
@ -115,14 +115,6 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, estream_t data_fp, estream_t out_fp)
|
|||
}
|
||||
|
||||
|
||||
in_fp = es_fdopen_nc (in_fd, "rb");
|
||||
if (!in_fp)
|
||||
{
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("fdopen() failed: %s\n", strerror (errno));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
rc = gnupg_ksba_create_reader
|
||||
(&b64reader, ((ctrl->is_pem? GNUPG_KSBA_IO_PEM : 0)
|
||||
| (ctrl->is_base64? GNUPG_KSBA_IO_BASE64 : 0)
|
||||
|
@ -738,7 +730,6 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, estream_t data_fp, estream_t out_fp)
|
|||
gnupg_ksba_destroy_writer (b64writer);
|
||||
keydb_release (kh);
|
||||
gcry_md_close (data_md);
|
||||
es_fclose (in_fp);
|
||||
|
||||
if (rc)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue