core: Add extended versions of the encrypt functions.
authorWerner Koch <wk@gnupg.org>
Tue, 17 Apr 2018 06:33:44 +0000 (08:33 +0200)
committerWerner Koch <wk@gnupg.org>
Tue, 17 Apr 2018 06:45:00 +0000 (08:45 +0200)
commita1f76b3b54b75a150fe272b804d85ffd40a507a6
tree3f0dd57d543391fc300206bcfebb5e9eb9bb10fd
parentb99502274ae5efdf6df0d967900ec3d1e64373d7
core: Add extended versions of the encrypt functions.

* src/gpgme.h.in (gpgme_op_encrypt_ext_start) New.
(gpgme_op_encrypt_ext): New.
(gpgme_op_encrypt_sign_ext_start): New.
(gpgme_op_encrypt_sign_ext): New.
* src/libgpgme.vers, tests/run-encrypt.c: Add them.

* src/encrypt.c (encrypt_start): Add arg recpstring.
(gpgme_op_encrypt): Factor code out to ...
(gpgme_op_encrypt_ext): new function with new arg recpstring.
(gpgme_op_encrypt_start): Factor code out to ...
(gpgme_op_encrypt_ext_start): new function with new arg recpstring.
* src/encrypt-sign.c (encrypt_sign_start): Add arg recpstring.
(gpgme_op_encrypt_sign): Factor code out to ...
(gpgme_op_encrypt_sign_ext): new function with new arg recpstring.
(gpgme_op_encrypt_sign_start): Factor code out to ...
(gpgme_op_encrypt_sign_ext_start): new function with new arg
recpstring.

* src/engine-backend.h (struct engine_ops): Change fields encrypt and
encrypt_sign.
* src/engine.c (_gpgme_engine_op_encrypt): Add arg recpstring and pass
to engine.
(_gpgme_engine_op_encrypt_sign): Ditto.
* src/engine-gpg.c (append_args_from_recipients_string): New.
(gpg_encrypt): Add arg recpstring and call new function as needed.
(gpg_encrypt_sign): Ditto.
* src/engine-gpgsm.c (set_recipients_from_string): New.
(gpgsm_encrypt): Add arg recpstring and call new function as needed.
* src/engine-uiserver.c (set_recipients_from_string): New.
(uiserver_encrypt): Add arg recpstring and call new function as
needed.

* tests/run-encrypt.c (xstrdup): New.
(main): Add option --keystring.

* src/gpgme-json.c (get_keys): Simplify.
(op_encrypt): Modify to make use of the extended encrypt function.

--

This new feature can be used to avoid the need for a key lookup and
thus several extra calls to the backend.

Note that run-test uses a semicolon as delimiter because that make
testing the feature on the command line much easier.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 files changed:
NEWS
doc/gpgme.texi
src/encrypt-sign.c
src/encrypt.c
src/engine-backend.h
src/engine-gpg.c
src/engine-gpgsm.c
src/engine-uiserver.c
src/engine.c
src/engine.h
src/gpgme-json.c
src/gpgme.def
src/gpgme.h.in
src/libgpgme.vers
tests/run-encrypt.c