1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

RISC OS changes because of dynload removal

This commit is contained in:
Stefan Bellon 2002-08-03 21:53:33 +00:00
parent 582f0d5d98
commit 5631db0402
7 changed files with 28 additions and 102 deletions

View File

@ -1,10 +1,8 @@
2002-08-03 Stefan Bellon <sbellon@sbellon.de>
* 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 <wk@gnupg.org>

View File

@ -22,51 +22,49 @@
#ifdef USE_RNDRISCOS
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <kernel.h>
#include <swis.h>
#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;

View File

@ -1,11 +1,10 @@
2002-08-03 Stefan Bellon <sbellon@sbellon.de>
* 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 <dshaw@jabberwocky.com>

View File

@ -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();
}

View File

@ -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();
}

View File

@ -1,3 +1,8 @@
2002-08-03 Stefan Bellon <sbellon@sbellon.de>
* 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 <dshaw@jabberwocky.com>
* secmem.c: "Warning" -> "WARNING"

View File

@ -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