aboutsummaryrefslogtreecommitdiffstats
path: root/src/encrypt-sign.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: Report failed encryption/signing if gpgtar didn't emit SUCCESSIngo Klöcker2024-09-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/encrypt-sign.c (encrypt_sym_status_handler): Add call of _gpgme_encrypt_status_handler. (encrypt_sign_start): Call _gpgme_op_encrypt_init_result with success_required=1 if archive is created. Always call _gpgme_op_sign_init_result with success_required=0 because the encrypt status handler already checks for SUCCESS. src/encrypt.c (op_data_t): Add success_seen flag. (_gpgme_encrypt_status_handler): Return error if we didn't see a required SUCCESS on GPGME_STATUS_EOF. Set success_seen flag on GPGME_STATUS_SUCCESS. (encrypt_sym_status_handler): Add call of _gpgme_encrypt_status_handler. (_gpgme_op_encrypt_init_result): Add argument success_required. Set success_seen flag if SUCCESS is not required. (encrypt_start): Call _gpgme_op_encrypt_init_result with success_required=1 if archive is created. src/ops.h (_gpgme_op_sign_init_result, _gpgme_op_encrypt_init_result): Add argument success_required to prototypes. src/sign.c (op_data_t): Add success_seen flag. (_gpgme_sign_status_handler): Return error if we didn't see a required SUCCESS on GPGME_STATUS_EOF. Set success_seen flag on GPGME_STATUS_SUCCESS. (sign_init_result): Add argument success_required. Set success_seen flag if SUCCESS is not required. (_gpgme_op_sign_init_result): Add argument success_required and forward it to sign_init_result. (sign_start): Call sign_init_result with success_required=1 if archive is created. -- gpgtar emits a SUCCESS status just before successful termination. If the process terminates unexpectedly (e.g. because it's killed) then gpgme now reports GPG_ERR_EOF. The SUCCESS status is only required if a signed and/or encrypted archive is created which is only supported for OpenPGP. The other engines reject the GPGME_ENCRYPT_ARCHIVE flag so that we don't need to check the protocol in the generic code. This change also adds handling of invalid recipients in case symmetric encryption is used which makes sense because one can combine symmetric and public key encryption. GnuPG-bug-id: 6554
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-161-6/+6
| | | | | | | | | | | | | | | | * src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros and remove the TRACE_BEG1 et al. Change all users to always pass a format string. (TRACE): Ditto. * src/debug.c (_gpgme_debugf): New. * configure.ac <GCC>: Add -Wno-format-zero-length. -- This makes it easier for use to enable format checks. The zero-length format is required to allow for an empty format due to the comman problematic of __VA_ARGS__. Signed-off-by: Werner Koch <[email protected]>
* Add SPDX identifiers to most source filesWerner Koch2018-11-161-19/+19
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Remove cruft from the engine-gpg code.Werner Koch2018-05-311-1/+1
| | | | | | | | | | | | | | | | * src/engine-gpg.c (read_status): Remove the handling of GPGME_STATUS_END_STREAM; this was used only by the former experimental --pipemode of gpg but that is not even anymore invoked here. (struct engine_gpg): Remove cmd.linked_data and .linked_idx. (build_argv): Remove code for linked_data. (gpg_new): Ditto. (gpg_set_command_handler): Remove arr linked_data. * src/engine-backend.h (engine_ops): Remove arg data from set_command_handler. * src/engine.c (_gpgme_engine_set_command_handler): Remove arg linked_data and adjust all callers. Signed-off-by: Werner Koch <[email protected]>
* core: Add extended versions of the encrypt functions.Werner Koch2018-04-171-36/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* core: Fix passphrase cb for mixed sym encryptAndre Heinecke2016-09-061-1/+1
| | | | | | | | | | * src/encrypt.c (encrypt_start): Handle SYMMETRIC flag. * src/encrypt-sign.c (encrypt_sign_start): Ditto. -- This causes the passphrace command handler to be properly registered which in turn will result in the passphrase callback beeing called.
* Allow symmetric encryption with gpgme_op_encrypt_sign.Werner Koch2013-05-221-2/+24
| | | | | | | | | | | * src/encrypt-sign.c (encrypt_sym_status_handler): New. (encrypt_sign_start): Handle recp == NULL case. * src/engine-gpg.c (gpg_encrypt_sign): Implement symmetric encryption. * tests/gpg/t-encrypt-sign.c (main): Add a test case for this. -- Co-authored-by: Kyle L. Huff <[email protected]> GnuPG-bug-id: 1440
* Remove all trailing whitespace from source filesWerner Koch2012-09-251-9/+9
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* Check context pointers for null pointer on entry points.Marcus Brinkmann2011-05-261-0/+6
|
* First take on changes to allow building with MSC for W32CE.Werner Koch2010-11-021-0/+3
| | | | | Fixed regression in plain W32 build.
* 2009-11-05 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-11-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | * decrypt.c (gpgme_op_decrypt_start): Fix use of debug macro. * decrypt-verify.c (gpgme_op_decrypt_verify_start): Likewise. * delete.c (gpgme_op_delete_start): Likewise. * edit.c (gpgme_op_edit_start, gpgme_op_card_edit_start): Likewise. * encrypt.c (gpgme_op_encrypt_start): Likewise. * encrypt-sign.c (gpgme_op_encrypt_sign_start): Likewise. * export.c (gpgme_op_export_start, gpgme_op_export_ext_start) (gpgme_op_export_keys_start, gpgme_op_export_keys): Likewise. * genkey.c (gpgme_op_genkey_start): Likewise. * getauditlog.c (gpgme_op_getauditlog_start): Likewise. * import.c (gpgme_op_import_start, gpgme_op_import_keys_start): Likewise. * opassuan.c (gpgme_op_assuan_transact_start): Likewise. * sign.c (gpgme_op_sign_start): Likewise. * verify.c (gpgme_op_verify_start): Likewise. * vfs-create.c (gpgme_op_vfs_create): Likewise. * vfs-mount.c (gpgme_op_vfs_mount): Likewise.
* 2009-10-28 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-10-281-4/+4
| | | | | | * signers.c, encrypt-sign.c, encrypt.c, delete.c, keylist.c, edit.c, import.c, export.c: Fix last change in debug output.
* 2009-10-27 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-10-271-3/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * edit.c (gpgme_op_edit_start, gpgme_op_edit) (gpgme_op_card_edit_start, gpgme_op_card_edit): Add debug output. * encrypt-sign.c (gpgme_op_encrypt_sign_start) (gpgme_op_encrypt_sign): Likewise. * encrypt.c (gpgme_op_encrypt_start, gpgme_op_encrypt) (gpgme_op_encrypt_result): Likewise. * export.c (gpgme_op_export_start, gpgme_op_export) (gpgme_op_export_ext_start, gpgme_op_export_ext) (gpgme_op_export_keys_start, gpgme_op_export_keys): Likewise. * genkey.c (gpgme_op_genkey_start, gpgme_op_genkey) (gpgme_op_genkey_result): Likewise. * getauditlog.c (gpgme_op_getauditlog_start) (gpgme_op_getauditlog): Likewise. * import.c (gpgme_op_import_result, gpgme_op_import_start) (gpgme_op_import): Likewise. * keylist.c (gpgme_op_keylist_result, keylist_colon_handler) (gpgme_op_keylist_start, gpgme_op_keylist_ext_start) (gpgme_op_keylist_next, gpgme_op_keylist_end, gpgme_get_key): Likewise. * opassuan.c (gpgme_op_assuan_transact_start) (gpgme_op_assuan_transact_ext, gpgme_op_assuan_result) (gpgme_op_assuan_transact): Likewise. * signers.c (gpgme_signers_add, gpgme_signers_clear): Likewise. * trustlist.c (gpgme_op_trustlist_start) (gpgme_op_trustlist_next, gpgme_op_trustlist_end): Likewise. * verify.c (gpgme_op_verify_start, gpgme_op_verify) (gpgme_op_verify_result): Likewise.
* 008-11-03 Marcus Brinkmann <[email protected]>Marcus Brinkmann2008-11-031-0/+110
* configure.ac: Replace gpgme paths with src. * gpgme: Move to ... * src: ... this new directory. assuan/ 2008-11-03 Marcus Brinkmann <[email protected]> * Makefile.am (INCLUDES): Replace gpgme path with src. tests/ 2008-11-03 Marcus Brinkmann <[email protected]> * gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src. * gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise. * Makefile.am (LDADD): Likewise.