Commit Graph

16 Commits

Author SHA1 Message Date
Werner Koch 164c687cb6
common: New functions timegm_u64, isotime2epoch_u64.
* common/mischelp.c (timegm): Move to ...
* common/gettime.c (timegm): here.  On Windows use timegm_u32.
(timegm_u32): New.
(isotime2epoch): Factor code out to ...
(isotime_make_tm): new helper.
(isotime2epoch_u64): New.
(_win32_timegm): Remove duplicated code.
(parse_timestamp): Use of timegm.
(scan_isodatestr): Fallback to isotime2epoch_u64.
--

This mainly helps on 32 bit Windows.  For Unix we assume everyone is
using 64 bit or shall wait until the libc hackers finally provide a
time64_t.

GnuPG-bug-id: 6736
2023-10-26 12:39:43 +02:00
Jussi Kivilinna 2a650772b4 common/mischelp: use platform memory zeroing function for wipememory
* common/mischelp.h (wipememory): Replace macro with function
prototype.
(wipememory2): Remove.
* common/mischelp.c (wipememory): New.
* configure.ac (AC_CHECK_FUNCS): Check for 'explicit_bzero'.
--

In new wipememory function, memory is cleared through platform
provided secure memory zeroing function, SecureZeroMemory
or explicit_bzero.

If none of these is available, memset is called through
volatile function pointer to so that compiler won't optimize
away the call.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
2018-12-01 13:43:09 +02:00
Werner Koch 55b6c2595a
Clarify text of LGPLv2+/GPLv2+ licensed files.
--
2017-02-24 13:48:28 +01:00
Werner Koch 4d7dc432b5
Change all http://www.gnu.org in license notices to https://
--
2016-11-05 12:02:19 +01:00
Werner Koch f0ae40b0c9
Remove replacements for libgpg-error < 1.21.
* common/util.h: Remove replacement macros for libgpg-error<1.21.
* common/types.h: Ditto.
* common/mischelp.h: Ditto.
* common/t-mapstrings.c: Include t-support.h before stringhelp.h
* common/t-stringhelp.c: Ditto.
* common/t-support.h: Always include gpg-error.h.
* kbx/keybox-search.c: Do not include stringhelp.h so that keybox-defs
comes first.
--

This patch enhances commit d6e0149 from  Dec 10.

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-12-12 14:06:30 +01:00
Werner Koch d382242fb6
Replace GNUPG_GCC_A_ macros by GPGRT_ATTR_ macros.
* common/util.h: Provide replacement for GPGRT_ATTR_ macros when using
libgpg-error < 1.20.
* common/mischelp.h: Ditto.
* common/types.h: Ditto.
--

Given that libgpg-error is a dependency of all GnuPG related libraries
it is better to define such macros at only one place instead of having
similar macros at a lot of places.  For now we need repalcement
macros, though.
2015-07-26 12:50:24 +02:00
Werner Koch 172b619348
common: Remove JNLIB from boiler plate (jnlib merge).
* common/README.jnlib: Remove.
--

This is the final part of merging jnlib into gnupg/common.
2015-04-24 16:42:28 +02:00
Werner Koch 26d7e0d7ac
common: Rename log and gcc attribute macros (jnlib merge).
* common/logging.h: Rename JNLIB_LOG_* to GPGRT_LOG_*.
* common/mischelp.h: Rename JNLIB_GCC_* to GPGRT_GCC_*.
--

JNLIB has no more meaning.  Thus we switch to a GPGRT_ prefix in
anticipation that some code may eventually be moved to libgpg-error.

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-04-24 16:10:47 +02:00
Werner Koch 575230d91b
common: Remove two JNLIB_ macros (jnlib merge).
* configure.ac: Merge seperate jnlib checks.
(HAVE_JNLIB_LOGGING): Remove.
* common/logging.c, common/simple-pwquery.c (JNLIB_NEED_AFLOCAL):
Rename to GNUPG_COMMON_NEED_AFLOCAL.  Change all tests.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-04-24 16:10:15 +02:00
Werner Koch 17bcd08708
common: Remove libjnlib-config.h (jnlib merge).
* common/libjnlib-config.h: Remove.
* common/common-defs.h (getenv) [HAVE_GETENV]: New.  From removed
header.
(getpid) [HAVE_W32CE_SYSTEM]: New.  From removed header.
* common/argparse.c: Include util.h and common-defs.h.  Replace
jnlib_ macro names for non-GNUPG builds by x* names.
* common/dotlock.c: Ditto.
* common/logging.c: Include util.h and common-defs.h.  Replace jnlib_
symbol names by x* names.
* common/strlist.c: Ditto.
* common/utf8conv.c: Ditto.
* common/w32-reg.c: Ditto.
* common/mischelp.c: Ditto.  Also remove _jnlib_free.
* common/stringhelp.c: Ditto.
(JNLIB_LOG_WITH_PREFIX): Do not depend on this macro.
* common/logging.h (JNLIB_LOG_WITH_PREFIX): Do not depend on this
macro.
--

This is part 1 of the patches to merge the jnlib files into common/.
It does not make much sense to keep jnlib/ files separate.  They are
not often use elsewhere and maintaining the complex marcos stuff is
too troublesome for the future.

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-04-24 15:19:10 +02:00
Werner Koch e30e5381bd common: Fix typo in header inclusion protection macro.
--
GnuPG-bug-id: 1669
2014-08-11 17:22:47 +02:00
Werner Koch db85feceaf dirmngr: Fix compiler warning.
* common/mischelp.h (JNLIB_GCC_HAVE_PUSH_PRAGMA): New.
* dirmngr/dirmngr.c (handle_tick): Factor time check out to ...
(time_for_housekeeping_p): new.
--

I am not sure whether that y2038 hack is really useful but it might
make me smile in my retirement.
2014-04-08 17:06:17 +02:00
Werner Koch 36372dcb2f Use attribute __gnu_printf__ with our estream-printf functions.
* common/mischelp.h (JNLIB_GCC_A_PRINTF): Use __gnu_printf__
(JNLIB_GCC_A_NR_PRINTF): Ditto.
--

Our printf supports most of the GNU features and thus we can silence
the warnings from mingw.
2014-03-07 16:40:10 +01:00
Werner Koch cb0dcc3408 w32: Include winsock2.h to silence warnings. 2014-03-07 14:18:43 +01:00
Werner Koch cdd152bf49 Change JNLIB license to LGPLv3+ or GPLv2+.
This is to allow the use of this code with code under GPLv2(only).
2011-09-30 12:53:34 +02:00
Werner Koch d8b1099d01 Merged jnlib into common. 2010-03-10 12:24:58 +00:00