From 64d586ef17d8ee84e100bc24be27c006014ce427 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sat, 25 Aug 2001 09:35:43 +0000 Subject: [PATCH] Random changes --- ChangeLog | 12 +++++++++++ INSTALL | 7 ------- TODO | 5 +++++ cipher/ChangeLog | 8 ++++++++ cipher/md.c | 5 +++-- cipher/random.c | 4 +++- configure.ac | 48 +++++++++++++++++++++++++++++++++++--------- include/ChangeLog | 4 ++++ include/cipher.h | 2 +- scripts/build-riscos | 2 +- 10 files changed, 76 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5216100d1..ce427a664 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2001-08-23 Werner Koch + + * configure.in (AC_FUNC_FSEEKO): Add. + (AC_CHECK_FUNCS): Remove fseeko. By Paul Eggert . + +2001-08-22 Werner Koch + + * configure.ac (gethrtime): Enhanced the test by running a test + program. + * INSTALL: Removed the note about Solaris problems because the + above test should catch this. + 2001-08-20 Werner Koch * acinclude.m4: Add check for plock if mlock is broken. diff --git a/INSTALL b/INSTALL index 8492447e5..02510633d 100644 --- a/INSTALL +++ b/INSTALL @@ -102,13 +102,6 @@ Specific problems on some machines not build. In this case try to run configure using: CFLAGS="-g -O2 -mcpu=powerpc" ./configure - * Solaris - - There are reports that the function gethrtime() as used in - cipher/random.c raised a SIGILL. It seems that is due to - a header/lib miscmatch. Solution is to fix the Solaris - installation or comment the call to gethrtime(). - The Random Device diff --git a/TODO b/TODO index 79cd1768c..920b43bf7 100644 --- a/TODO +++ b/TODO @@ -78,6 +78,11 @@ * Check that the way we select cipher and digest algorithms w/o preferences is okay and make AES the default. + * Concatenated encryption messages don't work corectly - only the + first one is processes. + + * Add status message for reasons why a key was not selected. + Scheduled for 1.1 ----------------- * export by user-IDs does only export the first matching name which leads diff --git a/cipher/ChangeLog b/cipher/ChangeLog index a0700c27e..dd20e1e2d 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,11 @@ +2001-08-24 Werner Koch + + * md.c (md_write): Made buf arg const. + +2001-08-22 Werner Koch + + * random.c (fast_random_poll): Don't use gethrtime if it is broken. + 2001-08-20 Werner Koch Applied patches from Stefan Bellon to support diff --git a/cipher/md.c b/cipher/md.c index 6d84772d2..8d20a9804 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -317,7 +317,7 @@ md_close(MD_HANDLE a) void -md_write( MD_HANDLE a, byte *inbuf, size_t inlen) +md_write( MD_HANDLE a, const byte *inbuf, size_t inlen) { struct md_digest_list_s *r; @@ -329,7 +329,8 @@ md_write( MD_HANDLE a, byte *inbuf, size_t inlen) } for(r=a->list; r; r = r->next ) { (*r->write)( &r->context.c, a->buffer, a->bufcount ); - (*r->write)( &r->context.c, inbuf, inlen ); + /* Fixme: all ->write fnc should take a const byte* */ + (*r->write)( &r->context.c, (byte*)inbuf, inlen ); } a->bufcount = 0; } diff --git a/cipher/random.c b/cipher/random.c index 76db0d017..cdbd0b700 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -568,8 +568,10 @@ fast_random_poll() } /* fall back to the generic function */ - #ifdef HAVE_GETHRTIME + #if defined(HAVE_GETHRTIME) && !defined(HAVE_BROKEN_GETHRTIME) { hrtime_t tv; + /* On some Solaris and HPUX system gethrtime raises an SIGILL, but we + * checked this with configure */ tv = gethrtime(); add_randomness( &tv, sizeof(tv), 1 ); } diff --git a/configure.ac b/configure.ac index 5d65e6774..c80734a1a 100644 --- a/configure.ac +++ b/configure.ac @@ -485,21 +485,50 @@ if test "$ac_cv_sizeof_unsigned_short" = "0" \ AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]); fi - - dnl Checks for library functions. +AC_FUNC_FSEEKO AC_FUNC_VPRINTF AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap) AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime) AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo) -AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask fseeko) - -AC_MSG_CHECKING(for gethrtime) -AC_TRY_LINK([#include ],[ - hrtime_t tv; - tv = gethrtime(); - ],[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETHRTIME)], AC_MSG_RESULT(no)) +AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask) +# +# check for gethrtime and run a testprogram to see whether +# it is brogen. It has been reported that some Solris and HP UX systems +# raise an SIGILL +# +AC_CACHE_CHECK([for gethrtime], + [gnupg_cv_func_gethrtime], + [AC_TRY_LINK([#include ],[ + hrtime_t tv; + tv = gethrtime(); + ], + [gnupg_cv_func_gethrtime=yes], + [gnupg_cv_func_gethrtime=no]) + ]) +if test $gnupg_cv_func_gethrtime = yes; then + AC_DEFINE([HAVE_GETHRTIME], 1, + [Define if you have the `gethrtime(2)' function.]) + AC_CACHE_CHECK([whether gethrtime is broken], + [gnupg_cv_func_broken_gethrtime], + [AC_TRY_RUN([ + #include + int main () { + hrtime_t tv; + tv = gethrtime(); + } + ], + [gnupg_cv_func_broken_gethrtime=no], + [gnupg_cv_func_broken_gethrtime=yes], + [gnupg_cv_func_broken_gethrtime=assume-no]) + ]) + if test $gnupg_cv_func_broken_gethrtime = yes; then + AC_DEFINE([HAVE_BROKEN_GETHRTIME], 1, + [Define if `gethrtime(2)' does not work correctly i.e. issues a SIGILL.]) + fi +fi + GNUPG_CHECK_MLOCK GNUPG_FUNC_MKDIR_TAKES_ONE_ARG @@ -880,4 +909,5 @@ fi if test -n "$show_extraasm"; then echo " Extra cpu specific functions:$show_extraasm" fi +echo diff --git a/include/ChangeLog b/include/ChangeLog index aecb92b4a..47323772f 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2001-08-24 Werner Koch + + * cipher.h (md_write): Made buf arg const. + 2001-08-20 Werner Koch * cipher.h (DEK): Added algo_info_printed; diff --git a/include/cipher.h b/include/cipher.h index ef00e5c3f..53279f958 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -116,7 +116,7 @@ void md_enable( MD_HANDLE hd, int algo ); MD_HANDLE md_copy( MD_HANDLE a ); void md_reset( MD_HANDLE a ); void md_close(MD_HANDLE a); -void md_write( MD_HANDLE a, byte *inbuf, size_t inlen); +void md_write( MD_HANDLE a, const byte *inbuf, size_t inlen); void md_final(MD_HANDLE a); byte *md_read( MD_HANDLE a, int algo ); int md_digest( MD_HANDLE a, int algo, byte *buffer, int buflen ); diff --git a/scripts/build-riscos b/scripts/build-riscos index 5d342c562..0a1168e42 100644 --- a/scripts/build-riscos +++ b/scripts/build-riscos @@ -7,4 +7,4 @@ copy .conf-riscos.cipher.c.constructv .^.cipher.c.constructv copy .conf-riscos.include.h.config .^.include.h.config ~cf~v copy .conf-riscos.include.h.g10defs .^.include.h.g10defs ~cf~v copy .conf-riscos.Makefile .^.Makefile ~cf~v -echo Done. \ No newline at end of file +echo Done.