diff options
author | NIIBE Yutaka <[email protected]> | 2023-07-25 01:04:18 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-07-25 01:04:18 +0000 |
commit | 95d97615097255a1db1b71eec4df18c171e88df1 (patch) | |
tree | ead969dbc9a8433619a0ea8026e96b13f81d5a70 /sm/gpgsm.h | |
parent | dirmngr: Silence compiler when it's without LDAP. (diff) | |
download | gnupg-95d97615097255a1db1b71eec4df18c171e88df1.tar.gz gnupg-95d97615097255a1db1b71eec4df18c171e88df1.zip |
sm: Use estream for I/O.
* 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 (struct server_local_s): Rename MESSAGE_FD to
MESSAGE_FP.
(close_message_fp): Rename from close_message_fd.
(reset_notify): Follow the change of close_message_fp.
(cmd_encrypt, cmd_decrypt, cmd_verify, cmd_sign): Follow the change of
close_message_fp. Use open_stream_nc to get estream.
(cmd_import): Likewise.
(cmd_export, cmd_delkeys, gpgsm_server): Follow the change of
close_message_fp.
(cmd_message): Setup MESSAGE_FP with open_stream_nc.
* sm/sign.c (hash_data): Use estream for the input.
(hash_and_copy_data): Likewise.
(gpgsm_sign): Likewise.
* sm/verify.c (hash_data): Use estream_t for FP.
(gpgsm_verify): Use estream_t for IN_FP and DATA_FP.
--
GnuPG-bug-id: 6592
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'sm/gpgsm.h')
-rw-r--r-- | sm/gpgsm.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sm/gpgsm.h b/sm/gpgsm.h index e1aca8bb7..93a80631f 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -426,9 +426,9 @@ gpg_error_t gpgsm_show_certs (ctrl_t ctrl, int nfiles, char **files, estream_t fp); /*-- import.c --*/ -int gpgsm_import (ctrl_t ctrl, int in_fd, int reimport_mode); +int gpgsm_import (ctrl_t ctrl, estream_t in_fp, int reimport_mode); int gpgsm_import_files (ctrl_t ctrl, int nfiles, char **files, - int (*of)(const char *fname)); + estream_t (*of)(const char *fname, const char *mode)); /*-- export.c --*/ void gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream); @@ -439,23 +439,24 @@ void gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int gpgsm_delete (ctrl_t ctrl, strlist_t names); /*-- verify.c --*/ -int gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp); +int gpgsm_verify (ctrl_t ctrl, estream_t in_fp, estream_t data_fp, + estream_t out_fp); /*-- sign.c --*/ int gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert); int gpgsm_sign (ctrl_t ctrl, certlist_t signerlist, - int data_fd, int detached, estream_t out_fp); + estream_t data_fp, int detached, estream_t out_fp); /*-- encrypt.c --*/ int gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, - int in_fd, estream_t out_fp); + estream_t in_fp, estream_t out_fp); /*-- decrypt.c --*/ gpg_error_t ecdh_derive_kek (unsigned char *key, unsigned int keylen, int hash_algo, const char *wrap_algo_str, const void *secret, unsigned int secretlen, const void *ukm, unsigned int ukmlen); -int gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp); +int gpgsm_decrypt (ctrl_t ctrl, estream_t in_fp, estream_t out_fp); /*-- certreqgen.c --*/ int gpgsm_genkey (ctrl_t ctrl, estream_t in_stream, estream_t out_stream); |