core: Implement context flag "override-session-key".
authorWerner Koch <wk@gnupg.org>
Tue, 15 Nov 2016 09:29:48 +0000 (10:29 +0100)
committerWerner Koch <wk@gnupg.org>
Tue, 15 Nov 2016 09:34:13 +0000 (10:34 +0100)
commit7659d42468b604db2936b021425683f407eba4a7
tree71ee551bdd948598d0e9015ae2ec10366c0be373
parent3234b1bf1d6939772677d64f6c1e1820ec98e3cd
core: Implement context flag "override-session-key".

* src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and
"override-session-key".
(gpgme_get_ctx_flag): Ditto.
(gpgme_set_export_session_keys): Remove.
(gpgme_get_export_session_keys): Remove.
* src/gpgme.def, src/libgpgme.vers: Remove them.
* src/context.h (struct gpgme_context): Add field
override_session_key.
* src/decrypt-verify.c (decrypt_verify_start): Pass
override_session_key value to the engine.
* src/decrypt.c (decrypt_start): Ditto.
* src/engine.c (_gpgme_engine_op_decrypt): Ditto.
(_gpgme_engine_op_decrypt_verify): Ditto.
* src/engine-backend.h (struct engine_ops): Extend DECRYPT and
DECRYPT_VERIFY_START with override_session_key.
* src/engine-uiserver.c (_uiserver_decrypt): Add stub arg
override_session_key.
(uiserver_decrypt): Ditto.
(uiserver_decrypt_verify): Ditto.
* src/engine-gpgsm.c (gpgsm_decrypt): Ditto.
* src/engine-gpg.c (gpg_decrypt): Add arg override_session_key and set
corresponding gpg option.

* tests/run-decrypt.c (print_result): Print the session key if
available.
(main): Add options --export-session-key and --override-session-key.

--

To keep the number of context manipulation functions at bay, this
patches removes the just added gpgme_set_export_session_keys and
gpgme_get_export_session_keys by flags for the generic context
function.

The patch also implements the --override-session-key feature.

GnuPG-bug-id: 2754
Signed-off-by: Werner Koch <wk@gnupg.org>
15 files changed:
doc/gpgme.texi
src/context.h
src/decrypt-verify.c
src/decrypt.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.c
src/gpgme.def
src/gpgme.h.in
src/libgpgme.vers
tests/run-decrypt.c