aboutsummaryrefslogtreecommitdiffstats
path: root/gpgscm (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-07-17gpgscm: Incorporate changes from GnuPG.NIIBE Yutaka2-2/+11
* gpgscm/scheme.c [__GNUC__] (type_to_string): Use __builtin_unreachable for GCC. * gpgscm/ffi.c (do_get_temp_path): Remove the last backslash. * gpgscm/ffi.c (do_chdir): Use gpg_error_from_syserror. -- Signed-off-by: NIIBE Yutaka <[email protected]>
2019-01-23gpgscm: Build well even if NDEBUG defined.NIIBE Yutaka1-1/+3
* gpgscm/scheme.c (gc_reservation_failure): Fix adding ";". [!NDEBUG] (scheme_init_custom_alloc): Don't init seserved_lineno. -- In some build environment, NDEBUG is defined (although it's bad practice). This change supports such a situation. GnuPG-bug-id: 3959 Signed-off-by: NIIBE Yutaka <[email protected]>
2019-01-04core: New functions gpgrt_abort and gpgrt_add_emergency_cleanup.Werner Koch3-4/+1
* src/init.c (emergency_cleanup_list): New gloabl var. (_gpgrt_add_emergency_cleanup): New. (_gpgrt_abort): New. Repalce all calls to abort by this. Also replace all assert by either log_assert or a stderr output followed by a _gpgrt_abort. (run_emergency_cleanup): New. * src/visibility.c (gpgrt_add_emergency_cleanup): New public API. (gpgrt_abort): New public API. -- Libgcrypt uses its own assert function which makes sure to terminate the secure memory. This is safe as log as an assert is triggered internally in Libgcrypt. GnuPG runs emergency cleanup handlers right before log_fatal etc to tell Libgcrypt to terminate the secure memory. With the move of the logging function to gpgrt in gnupg 2.3 this did not anymore. Thus we now provide a mechanism in gpgrt to do right that. Eventually Libgcrypt can also make use of this. What this does not handle are calls to abort or failed asserts in external libraries or in libc. We can't do anything about it in a library because a library may not setup signal handlers. Signed-off-by: Werner Koch <[email protected]>
2018-09-06gpgscm: Suppress warnings for GCC > 6.NIIBE Yutaka1-15/+14
* tests/gpgscm/scheme.c (CASE): Use unused attribute for GCC > 6. (FALLTHROUGH): New for fallthrough. (Eval_Cycle): Use FALLTHROUGH. Remove not-needed comment of fallthrough. -- Since GCC combines C preprocessor macro expansion, the fallthrough comment doesn't work well to suppress warnings for -Wimplicit-fallthrough, near the macro CASE. To handle this problem, we use GCC's extension of unused label and fallthrough attributes. Signed-off-by: NIIBE Yutaka <[email protected]> Cherry-picked from gnupg master commit of: 99c17b970bc0ca7e0cff7fe031c6f9feb05af3ff
2017-11-29core: Wrap blocking system calls of the spawn functions.Werner Koch1-3/+4
Signed-off-by: Werner Koch <[email protected]>
2017-11-29core: Implement the spawn functions.Werner Koch1-7/+7
* src/gpg-error.h.in (GPGRT_SPAWN_NONBLOCK): New const. (GPGRT_SPAWN_RUN_ASFW): New const. (GPGRT_SPAWN_DETACHED): New const. (gpgrt_make_pipe): New function. (gpgrt_create_pipe): New macro. (gpgrt_create_inbound_pipe): New macro. (gpgrt_create_outbound_pipe): New macro. (gpgrt_spawn_process): New function. (gpgrt_spawn_process_fd): New function. (gpgrt_spawn_process_detached): New function. (gpgrt_wait_process): New function. (gpgrt_wait_processes): New function. (gpgrt_kill_process): New function. (gpgrt_release_process): New function. * src/gpg-error.def.in, src/gpg-error.vers: Add new functions. * src/visibility.c, src/visibility.h: Add wrappers for new functions. * src/spawn-posix.c: Rework to better fit the use in gpgrt. Rename all public function with a _gpgrt prefix. * src/spawn-w32.c: Ditto. * src/gpgrt-int.h: Likewise. * src/Makefile.am (arch_sources): Add spawn-posix.c and spawn-w32.c. * src/w32-add.h: Add pid_t typedef as a temporary hack. * configure.ac: Check for signal.h and getrlimit. (AC_FUNC_FORK): New. -- This does build but porting the tests and further changes are required. Don't assume that the API for the new fucntions is stable. Signed-off-by: Werner Koch <[email protected]>
2017-11-28core: Change new functions to return gpg_err_code_t.Werner Koch1-4/+7
* src/gpg-error.h.in (gpgrt_sentenv, gpgrt_mkdir, gpgrt_chdir): Change return type to gpg_err_code_t. * src/sysutils.c (_gpgrt_setenv): Implement that. (_gpgrt_mkdir): Ditto. (_gpgrt_chdir): Ditto. * gpgscm/ffi.c (do_setenv, do_mkdir): Adjust for this change. -- The functions are already a bit different and thus it is useful to let them return a gpg-error style error code and don't let the user implement that for each call. Signed-off-by: Werner Koch <[email protected]>
2017-11-28gpgscm: Some adjustments for use in gpgrt.Werner Koch6-90/+127
* gpgscm/Makefile.am: Remove cruft leftover from GnuPG. Link to the just build libgpg-error. * gpgscm/private.h: Include gpgrt.h and provide i18n macros. (xfree, xtrymalloc, xtrycalloc, xtryrealloc): New macros. (xmalloc, xstrdup): New inline functions. * gpgscm/main.c: Remove inclusion of gcrypt.h and gpg-error.h. Remove all other gnupg specific headers. (opts, parse_arguments): Temporary comment out. (main): Adjust for use with gpgrt. Temporary comment out some stuff. * gpgscm/ffi-private.h: Include local gpgrt.h instead of gpg-error.h. * gpgscm/ffi.h: Ditto. * gpgscm/ffi.c: Remove gpg-error.h and headers from GnuPG. (do_getenv): Use gpgrt_getenv. (do_setenv): Use gpgrt_setenv. (do_mkdtemp): Temporary return an error. (unlink_recursively): Use gpgrt_bsprintf. (do_getcwd): Use gpgrt_getcwd. (do_mkdir): Use gpgrt_mkdir. (do_get_isotime): Temporary return an error. (do_get_time): Directly use time(). -- Note that this does not yet compile because the spawn functions from GnuPG are missing. There are two other problems as well: - We don't have GnuPG's isotime fucntions. We need to see whether we want to support them in gpgrt. That might be useful in libksba. - gpgrt_mkdtemp does not work. We do not want to link to Libgcrypt, which is the way mkdtemp was written for GnuPG. We should get a more straight implementation. Signed-off-by: Werner Koch <[email protected]>
2017-10-05gpgscm: Change license from GPLv3+ to LGPLv2.1+Werner Koch19-226/+204
-- All changes to TinySCHEME were done by employees of g10 Code GmbH and some minor things by a contractor. Signed-off-by: Werner Koch <[email protected]>
2017-10-05gpgscm: Move files to a gpgscm subdirectory.Werner Koch25-0/+12880
-- Note that we used git filter-branch --subdirectory-filter tests/gpgscm in gnupg master to filter out the gpgscm part. This commit merely moves these files to a subdirectory which will be used in libgpg-error for gpgscm. Signed-off-by: Werner Koch <[email protected]>