aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: Use 64 bit instead of gpgme_off_t for some internal functions.Werner Koch2023-06-151-2/+2
| | | | | | | | | | | | * src/conversion.c (_gpgme_string_to_off): Return an u64 value. * src/data.c (_gpgme_data_get_size_hint): Ditto. (gpgme_data_set_flag): Use u64 for io-buffer-size due to string_to_off change. * src/data.h (struct gpgme_data): Change size_hint to u64. * src/engine-gpg.c (add_input_size_hint): Replace gpgme_off_t by u64. -- GnuPG-bug-id: 6534
* core: Fix results returned by gpgme_data_* functionsIngo Klöcker2021-08-031-3/+3
| | | | | | | | | | | | | src/debug.h (TRACE_SYSRES_OFF_T, _trace_sysres_off_t, TRACE_SYSRES_SSIZE_T, _trace_sysres_ssize_t): New. src/data.c (gpgme_data_read, gpgme_data_write, gpgme_data_seek): Use appropriate new tracing macros instead of casting the results to int. -- This change adds tracing macros for results of system functions of type __off_t and __ssize_t. GnuPG-bug-id: 5481
* core: New data flags "io-buffer-size" and "sensitive".Werner Koch2021-06-141-14/+102
| | | | | | | | | | | | | | | | | | | | | * src/data.c (_gpgme_data_release): Free buffers. (gpgme_data_seek): Adjust from renamed fields. (gpgme_data_set_flag): Implement new flags. (_gpgme_data_inbound_handler): Allow the use of a malloced buffer. (_gpgme_data_outbound_handler): Ditto. * src/data.h (BUFFER_SIZE): Move out of the struct definition. (struct gpgme_data): Remove pending filed and introduce inbound and outbound fields. * src/conversion.c (_gpgme_wipememory): New. Taken from GnuPG. * src/cJSON.c (wipememory): Use this here too. * tests/run-decrypt.c (main): Add options "--large-buffers" and "--sensitive". -- GnuPG-bug-id: 5478 Signed-off-by: Werner Koch <[email protected]>
* core: Also detect AuthEnvelopedData (AEAD for CMS)Werner Koch2021-06-141-1/+1
| | | | | | * src/data-identify.c (basic_detection): Add OID. Signed-off-by: Werner Koch <[email protected]>
* core: Improve the debug messages even more.Werner Koch2019-06-051-2/+2
| | | | | | | | | | | | | | | * src/debug.c (_gpgme_debug): Add arg LINE. Chnage all callers. (_gpgme_debug_begin): Remove. * src/debug.h (TRACE_SEQ): Use the LINE arg of _gpgme_debug. -- This includes chnages to always print fds in decimal as weel as tweaking the TARCE_SEQ function to make use of the new machinery. The standard 'tag' can now always be NULL and no tag information will be printed. Signed-off-by: Werner Koch <[email protected]>
* core: Fix format string errors in trace macrosWerner Koch2018-11-161-6/+6
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-161-17/+17
| | | | | | | | | | | | | | | | * 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-18/+18
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-081-1/+1
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core: Clear all flags for a new data property.Werner Koch2018-07-191-2/+4
| | | | | | | | | * src/data.c (PROPERTY_TABLE_ALLOCATION_CHUNK): New. (insert_into_property_table): Use it here. Clear all flags. -- Fixes-commit: 085cdeddef637cc057362fcbde13b0261b8699ec Signed-off-by: Werner Koch <[email protected]>
* core: Blank out the plaintext after decryption failure.Werner Koch2018-07-191-3/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/data.h (data_prop_t): New enum. (struct gpgme_data): Add field propidx. * src/data.c (property_t): New. (property_table, property_table_size, property_table_lock): New. (insert_into_property_table): New. (remove_from_property_table): New. (_gpgme_data_get_dserial): New. (_gpgme_data_set_prop): New. (_gpgme_data_get_prop): New. (_gpgme_data_new): Connect new object to property_table. (_gpgme_data_release): Remove from property_table. (gpgme_data_read): With DATA_PROP_BLANKOUT set don't fill the buffer. * src/data-mem.c (gpgme_data_release_and_get_mem): Likewise. * src/decrypt.c (struct op_data): Add field plaintext_dserial. (_gpgme_op_decrypt_init_result): Add arg plaintext and init new field. (_gpgme_decrypt_status_handler): Set DATA_PROP_BLANKOUT on decryption failure. (_gpgme_decrypt_start): Pass PLAIN to the init function. * src/decrypt-verify.c (decrypt_verify_start): Ditto. * configure.ac: Check for stdint.h and bail out if uint64_t is not available. -- This is a best effort feature to not output plaintext after a decryption failure (e.g. due to no or broken authenticated encryption). It always work when using a memory object and reading it after the decryption but it can't work reliable when the user is reading from the data object while the decryption process is still running. This is quite a large change because the data objects and the context objects are allowed to be owned by different threads. Thus a synchronization is needed and we do this with a global table of all data objects to which the context objects can do soft-linking via a unique data object serial number. Signed-off-by: Werner Koch <[email protected]>
* core: Also check for a failed selftest in gpgm_data_new.Werner Koch2017-12-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | * src/data.c (_gpgme_data_new): Check for failed selftest. * tests/run-support.h (make_filename): Print a message on mallooc failure. (init_gpgme_basic): New. * tests/run-identify.c (main): Call init_gpgme_basic becuase we do not need to setup a protocol. * tests/t-data.c: Define PGM and include run-support.h. (make_filename): Remove. (main): Call init_gpgme_basic. -- Note: This patch may break applications which used gpgme_data but no gpgme_new without having called the required gpgme_check_version. GPGME can be used without a protocol for example to work with the data object abstraction. Thus a call to gpgme_data_new also needs to check the result of the core selftests - including on whether gpgme_check_version has been called. Signed-off-by: Werner Koch <[email protected]>
* Revert "core: Fix error types."Werner Koch2017-03-021-1/+1
| | | | | | | | | | | | -- This reverts commit 6df6e01ed5a581765d245bf7303cda4497d0eb22. gpgme_error_t et al are from a time where we had no hard dependency on libgpg-error. Now libgpg-error is a required and thus it does not make sense to have these surrogates. In fact we should ventually completely remove them. Signed-off-by: Werner Koch <[email protected]>
* core: Fix error types.Justus Winter2017-02-151-1/+1
| | | | | | | | | | | | | * NEWS: Update. * src/data.c (gpgme_data_set_flag): Return a 'gpgme_error_t'. * src/error.c (gpgme_strerror_r): Fix type of first argument. * src/gpgme.h.in (gpgme_strerror_r): Adapt. (gpgme_data_set_flag): Likewise. -- Fix for consistency. This should not pose problems, because typedef gpg_error_t gpgme_error_t. Signed-off-by: Justus Winter <[email protected]>
* core: Un-deprecate gpgme_data_rewind.Werner Koch2017-02-021-0/+14
| | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_data_rewind): Un-deprecate. * src/data-compat.c (gpgme_data_rewind): Move to ... * src/data.c (gpgme_data_rewind): here. -- That function is very convenient because it is required a lot with memory streams. It also documents the intention of the caller better than gpgme_data_seek with its addition parameters and the need to map system errors. Thus it does not make sense to make it a first class citizen again. Signed-off-by: Werner Koch <[email protected]>
* core: Add gpgme_data_set_flag to add more meta data to data objects.Werner Koch2016-08-121-0/+30
| | | | | | | | | | | * src/gpgme.h.in (gpgme_data_set_flag): New public function. * src/data.c (gpgme_data_set_flag): New. (_gpgme_data_get_size_hint): New. * src/data.h (strucy gpgme_data): Add field 'size_hint'. * src/gpgme.def, src/libgpgme.vers: Add new function. * src/conversion.c (_gpgme_string_to_off): New. Signed-off-by: Werner Koch <[email protected]>
* core: New GPGME_DATA_ENCODING_MIME.Werner Koch2016-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DATA_ENCODING_MIME): New. * src/data.c (gpgme_data_set_encoding): Adjust check. * src/engine-gpg.c (have_gpg_version): New. (gpg_encrypt, gpg_encrypt_sign): Pass flag '--mimemode'. (gpg_sign): Ditto. * lang/cpp/src/data.h (GpgME): Add MimeEncoding. * lang/cpp/src/data.cpp (encoding, setEncoding): Support MimeEncoding. * src/gpgme-tool.c (server_data_encoding): Add flag --mime. -- This feature allows an application to declare that the encrypted or signed data is a valid MIME part. What is missing is a way to return that information to the application after decryption/verification. This can be done by setting the encoding of the output data object; however this requires some internal additions to our processing model. Signed-off-by: Werner Koch <[email protected]>
* Make definition of off_t robust against misbehaving w32 toolchains.Werner Koch2013-05-161-10/+10
| | | | | | | | | | | | | | | | * configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t and gpgme_ssize_t. (API__OFF_T, API__SSIZE_T): New ac_subst. * src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros. * src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h * src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c * src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c * src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t by gpgme_off_t and sszie_t by gpgme_ssize_t. * src/ath-pthread.c, src/ath.h: Include gpgme.h. -- For a detailed description, see the gpgme.texi diff.
* Remove all trailing whitespace from source filesWerner Koch2012-09-251-3/+3
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* First take on changes to allow building with MSC for W32CE.Werner Koch2010-11-021-1/+3
| | | | | Fixed regression in plain W32 build.
* 2010-05-06 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-061-12/+12
| | | | | | | | | | | | | | | | | | | * configure.ac: Require libgpg-error 1.8. src/ 2010-05-06 Marcus Brinkmann <[email protected]> * sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c, decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c, data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use gpg_error_from_syserror instead gpg_error_from_errno, and use gpg_err_set_errno to set error number. * setenv.c: Include <gpg-error.h> and define __set_errno to use gpg_err_set_errno. * gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is mapped in Windows CE) instead of E2BIG (which is not). (gt_import_keys): Initialize err.
* 2009-10-26 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-10-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0 was development versions only. tests/ 2009-10-26 Marcus Brinkmann <[email protected]> * opassuan/t-command.c: Update to new interface. src/ 2009-10-26 Marcus Brinkmann <[email protected]> * gpgme.h.in (struct gpgme_io_event_done_data) (gpgme_io_event_done_data_t): New types. (struct _gpgme_op_assuan_result): Deprecate the err member. (gpgme_op_assuan_result): Deprecate (for now). (gpgme_op_assuan_transact_ext): New prototype. (gpgme_op_assuan_transact): Deprecate. (struct _gpgme_op_g13_result): Replace with ... (struct _gpgme_op_vfs_mount_result): ... this. (gpgme_op_g13_mount): Replace with ... (gpgme_op_vfs_mount): ... this. * gpgme.def (gpgme_op_assuan_transact_ext, gpgme_wait_ext) (gpgme_op_vfs_mount_result, gpgme_op_vfs_mount): New. (gpgme_op_g13_mount): Remove. * libgpgme.vers: Likewise. * engine-backend.h (struct engine_ops): Remove RESULT_CB and RESULT_CB_VALUE args in opassuan_transact member. Add CANCEL_OP member. * ops.h (_gpgme_cancel_with_err, _gpgme_wait_on_condition): Add OP_ERR argument. (_gpgme_wait_one_ext): New prototype. * context.h (ctx_op_data_id_t): Add OPDATA_VFS_MOUNT. * engine-g13.c (g13_cancel_op): New function. (parse_status): Remove declaration. (g13_assuan_simple_command): Do nothing with status lines for now. (status_handler): Update opaque value access. (_gpgme_engine_ops_g13): Add new cancel_op member. * gpgme.c (_gpgme_cancel_with_err): Add new parameter OP_ERR. Handle operational errors. (gpgme_cancel, gpgme_io_read, gpgme_io_write): Add debug output. * data.c (_gpgme_data_inbound_handler) (_gpgme_data_outbound_handler): Adjust opaque value access. * engine-gpg.c (command_handler, status_handler) (colon_line_handler): Likewise. * engine-gpgsm.c (status_handler): Likewise. * engine-gpg.c (_gpgme_engine_ops_gpg): Add cancel_op member. * engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise. * g13.c: Rewritten (and will be rewritten again). * engine.h (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameters from prototype. (_gpgme_engine_cancel_op): New prototype. * engine.c (engine_ops) [! ENABLE_ASSUAN]: Add missing comma. (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameter. (_gpgme_engine_cancel_op): New function. * wait.h (_gpgme_run_io_cb): Add new argument OP_ERR. (struct io_cb_data): New struct to pass opaque data and get a op_err return value. Needed because we can't modify I/O callback handler signature because it is exposed to the user. * wait.c (_gpgme_run_io_cb): Add OP_ERR parameter. Handle operational errors. * wait-user.c (_gpgme_user_io_cb_handler): Handle operational errors. * wait-private.c (_gpgme_wait_on_condition): New argument to retrieve the operational result. Handle operational errors in session based protocols. (_gpgme_wait_one_ext): New function. (_gpgme_wait_one): Pass argument in invocation of _gpgme_wait_on_condition. * wait-global.c (struct ctx_list_item): Add member OP_ERR. (ctx_done): New argument OP_ERR. (ctx_wait): New argument OP_ERR. (gpgme_wait_ext): New function based on gpgme_wait but handling operational errors. (gpgme_wait): Implement in term of gpgme_wait_ext. * keylist.c (gpgme_op_keylist_next): Pass argument in invocation of _gpgme_wait_on_condition. * trustlist.c (gpgme_op_trustlist_next): Pass argument in invocation of _gpgme_wait_on_condition. * engine-assuan.c (struct engine_llass): Replace members RESULT_CB and RESULT_CB_VALUE by LAST_OP_ERR. (_gpgme_engine_assuan_last_op_err): Add this hack function. (llass_cancel_op): New function. (_gpgme_engine_llass_ops): Add cancel_op member. (llass_status_handler): Update opaque value access. (llass_transact): Remove RESULT_CB and RESULT_CB_VALUE arguments. * opassuan.c: Move compat hacks to the end of file. (opassuan_start): Do not set OPD->result.err. Do not pass RESULT_Cb and CTX to _gpgme_engine_op_assuan_transact. (gpgme_op_assuan_transact_ext): New function.
* Add support for gpg --fetch-keys.Werner Koch2009-06-161-1/+1
|
* 008-11-03 Marcus Brinkmann <[email protected]>Marcus Brinkmann2008-11-031-0/+332
* 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.