diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 98b40ded2..8aca3418d 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,10 +1,8 @@ 2002-08-03 Stefan Bellon * idea-stub.c (idea_get_info): RISC OS' Norcroft C needs a cast. - * random.c (getfnc_gather_random): Added RISC OS support. - - * rndriscos.c: Removed dynload code. + * rndriscos.c: Removed dynload code and tidied up a bit. 2002-08-03 Werner Koch diff --git a/cipher/rndriscos.c b/cipher/rndriscos.c index 3aa16d523..98142b313 100644 --- a/cipher/rndriscos.c +++ b/cipher/rndriscos.c @@ -22,51 +22,49 @@ #ifdef USE_RNDRISCOS -#include -#include -#include #include #include #include #include "util.h" -#include "algorithms.h" static int init_device(void); #define CryptRandom_Byte 0x51980 +static const char * const path[] = { + "GnuPG:CryptRandom", + "GnuPG:CryptRand", + "System:Modules.CryptRandom" + "System:Modules.CryptRand", + NULL +}; + /**************** * Used to load the CryptRandom module if it isn't already loaded */ static int init_device(void) { - _kernel_swi_regs r; + int i; /* Is CryptRandom already loaded? */ - r.r[0] = 18; - r.r[1] = (int) "CryptRandom"; - if (!_kernel_swi(OS_Module, &r, &r)) + if (!_swix(OS_Module, _INR(0,1), 18, "CryptRandom")) return 1; - /* Is it named CryptRand and inside GnuPG$Path? */ - r.r[0] = 1; - r.r[1] = (int) "GnuPG:CryptRand"; - if (!_kernel_swi(OS_Module, &r, &r)) - return 1; - - /* Is it named CryptRandom and inside GnuPG$Path? */ - r.r[0] = 1; - r.r[1] = (int) "GnuPG:CryptRandom"; - if (!_kernel_swi(OS_Module, &r, &r)) - return 1; + /* Check all the places where the module could be located */ + for (i=0; path[i]; ++i) + if (!_swix(OS_Module, _INR(0,1), 1, path[i])) + return 1; /* Can't find CryptRandom in the default locations */ g10_log_fatal("Can't load module CryptRandom.\n"); + + return 0; /* never reached, but don't throw a warning */ } /**************** + * Get the random bytes from module */ int rndriscos_gather_random(void (*add)(const void*, size_t, int), int requester, @@ -75,8 +73,6 @@ rndriscos_gather_random(void (*add)(const void*, size_t, int), int requester, static int initialized = 0; int n; byte buffer[768]; - _kernel_swi_regs r; - _kernel_oserror *e; if (!initialized) initialized = init_device(); @@ -84,11 +80,9 @@ rndriscos_gather_random(void (*add)(const void*, size_t, int), int requester, while (length) { int nbytes = length < sizeof(buffer) ? length : sizeof(buffer); - for (n = 0; n < nbytes; n++) { - if (e = _kernel_swi(CryptRandom_Byte, &r, &r)) + for (n = 0; n < nbytes; ++n) + if (_swix(CryptRandom_Byte, _OUT(0), &buffer[n])) g10_log_fatal("CryptRandom module isn't working as expected!\n"); - buffer[n] = (byte) r.r[0]; - } (*add)(buffer, n, requester); length -= n; diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 41145b026..13b2a7143 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,11 +1,10 @@ 2002-08-03 Stefan Bellon * conf-riscos/include/g10defs.h: Added GNUPG_LIBEXECDIR. - * conf-riscos/include/config.h: Changes due to dynload removal and minor changes to avoid some warnings. - * conf-riscos/Makefile: Changes due to dynload removal. + * conf-riscos/cipher/*: Not needed anymore due to dynload removal. 2002-07-25 David Shaw diff --git a/scripts/conf-riscos/cipher/construct.c b/scripts/conf-riscos/cipher/construct.c deleted file mode 100644 index 122d740e8..000000000 --- a/scripts/conf-riscos/cipher/construct.c +++ /dev/null @@ -1,38 +0,0 @@ -/* construct.c - RISC OS constructors for cipher algorithms - * Copyright (C) 2001 Free Software Foundation, Inc. - * - * This file is part of GnuPG. - * - * GnuPG is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * GnuPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -void rndriscos_constructor(void); -void sha1_constructor(void); -void rmd160_constructor(void); -void md5_constructor(void); - -void -cipher_modules_constructor(void) -{ - static int done = 0; - if( done ) - return; - done = 1; - - rndriscos_constructor(); - sha1_constructor(); - rmd160_constructor(); - md5_constructor(); -} diff --git a/scripts/conf-riscos/cipher/constructv.c b/scripts/conf-riscos/cipher/constructv.c deleted file mode 100644 index cb50bfff8..000000000 --- a/scripts/conf-riscos/cipher/constructv.c +++ /dev/null @@ -1,32 +0,0 @@ -/* constructv.c - RISC OS constructors for cipher algorithms (gpgv version) - * Copyright (C) 2001 Free Software Foundation, Inc. - * - * This file is part of GnuPG. - * - * GnuPG is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * GnuPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -void rmd160_constructor(void); - -void -cipher_modules_constructor(void) -{ - static int done = 0; - if( done ) - return; - done = 1; - - rmd160_constructor(); -} diff --git a/util/ChangeLog b/util/ChangeLog index 376ce34ca..9b7652ee1 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2002-08-03 Stefan Bellon + + * secmem.c (init_pool, secmem_term): Changed #if to #ifdef in + order to avoid warning with RISC OS' Norcroft C. + 2002-07-25 David Shaw * secmem.c: "Warning" -> "WARNING" diff --git a/util/secmem.c b/util/secmem.c index 3960fa1cd..90fffd505 100644 --- a/util/secmem.c +++ b/util/secmem.c @@ -210,7 +210,7 @@ init_pool( size_t n) pgsize = 4096; #endif - #if HAVE_MMAP + #ifdef HAVE_MMAP poolsize = (poolsize + pgsize -1 ) & ~(pgsize-1); #ifdef MAP_ANONYMOUS pool = mmap( 0, poolsize, PROT_READ|PROT_WRITE, @@ -443,7 +443,7 @@ secmem_term() memset( pool, 0xaa, poolsize); memset( pool, 0x55, poolsize); memset( pool, 0x00, poolsize); - #if HAVE_MMAP + #ifdef HAVE_MMAP if( pool_is_mmapped ) munmap( pool, poolsize ); #endif