From a177090f378cef71f363ef0e56c3913763cc6d5f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 14 Mar 2005 20:41:20 +0000 Subject: [PATCH] * card-util.c (card_status): Use isotimestamp and not the localized asctimestamp to match the timezone used in the key information. * miscutil.c (isotimestamp): New. --- g10/ChangeLog | 4 ++++ g10/card-util.c | 6 +++--- include/util.h | 1 + scripts/conf-w32/README | 2 ++ scripts/conf-w32/bzip2-1.diff | 39 +++++++++++++++++++++++++++++++++++ util/ChangeLog | 4 ++++ util/miscutil.c | 25 +++++++++++++++++++++- 7 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 scripts/conf-w32/README create mode 100644 scripts/conf-w32/bzip2-1.diff diff --git a/g10/ChangeLog b/g10/ChangeLog index 1f02e477f..c493d2161 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,9 @@ 2005-03-14 Werner Koch + * card-util.c (card_status): Use isotimestamp and not the + localized asctimestamp to match the timezone used in the key + information. + * cardglue.c (pin_cb): Disable debug output. 2005-03-11 Werner Koch diff --git a/g10/card-util.c b/g10/card-util.c index c63335b48..4f25c5ef5 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -426,17 +426,17 @@ card_status (FILE *fp, char *serialno, size_t serialnobuflen) print_sha1_fpr (fp, info.fpr1valid? info.fpr1:NULL); if (info.fpr1valid && info.fpr1time) tty_fprintf (fp, " created ....: %s\n", - asctimestamp (info.fpr1time)); + isotimestamp (info.fpr1time)); tty_fprintf (fp, "Encryption key....:"); print_sha1_fpr (fp, info.fpr2valid? info.fpr2:NULL); if (info.fpr2valid && info.fpr2time) tty_fprintf (fp, " created ....: %s\n", - asctimestamp (info.fpr2time)); + isotimestamp (info.fpr2time)); tty_fprintf (fp, "Authentication key:"); print_sha1_fpr (fp, info.fpr3valid? info.fpr3:NULL); if (info.fpr3valid && info.fpr3time) tty_fprintf (fp, " created ....: %s\n", - asctimestamp (info.fpr3time)); + isotimestamp (info.fpr3time)); tty_fprintf (fp, "General key info..: "); thefpr = (info.fpr1valid? info.fpr1 : info.fpr2valid? info.fpr2 : diff --git a/include/util.h b/include/util.h index ba493b1be..c6e89e713 100644 --- a/include/util.h +++ b/include/util.h @@ -152,6 +152,7 @@ u32 scan_isodatestr( const char *string ); u32 add_days_to_timestamp( u32 stamp, u16 days ); const char *strtimevalue( u32 stamp ); const char *strtimestamp( u32 stamp ); /* GMT */ +const char *isotimestamp( u32 stamp ); /* GMT with hh:mm:ss */ const char *asctimestamp( u32 stamp ); /* localized */ void print_string( FILE *fp, const byte *p, size_t n, int delim ); void print_string2( FILE *fp, const byte *p, size_t n, int delim, int delim2 ); diff --git a/scripts/conf-w32/README b/scripts/conf-w32/README new file mode 100644 index 000000000..12b89c06d --- /dev/null +++ b/scripts/conf-w32/README @@ -0,0 +1,2 @@ +Files useful for building W32 versions. + diff --git a/scripts/conf-w32/bzip2-1.diff b/scripts/conf-w32/bzip2-1.diff new file mode 100644 index 000000000..568d8f508 --- /dev/null +++ b/scripts/conf-w32/bzip2-1.diff @@ -0,0 +1,39 @@ +To include support for BZIP2 compression in GunPG for W32, the patch +below should be applied to a stock bzip2-1.0.2 source. The Build as +usual using the mingw32 cross compiler package from Debian and install +the library and header file on top of the cross compiler installation +(/usr/i586-mingw32msvc/lib/). Note that for ease of maintenance we +don't used a DLL. [wk 2005-03-14] + + +diff -u orig/bzip2-1.0.2/Makefile bzip2-1.0.2/Makefile +--- orig/bzip2-1.0.2/Makefile 2002-01-26 00:34:53.000000000 +0100 ++++ bzip2-1.0.2/Makefile 2004-11-03 14:10:45.000000000 +0100 +@@ -2,9 +2,9 @@ + SHELL=/bin/sh + + # To assist in cross-compiling +-CC=gcc +-AR=ar +-RANLIB=ranlib ++CC=i586-mingw32msvc-gcc ++AR=i586-mingw32msvc-ar ++RANLIB=i586-mingw32msvc-ranlib + LDFLAGS= + + # Suitably paranoid flags to avoid bugs in gcc-2.7 +diff -u orig/bzip2-1.0.2/bzlib.h bzip2-1.0.2/bzlib.h +--- orig/bzip2-1.0.2/bzlib.h 2001-12-30 03:19:45.000000000 +0100 ++++ bzip2-1.0.2/bzlib.h 2004-11-03 14:32:41.000000000 +0100 +@@ -113,7 +114,7 @@ + /* Need a definitition for FILE */ + #include + +-#ifdef _WIN32 ++#if defined( _WIN32 ) && 0 + # include + # ifdef small + /* windows.h define small to char */ + + + diff --git a/util/ChangeLog b/util/ChangeLog index 04fe9b26b..4248b2508 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +2005-03-14 Werner Koch + + * miscutil.c (isotimestamp): New. + 2005-03-10 Werner Koch * secmem.c (secmem_realloc): Take control information into account diff --git a/util/miscutil.c b/util/miscutil.c index 4c2c0edfc..aa3973b92 100644 --- a/util/miscutil.c +++ b/util/miscutil.c @@ -1,6 +1,6 @@ /* miscutil.c - miscellaneous utilities * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2004 Free Software Foundation, Inc. + * 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -137,6 +137,29 @@ strtimestamp( u32 stamp ) return buffer; } + +/**************** + * Note: this function returns GMT + */ +const char * +isotimestamp (u32 stamp) +{ + static char buffer[25+5]; + struct tm *tp; + time_t atime = stamp; + + if (atime < 0) { + strcpy (buffer, "????" "-??" "-??" " " "??" ":" "??" ":" "??"); + } + else { + tp = gmtime( &atime ); + sprintf(buffer,"%04d-%02d-%02d %02d:%02d:%02d", + 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec); + } + return buffer; +} + /**************** * Note: this function returns local time */