1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

common: Add stream interface to call-pgp.

* common/call-gpg.c (struct writer_thread_parms): Add field 'stream'.
(writer_thread_main): Support reading from a stream.
(start_writer): Add stream argument.
(struct reader_thread_parms): Add field 'stream'.
(reader_thread_main): Support writing to a stream.
(start_reader): Add stream argument.
(_gpg_encrypt): Add stream api.
(gpg_encrypt_blob): Adapt accordingly.
(gpg_encrypt_stream): New function.
(_gpg_decrypt): Add stream api.
(gpg_decrypt_blob): Adapt accordingly.
(gpg_decrypt_stream): New function.
* common/call-gpg.h (gpg_encrypt_stream): New prototype.
(gpg_decrypt_stream): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2015-11-24 18:31:14 +01:00
parent cb18d80230
commit 03bf88f32c
2 changed files with 128 additions and 19 deletions

View file

@ -20,6 +20,8 @@
#ifndef G13_CALL_GPG_H
#define G13_CALL_GPG_H
#include <gpg-error.h>
#include "strlist.h"
typedef struct server_control_s *ctrl_t;
@ -28,10 +30,18 @@ gpg_error_t gpg_encrypt_blob (ctrl_t ctrl, const char *gpg_program,
const void *plain, size_t plainlen,
strlist_t keys,
void **r_ciph, size_t *r_ciphlen);
gpg_error_t gpg_encrypt_stream (ctrl_t ctrl, const char *gpg_program,
estream_t plain_stream,
strlist_t keys,
estream_t cipher_stream);
gpg_error_t gpg_decrypt_blob (ctrl_t ctrl, const char *gpg_program,
const void *ciph, size_t ciphlen,
void **r_plain, size_t *r_plainlen);
gpg_error_t gpg_decrypt_stream (ctrl_t ctrl, const char *gpg_program,
estream_t cipher_stream,
estream_t plain_stream);
#endif /*G13_CALL_GPG_H*/