diff options
author | Werner Koch <wk@gnupg.org> | 2006-12-21 20:40:00 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2006-12-21 20:40:00 +0100 |
commit | 12ca74c836ccacf79f2f193afac334377e41995e (patch) | |
tree | 3a70382f306fe0602b8c9acbd9e995336dc1f097 /g10/plaintext.c | |
parent | The keypad is now also used for OpenPGP signing keys. (diff) | |
download | gnupg2-12ca74c836ccacf79f2f193afac334377e41995e.tar.xz gnupg2-12ca74c836ccacf79f2f193afac334377e41995e.zip |
Started to code a --server mode.
It is far from being ready!
Diffstat (limited to 'g10/plaintext.c')
-rw-r--r-- | g10/plaintext.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c index cab4d6d46..6c58ae7d7 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -567,6 +567,42 @@ hash_datafiles( gcry_md_hd_t md, gcry_md_hd_t md2, strlist_t files, } +/* Hash the data from file descriptor DATA_FD and append the hash to hash + contexts MD and MD2. */ +int +hash_datafile_by_fd ( gcry_md_hd_t md, gcry_md_hd_t md2, int data_fd, + int textmode ) +{ + progress_filter_context_t *pfx = new_progress_context (); + iobuf_t fp; + + fp = iobuf_fdopen (data_fd, "rb"); + if (fp && is_secured_file (data_fd)) + { + iobuf_close (fp); + fp = NULL; + errno = EPERM; + } + if ( !fp ) + { + int rc = gpg_error_from_syserror (); + log_error ( _("can't open signed data fd=%d: %s\n"), + data_fd, strerror (errno)); + release_progress_context (pfx); + return rc; + } + + handle_progress (pfx, fp, NULL); + + do_hash ( md, md2, fp, textmode); + + iobuf_close(fp); + + release_progress_context (pfx); + return 0; +} + + /* Set up a plaintext packet with the appropriate filename. If there is a --set-filename, use it (it's already UTF8). If there is a regular filename, UTF8-ize it if necessary. If there is no |