diff --git a/cipher/ChangeLog b/cipher/ChangeLog index b47340064..cdfe05e8e 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,8 @@ +2002-10-31 Stefan Bellon + + * rndriscos.c (rndriscos_gather_random): Use riscos_load_module() + to load CryptRandom module. + 2002-10-12 Werner Koch * rndunix.c (my_popen): Make sure that stdin and stderr are diff --git a/cipher/rndriscos.c b/cipher/rndriscos.c index 98142b313..ee35beadd 100644 --- a/cipher/rndriscos.c +++ b/cipher/rndriscos.c @@ -27,42 +27,18 @@ #include #include "util.h" -static int init_device(void); - #define CryptRandom_Byte 0x51980 -static const char * const path[] = { +static const char * const cryptrandom_path[] = { "GnuPG:CryptRandom", "GnuPG:CryptRand", - "System:Modules.CryptRandom" + "System:310.Modules.CryptRandom", + "System:310.Modules.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) -{ - int i; - - /* Is CryptRandom already loaded? */ - if (!_swix(OS_Module, _INR(0,1), 18, "CryptRandom")) - 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 */ @@ -70,12 +46,13 @@ int rndriscos_gather_random(void (*add)(const void*, size_t, int), int requester, size_t length, int level) { - static int initialized = 0; + static int rndriscos_initialized = 0; int n; byte buffer[768]; - if (!initialized) - initialized = init_device(); + if (!rndriscos_initialized) + rndriscos_initialized = riscos_load_module("CryptRandom", + cryptrandom_path, 1); while (length) { int nbytes = length < sizeof(buffer) ? length : sizeof(buffer); @@ -87,7 +64,7 @@ rndriscos_gather_random(void (*add)(const void*, size_t, int), int requester, (*add)(buffer, n, requester); length -= n; } - memset(buffer, 0, sizeof(buffer)); + wipememory(buffer, sizeof(buffer)); /* burn the buffer */ return 0; /* success */ } diff --git a/g10/ChangeLog b/g10/ChangeLog index c1d565d02..978935d45 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,16 @@ +2002-10-31 Stefan Bellon + + * compress.c (init_compress) [__riscos__]: Use + riscos_load_module() to load ZLib module. + + * g10.c (main) [__riscos__]: Renames due to changes in riscos.c + (e.g. prefixes all RISC OS specific functions with riscos_*). + * photoid.c (show_photos) [__riscos__]: Likewise. + * signal.c (got_fatal_signal) [__riscos__]: Likewise. + + * trustdb.c (check_regexp) [__riscos__]: Branch to RISC OS RegEx + handling. + 2002-10-31 David Shaw * build-packet.c (do_plaintext), encode.c (encode_sesskey, diff --git a/g10/compress.c b/g10/compress.c index 6ea84f6cd..b11f148c3 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -26,6 +26,9 @@ #include #include #include +#ifdef __riscos__ +# include "zlib-riscos.h" +#endif #include "util.h" #include "memory.h" @@ -34,13 +37,19 @@ #include "main.h" #include "options.h" - static void init_compress( compress_filter_context_t *zfx, z_stream *zs ) { int rc; int level; +#ifdef __riscos__ + static int zlib_initialized = 0; + + if (!zlib_initialized) + zlib_initialized = riscos_load_module("ZLib", zlib_path, 1); +#endif + if( opt.compress >= 0 && opt.compress <= 9 ) level = opt.compress; else if( opt.compress == -1 ) diff --git a/g10/g10.c b/g10/g10.c index 8331f7f1e..5aa0dbfbc 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -1349,7 +1349,7 @@ main( int argc, char **argv ) opt.use_agent = 1; #else /* __riscos__ */ opt.use_agent = 0; - not_implemented("use-agent"); + riscos_not_implemented("use-agent"); #endif /* __riscos__ */ break; case oNoUseAgent: opt.use_agent = 0; break; @@ -1365,7 +1365,7 @@ main( int argc, char **argv ) break; #ifdef __riscos__ case oStatusFile: - set_status_fd( iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) ); + set_status_fd( iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 1), 1) ); break; #endif /* __riscos__ */ case oAttributeFD: @@ -1373,7 +1373,7 @@ main( int argc, char **argv ) break; #ifdef __riscos__ case oAttributeFile: - set_attrib_fd(iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) ); + set_attrib_fd(iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 1), 1) ); break; #endif /* __riscos__ */ case oLoggerFD: @@ -1383,7 +1383,7 @@ main( int argc, char **argv ) #ifdef __riscos__ case oLoggerFile: log_set_logfile( NULL, - iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) ); + iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 1), 1) ); break; #endif /* __riscos__ */ case oWithFingerprint: @@ -1449,7 +1449,7 @@ main( int argc, char **argv ) pargs.r.ret_str); #endif #else /* __riscos__ */ - not_implemented("load-extension"); + riscos_not_implemented("load-extension"); #endif /* __riscos__ */ break; case oRFC1991: @@ -1497,7 +1497,7 @@ main( int argc, char **argv ) log_error("shared memory coprocessing is not available\n"); # endif #else /* __riscos__ */ - not_implemented("run-as-shm-coprocess"); + riscos_not_implemented("run-as-shm-coprocess"); #endif /* __riscos__ */ break; case oSetFilename: opt.set_filename = pargs.r.ret_str; break; @@ -1556,7 +1556,7 @@ main( int argc, char **argv ) break; #ifdef __riscos__ case oPasswdFile: - pwfd = iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 0), 0); + pwfd = iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 0), 0); break; #endif /* __riscos__ */ case oCommandFD: @@ -1564,7 +1564,7 @@ main( int argc, char **argv ) break; #ifdef __riscos__ case oCommandFile: - opt.command_fd = iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 0), 0); + opt.command_fd = iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 0), 0); break; #endif /* __riscos__ */ case oCipherAlgo: def_cipher_string = m_strdup(pargs.r.ret_str); break; @@ -1587,7 +1587,7 @@ main( int argc, char **argv ) #ifndef __riscos__ opt.lock_once = 0; #else /* __riscos__ */ - not_implemented("lock-multiple"); + riscos_not_implemented("lock-multiple"); #endif /* __riscos__ */ break; case oKeyServer: diff --git a/g10/photoid.c b/g10/photoid.c index c20e20eca..cb95754fa 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -306,8 +306,8 @@ void show_photos(const struct user_attribute *attrs, } #ifdef __riscos__ - riscos_set_filetype(spawn->tempfile_in, - image_type_to_string(args.imagetype,2)); + riscos_set_filetype_by_mimetype(spawn->tempfile_in, + image_type_to_string(args.imagetype,2)); #endif m_free(name); diff --git a/g10/signal.c b/g10/signal.c index 0517ba648..140259a19 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -100,7 +100,7 @@ got_fatal_signal( int sig ) init_one_signal (sig, SIG_DFL, 0); remove_lockfiles (); #ifdef __riscos__ - close_fds (); + riscos_close_fds (); #endif /* __riscos__ */ raise( sig ); } diff --git a/g10/trustdb.c b/g10/trustdb.c index 651baa3ed..f2014012c 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -1331,6 +1331,8 @@ check_regexp(const char *exp,const char *string) /* When DISABLE_REGEXP is defined, assume all regexps do not match. */ return 0; +#elif defined(__riscos__) + return riscos_check_regexp(exp, string, DBG_TRUST); #else int ret; regex_t pat; diff --git a/include/ChangeLog b/include/ChangeLog index 7ff6a80f7..aee6dfe25 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,11 @@ +2002-10-31 Stefan Bellon + + * util.h [__riscos__]: Prefixed all RISC OS prototypes with + riscos_* + + * zlib-riscos.h: New. This is macro magic in order to make the + zlib library calls indeed call the RISC OS ZLib module. + 2002-10-31 David Shaw * util.h: Add wipememory() macro. diff --git a/include/util.h b/include/util.h index 9b9e0141c..b163b0533 100644 --- a/include/util.h +++ b/include/util.h @@ -273,23 +273,25 @@ int vasprintf ( char **result, const char *format, va_list args); #include void riscos_global_defaults(void); #define RISCOS_GLOBAL_STATICS(a) const char *__dynamic_da_name = (a); +int riscos_load_module(const char *name, const char * const path[], int fatal); int riscos_get_filetype_from_string(const char *string, int len); int riscos_get_filetype(const char *filename); void riscos_set_filetype_by_number(const char *filename, int type); -void riscos_set_filetype(const char *filename, const char *mimetype); +void riscos_set_filetype_by_mimetype(const char *filename, const char *mimetype); pid_t riscos_getpid(void); int riscos_kill(pid_t pid, int sig); int riscos_access(const char *path, int amode); int riscos_getchar(void); -int fdopenfile(const char *filename, const int allow_write); -void close_fds(void); -int renamefile(const char *old, const char *new); -char *gstrans(const char *old); char *riscos_make_basename(const char *filepath, const char *inputpath); -void not_implemented(const char *feature); +int riscos_check_regexp(const char *exp, const char *string, int debug); +int riscos_fdopenfile(const char *filename, const int allow_write); +void riscos_close_fds(void); +int riscos_renamefile(const char *old, const char *new); +char *riscos_gstrans(const char *old); +void riscos_not_implemented(const char *feature); #ifdef DEBUG -void dump_fdlist(void); -void list_openfiles(void); +void riscos_dump_fdlist(void); +void riscos_list_openfiles(void); #endif #ifndef __RISCOS__C__ #define getpid riscos_getpid diff --git a/include/zlib-riscos.h b/include/zlib-riscos.h new file mode 100644 index 000000000..fad556bcb --- /dev/null +++ b/include/zlib-riscos.h @@ -0,0 +1,134 @@ +/* zlib-riscos.h + * Copyright (C) 2002 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 + */ +#ifndef G10_ZLIB_RISCOS_H +#define G10_ZLIB_RISCOS_H + +#include +#include + +static const char * const zlib_path[] = { + "System:310.Modules.ZLib", + NULL +}; + +#define ZLib_Compress 0x53AC0 +#define ZLib_Decompress 0x53AC1 +#define ZLib_CRC32 0x53AC2 +#define ZLib_Adler32 0x53AC3 +#define ZLib_Version 0x53AC4 +#define ZLib_ZCompress 0x53AC5 +#define ZLib_ZCompress2 0x53AC6 +#define ZLib_ZUncompress 0x53AC7 +#define ZLib_DeflateInit 0x53AC8 +#define ZLib_InflateInit 0x53AC9 +#define ZLib_DeflateInit2 0x53ACA +#define ZLib_InflateInit2 0x53ACB +#define ZLib_Deflate 0x53ACC +#define ZLib_DeflateEnd 0x53ACD +#define ZLib_Inflate 0x53ACE +#define ZLib_InflateEnd 0x53ACF +#define ZLib_DeflateSetDictionary 0x53AD0 +#define ZLib_DeflateCopy 0x53AD1 +#define ZLib_DeflateReset 0x53AD2 +#define ZLib_DeflateParams 0x53AD3 +#define ZLib_InflateSetDictionary 0x53AD4 +#define ZLib_InflateSync 0x53AD5 +#define ZLib_InflateReset 0x53AD6 +#define ZLib_GZOpen 0x53AD7 +#define ZLib_GZRead 0x53AD8 +#define ZLib_GRWrite 0x53AD9 +#define ZLib_GZFlush 0x53ADA +#define ZLib_GZClose 0x53ADB +#define ZLib_GZError 0x53ADC +#define ZLib_GZSeek 0x53ADD +#define ZLib_GZTell 0x53ADE +#define ZLib_GZEOF 0x53ADF +#define ZLib_TaskAssociate 0x53AE0 + +#define crc32(r0,r1,r2) \ + _swi(ZLib_CRC32, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define adler32(r0,r1,r2) \ + _swi(ZLib_Adler32, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define zlibVersion() \ + _swi(ZLib_Version, _RETURN(0)) +#define compress(r0,r1,r2,r3) \ + _swi(ZLib_ZCompress, _INR(0,3) | _RETURN(0)|_OUT(1), r0,r1,r2,r3, &r1) +#define compress2(r0,r1,r2,r3,r4) \ + _swi(ZLib_ZCompress2, _INR(0,4) | _RETURN(0)|_OUT(1), r0,r1,r2,r3,r4, &r1) +#define uncompress(r0,r1,r2,r3) \ + _swi(ZLib_ZUncompress, _INR(0,3) | _RETURN(0)|_OUT(1), r0,r1,r2,r3, &r1) +#define deflateInit_(r0,r1,r2,r3) \ + _swi(ZLib_DeflateInit, _INR(0,3) | _RETURN(0), r0,r1,r2,r3) +#define inflateInit_(r0,r1,r2) \ + _swi(ZLib_InflateInit, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define deflateInit2_(r0,r1,r2,r3,r4,r5,r6,r7) \ + _swi(ZLib_DeflateInit2, _INR(0,7) | _RETURN(0), r0,r1,r2,r3,r4,r5,r6,r7) +#define inflateInit2_(r0,r1,r2,r3) \ + _swi(ZLib_InflateInit2, _INR(0,3) | _RETURN(0), r0,r1,r2,r3) +#define deflate(r0,r1) \ + _swi(ZLib_Deflate, _INR(0,1) | _RETURN(0), r0,r1) +#define deflateEnd(r0) \ + _swi(ZLib_DeflateEnd, _IN(0) | _RETURN(0), r0) +#define inflate(r0,r1) \ + _swi(ZLib_Inflate, _INR(0,1) | _RETURN(0), r0,r1) +#define inflateEnd(r0) \ + _swi(ZLib_InflateEnd, _IN(0) | _RETURN(0), r0) +#define deflateSetDictionary(r0,r1,r2) \ + _swi(ZLib_DeflateSetDictionary, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define deflateCopy(r0,r1) \ + _swi(ZLib_DeflateCopy, _INR(0,1) | _RETURN(0), r0,r1) +#define deflateReset(r0) \ + _swi(ZLib_DeflateReset, _IN(0) | _RETURN(0), r0) +#define deflateParams(r0,r1,r2) \ + _swi(ZLib_DeflateParams, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define inflateSetDictionary(r0,r1,r2) \ + _swi(ZLib_InflateSetDictionary, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define inflateSync(r0) \ + _swi(ZLib_InflateSync, _IN(0) | _RETURN(0), r0) +#define inflateReset(r0) \ + _swi(ZLib_InflateReset, _IN(0) | _RETURN(0), r0) +#define gzopen(r0,r1) \ + _swi(ZLib_GZOpen, _INR(0,1) | _RETURN(0), r0) +#define gzdopen(r0,r1) BUG() +#define gzsetparams(r0,r1,r2) BUG() +#define gzread(r0,r1,r2) \ + _swi(ZLib_GZRead, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define gzwrite(r0,r1,r2) \ + _swi(ZLib_GZWrite, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define gzprintf(r0,r1,...) BUG() +#define gzputs(r0,r1) BUG() +#define gzgets(r0,r1,r2) BUG() +#define gzputc(r0,r1) BUG() +#define gzgetc(r0) BUG() +#define gzflush(r0,r1) \ + _swi(ZLib_GZFlush, _INR(0,1) | _RETURN(0), r0,r1) +#define gzclose(r0) \ + _swi(ZLib_GZClose, _IN(0) | _RETURN(0), r0) +#define gzerror(r0,r1) \ + _swi(ZLib_GZError, _IN(0) | _RETURN(0)|_OUT(1), r0, &r1) +#define gzseek(r0,r1,r2) \ + _swi(ZLib_GZSeek, _INR(0,2) | _RETURN(0), r0,r1,r2) +#define gzrewind(r0) BUG() +#define gztell(r0) \ + _swi(ZLib_GZTell, _IN(0) | _RETURN(0), r0) +#define gzeof(r0) \ + _swi(ZLib_GZEOF, _IN(0) | _RETURN(0), r0) + +#endif /* G10_ZLIB_RISCOS_H */ diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 871e83816..4138133ee 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2002-10-31 Stefan Bellon + + * conf-riscos/Makefile: Updated to reflect latest changes. + 2002-10-28 Stefan Bellon * conf-riscos/include/config.h: Updated to reflect latest changes. diff --git a/scripts/conf-riscos/Makefile b/scripts/conf-riscos/Makefile index eeb6206c6..8fdaff878 100644 --- a/scripts/conf-riscos/Makefile +++ b/scripts/conf-riscos/Makefile @@ -1,13 +1,26 @@ # Makefile for the RISC OS version of GnuPG CC=cc LINK=link +AR=libfile AS=objasm MAKE=amu DEPEND=-depend !Depend LIBLDAP=^.^.openldap-2/0/18 -CC_FLAGS=-Wpc -apcs 3/26bit/fpe2 -throwback -Otime -IUnix:,include,mpi,intl,zlib,$(LIBLDAP).include -JUnix: -D__riscos__ -DHAVE_CONFIG_H -DNO_ASM -UIS_MODULE -DVERSION="\"$(GnuPG$Version)\"" $(GnuPG$DevDefine) + +# 26-bit configuration +CC_FLAGS=-Wpc -zo -fw -apcs 3/26bit/fpe2 -throwback -Otime -IUnix:,include,mpi,intl,util,zlib,$(LIBLDAP).include,^.^.regex-0/12 -JUnix: -D__riscos__ -DHAVE_CONFIG_H -DNO_ASM -UIS_MODULE -DVERSION="\"$(GnuPG$Version)\"" $(GnuPG$DevDefine) +AR_FLAGS= AS_FLAGS=-apcs 3/26bit -throwback -predefine "ARMv4 SETA 0" -LD_FLAGS=Unix:o.unixlib +LD_FLAGS= +UNIXLIB=Unix:o.UnixLib + +# 32-bit configuration (not yet fully working!) +#CC_FLAGS=-Wpc -zo -fw -apcs 3/32bit/fpe3 -throwback -Otime -IUnix:,include,mpi,intl,util,zlib,$(LIBLDAP).include,^.^.regex-0/12 -JUnix: -D__riscos__ -DHAVE_CONFIG_H -DNO_ASM -UIS_MODULE -DVERSION="\"$(GnuPG$Version)\"" $(GnuPG$DevDefine) +#AR_FLAGS= +#AS_FLAGS=-apcs 3/32bit -throwback -predefine "ARMv4 SETA 0" +#LD_FLAGS= +#UNIXLIB=Unix:o.UnixLib32 + CIPHER_OBJS=cipher.o.blowfish \ cipher.o.cast5 \ cipher.o.cipher \ @@ -31,7 +44,10 @@ CIPHER_OBJS=cipher.o.blowfish \ cipher.o.twofish GETTEXT_OBJS=intl.o.bindtextdom \ intl.o.dcgettext \ + intl.o.dcigettext \ + intl.o.dcngettext \ intl.o.dgettext \ + intl.o.dngettext \ intl.o.explodename \ intl.o.finddomain \ intl.o.gettext \ @@ -39,6 +55,8 @@ GETTEXT_OBJS=intl.o.bindtextdom \ intl.o.l10nflist \ intl.o.loadmsgcat \ intl.o.localealias \ + intl.o.ngettext \ + intl.o.plural \ intl.o.textdomain MPI_OBJS=mpi.o.mpi-add \ mpi.o.mpi-bit \ @@ -71,19 +89,6 @@ UTIL_OBJS=util.o.argparse \ util.o.strgutil \ util.o.ttyio \ util.o.riscos -ZLIB_OBJS=zlib.o.adler32 \ - zlib.o.compress \ - zlib.o.crc32 \ - zlib.o.deflate \ - zlib.o.infblock \ - zlib.o.infcodes \ - zlib.o.inffast \ - zlib.o.inflate \ - zlib.o.inftrees \ - zlib.o.infutil \ - zlib.o.trees \ - zlib.o.uncompr \ - zlib.o.zutil G10_OBJS=g10.o.armor \ g10.o.build-packet \ g10.o.cipher \ @@ -97,10 +102,8 @@ G10_OBJS=g10.o.armor \ g10.o.exec \ g10.o.export \ g10.o.free-packet \ - g10.o.g10 \ g10.o.getkey \ g10.o.helptext \ - g10.o.hkp \ g10.o.import \ g10.o.kbnode \ g10.o.keydb \ @@ -180,13 +183,8 @@ GPGV_OBJS=g10.o.armor \ cipher.o.rsa \ cipher.o.sha1 \ cipher.o.tiger32 \ - mpi.mpi \ - zlib.zlib -GPGKEYS_OBJS=util.o.riscos \ - util.o.strgutil \ - util.o.memory \ - util.o.logger \ - util.o.secmem \ + mpi.mpi +GPGKEYS_OBJS=util.util \ intl.gettext ## Rule Patterns ## @@ -208,45 +206,52 @@ all: @echo All other targets are internal and shouldn't be used! cipher.cipher: $(CIPHER_OBJS) - $(LINK) -aof $(CIPHER_OBJS) -o cipher.cipher + $(AR) $(AR_FLAGS) -c -o cipher.cipher $(CIPHER_OBJS) intl.gettext: $(GETTEXT_OBJS) - $(LINK) -aof $(GETTEXT_OBJS) -o intl.gettext + $(AR) $(AR_FLAGS) -c -o intl.gettext $(GETTEXT_OBJS) mpi.mpi: $(MPI_OBJS) - $(LINK) -aof $(MPI_OBJS) -o mpi.mpi + $(AR) $(AR_FLAGS) -c -o mpi.mpi $(MPI_OBJS) -tools.gpgsplit: tools.o.gpgsplit util.util intl.gettext zlib.zlib - $(LINK) $(LD_FLAGS) tools.o.gpgsplit util.util intl.gettext zlib.zlib -o tools.gpgsplit +tools.gpgsplit: tools.o.gpgsplit util.util intl.gettext + $(LINK) $(LD_FLAGS) -o tools.gpgsplit tools.o.gpgsplit util.util intl.gettext $(UNIXLIB) -squeeze tools.gpgsplit -copy tools.gpgsplit ADFS::A5.$.tmp.!GnuPG.gpgsplit ~CF~V keyserver.gpgkeys_ldap: keyserver.o.gpgkeys_ldap $(GPGKEYS_OBJS) $(LIBLDAP).libraries.libldap.libldap - $(LINK) $(LD_FLAGS) keyserver.o.gpgkeys_ldap $(GPGKEYS_OBJS) $(LIBLDAP).libraries.libldap.libldap -o keyserver.gpgkeys_ldap + $(LINK) $(LD_FLAGS) -o keyserver.gpgkeys_ldap keyserver.o.gpgkeys_ldap $(GPGKEYS_OBJS) $(LIBLDAP).libraries.libldap.libldap $(UNIXLIB) -squeeze keyserver.gpgkeys_ldap -copy keyserver.gpgkeys_ldap ADFS::A5.$.tmp.!GnuPG.gpgkeys_ldap ~CF~V +keyserver.gpgkeys_hkp: keyserver.o.gpgkeys_hkp $(GPGKEYS_OBJS) + $(LINK) $(LD_FLAGS) -o keyserver.gpgkeys_hkp keyserver.o.gpgkeys_hkp $(GPGKEYS_OBJS) $(UNIXLIB) + -squeeze keyserver.gpgkeys_hkp + -copy keyserver.gpgkeys_hkp ADFS::A5.$.tmp.!GnuPG.gpgkeys_hkp ~CF~V + riscos.jpegview.jpegview: -dir riscos.jpegview -$(MAKE) -back util.util: $(UTIL_OBJS) - $(LINK) -aof $(UTIL_OBJS) -o util.util + $(AR) $(AR_FLAGS) -c -o util.util $(UTIL_OBJS) -zlib.zlib: $(ZLIB_OBJS) - $(LINK) -aof zlib.o.* -o zlib.zlib - -g10.gpg: $(G10_OBJS) cipher.o.idea cipher.cipher intl.gettext mpi.mpi util.util zlib.zlib BUILD - $(LINK) $(G10_OBJS) $(LD_FLAGS) cipher.o.idea cipher.cipher intl.gettext mpi.mpi util.util zlib.zlib -o g10.gpg +g10.gpg: g10.o.g10 $(G10_OBJS) cipher.o.idea cipher.cipher intl.gettext mpi.mpi util.util BUILD + $(LINK) $(LD_FLAGS) -o g10.gpg g10.o.g10 $(G10_OBJS) cipher.o.idea cipher.cipher intl.gettext mpi.mpi util.util $(UNIXLIB) -copy g10.gpg ADFS::A5.$.tmp.!GnuPG.gpg ~CFR~V g10.gpgv: $(GPGV_OBJS) intl.gettext BUILD - $(LINK) $(GPGV_OBJS) intl.gettext $(LD_FLAGS) -o g10.gpgv + $(LINK) $(LD_FLAGS) -o g10.gpgv $(GPGV_OBJS) intl.gettext $(UNIXLIB) -copy g10.gpgv ADFS::A5.$.tmp.!GnuPG.gpgv ~CFR~V -g10.gpgpart: $(G10_OBJS) cipher.cipher intl.gettext mpi.mpi util.util zlib.zlib BUILD - drlink034 -aof $(G10_OBJS) $(LD_FLAGS) cipher.cipher intl.gettext mpi.mpi util.util zlib.zlib -o g10.gpgpart +g10.gpgpart: $(G10_OBJS) BUILD + copy $(UNIXLIB) g10.gpgpart ~CF~V + $(AR) $(AR_FLAGS) -i g10.gpgpart $(CIPHER_OBJS) + $(AR) $(AR_FLAGS) -i g10.gpgpart $(GETTEXT_OBJS) + $(AR) $(AR_FLAGS) -i g10.gpgpart $(MPI_OBJS) + $(AR) $(AR_FLAGS) -i g10.gpgpart $(UTIL_OBJS) + $(AR) $(AR_FLAGS) -i g10.gpgpart $(G10_OBJS) select-idea-src: -copy distrib.idea-addon.cipher.c.idea cipher.c.idea ~CF~NR~V @@ -259,7 +264,7 @@ select-gpl-src: distrib.gnupgsrc/zip: select-gpl-src -zip -9@ distrib.gnupgsrc/zip < distrib.resources.distfiles -distrib.gnupg/zip: distrib.gpl-bin.!GnuPG.JPEGview distrib.gpl-bin.!GnuPG.gpgsplit distrib.gpl-bin.!GnuPG.gpg distrib.gpl-bin.!GnuPG.gpgv select-gpl-src +distrib.gnupg/zip: distrib.gpl-bin.!GnuPG.JPEGview distrib.gpl-bin.!GnuPG.gpgsplit distrib.private.!GnuPG.gpgkeys_hkp distrib.gpl-bin.!GnuPG.gpg distrib.gpl-bin.!GnuPG.gpgv select-gpl-src -copy distrib.resources.History distrib.gpl-bin.History ~CFR~V -copy distrib.resources.Upgrading distrib.gpl-bin.Upgrading ~CFR~V -copy distrib.resources.ReadMe_bin distrib.gpl-bin.!ReadMe1st ~CFR~V @@ -271,7 +276,7 @@ distrib.gnupg/zip: distrib.gpl-bin.!GnuPG.JPEGview distrib.gpl-bin.!GnuPG.gpgspl -zip -r9 ^.gnupg/zip * -back -distrib.gnupgdev/zip: distrib.private.!GnuPG.JPEGview distrib.private.!GnuPG.gpgsplit distrib.private.!GnuPG.gpgkeys_ldap distrib.private.!GnuPG.gpg distrib.private.!GnuPG.gpgv select-idea-src +distrib.gnupgdev/zip: distrib.private.!GnuPG.JPEGview distrib.private.!GnuPG.gpgsplit distrib.private.!GnuPG.gpgkeys_ldap distrib.private.!GnuPG.gpgkeys_hkp distrib.private.!GnuPG.gpg distrib.private.!GnuPG.gpgv select-idea-src -ifthere distrib.private.!GnuPG.locale then wipe distrib.private.!GnuPG.locale ~CFR~V -copy distrib.intl.!GnuPG.locale distrib.private.!GnuPG.locale ~CFR~V -copy distrib.resources.History distrib.private.History ~CFR~V @@ -292,9 +297,10 @@ distrib.gnupgidea/zip: cipher.o.idea select-idea-src -zip -r9 ^.gnupgidea/zip * -back -distrib.gnupgpart/zip: g10.gpgpart select-idea-src +distrib.gnupgpart/zip: g10.o.g10 g10.gpgpart select-idea-src -copy distrib.resources.ReadMe_part distrib.part.!ReadMe1st ~CFR~V -copy g10.gpgpart distrib.part.g10.gpgpart ~CFR~V + -copy g10.o.g10 distrib.part.g10.g10 ~CFR~V -dir distrib.part -zip -r9 ^.gnupgpart/zip * -back @@ -323,6 +329,10 @@ distrib.gpl-bin.!GnuPG.gpgsplit: tools.gpgsplit -copy tools.gpgsplit distrib.gpl-bin.!GnuPG.gpgsplit ~CFR~V -squeeze distrib.gpl-bin.!GnuPG.gpgsplit +distrib.gpl-bin.!GnuPG.gpgkeys_hkp: keyserver.gpgkeys_hkp + -copy keyserver.gpgkeys_hkp distrib.gpl-bin.!GnuPG.gpgkeys_hkp ~CFR~V + -squeeze distrib.gpl-bin.!GnuPG.gpgkeys_hkp + distrib.gpl-bin.!GnuPG.JPEGview: riscos.jpegview.jpegview -copy riscos.jpegview.jpegview distrib.gpl-bin.!GnuPG.JPEGview ~CFR~V @@ -342,6 +352,10 @@ distrib.private.!GnuPG.gpgkeys_ldap: keyserver.gpgkeys_ldap -copy keyserver.gpgkeys_ldap distrib.private.!GnuPG.gpgkeys_ldap ~CFR~V -squeeze distrib.private.!GnuPG.gpgkeys_ldap +distrib.private.!GnuPG.gpgkeys_hkp: keyserver.gpgkeys_hkp + -copy keyserver.gpgkeys_hkp distrib.private.!GnuPG.gpgkeys_hkp ~CFR~V + -squeeze distrib.private.!GnuPG.gpgkeys_hkp + distrib.private.!GnuPG.JPEGview: riscos.jpegview.jpegview -copy riscos.jpegview.jpegview distrib.private.!GnuPG.JPEGview ~CFR~V @@ -362,10 +376,6 @@ clean-util: -ifthere util.o.* then wipe util.o.* ~CFR~V -ifthere util.util then wipe util.util ~CFR~V -clean-zlib: - -ifthere zlib.o.* then wipe zlib.o.* ~CFR~V - -ifthere zlib.zlib then wipe zlib.zlib ~CFR~V - clean-dist: -ifthere distrib.*/zip then wipe distrib.*/zip ~CFR~V @@ -377,6 +387,7 @@ clean-g10: clean-keyserver: -ifthere keyserver.gpgkeys_ldap then wipe keyserver.gpgkeys_ldap ~CFR~V + -ifthere keyserver.gpgkeys_hkp then wipe keyserver.gpgkeys_hkp ~CFR~V -ifthere keyserver.o.* then wipe keyserver.o.* ~CFR~V clean-tools: @@ -392,12 +403,12 @@ clean-version: -ifthere g10.o.g10 then wipe g10.o.g10 ~CFR~V -ifthere g10.o.gpgv then wipe g10.o.gpgv ~CFR~V -ifthere g10.o.keygen then wipe g10.o.keygen ~CFR~V - -ifthere g10.o.sign then wipe g10.o.sign ~CFR~V + -ifthere g10.o.keyserver then wipe g10.o.keyserver ~CFR~V -ifthere g10.gpg then wipe g10.gpg ~CFR~V -ifthere g10.gpgv then wipe g10.gpgv ~CFR~V -ifthere g10.gpgpart then wipe g10.gpgpart ~CFR~V -clean: clean-dist clean-cipher clean-intl clean-mpi clean-util clean-zlib clean-g10 clean-keyserver clean-tools clean-riscos +clean: clean-dist clean-cipher clean-intl clean-mpi clean-util clean-g10 clean-keyserver clean-tools clean-riscos g10.o.armor: BUILD $(CC) $(CC_FLAGS) $(DEPEND) -c -o g10.o.armor g10.c.armor @@ -414,8 +425,8 @@ g10.o.gpgv: BUILD g10.o.keygen: BUILD $(CC) $(CC_FLAGS) $(DEPEND) -c -o g10.o.keygen g10.c.keygen -g10.o.sign: BUILD - $(CC) $(CC_FLAGS) $(DEPEND) -c -o g10.o.sign g10.c.sign +g10.o.keyserver: BUILD + $(CC) $(CC_FLAGS) $(DEPEND) -c -o g10.o.keyserver g10.c.keyserver dev: clean-version $(MAKE) fast-dev diff --git a/tools/ChangeLog b/tools/ChangeLog index 6b07fea17..fe06d829d 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,8 @@ +2002-10-31 Stefan Bellon + + * gpgsplit.c (write_part) [__riscos__]: Use riscos_load_module() + to load ZLib module. + 2002-10-23 Werner Koch * gpgsplit.c: New options --secret-to-public and --no-split. diff --git a/tools/gpgsplit.c b/tools/gpgsplit.c index 0fec860f7..4e61b3efd 100644 --- a/tools/gpgsplit.c +++ b/tools/gpgsplit.c @@ -35,6 +35,7 @@ #endif #include #ifdef __riscos__ +# include "zlib-riscos.h" # include #endif /* __riscos__ */ @@ -376,6 +377,12 @@ write_part ( const char *fname, FILE *fpin, unsigned long pktlen, unsigned char *p; const char *outname = create_filename (pkttype); +#ifdef __riscos__ + static int initialized = 0; + + if (!initialized) + initialized = riscos_load_module("ZLib", zlib_path, 1); +#endif if (opt_no_split) fpout = stdout; else diff --git a/util/ChangeLog b/util/ChangeLog index 330610ad5..55e584ed5 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,13 @@ +2002-10-31 Stefan Bellon + + * riscos.c (riscos_load_module, riscos_check_regexp): New. + (riscos_set_filetype_by_mimetype, riscos_dump_fdlist) + (riscos_fdopenfile, riscos_close_fds, riscos_renamefile) + (riscos_gstrans, riscos_list_openfiles, riscos_not_implemented): + Renamed functions to contain riscos prefix. + * dotlock.c [__riscos__]: Renames due to changes in riscos.c. + * fileutil.c [__riscos__]: Likewise. + 2002-10-29 Stefan Bellon * fileutil.c: Removed unnecessary left-over includes for RISC OS. diff --git a/util/dotlock.c b/util/dotlock.c index fac825450..42d06c7b4 100644 --- a/util/dotlock.c +++ b/util/dotlock.c @@ -246,7 +246,7 @@ make_dotlock( DOTLOCK h, long timeout ) return -1; } #else /* __riscos__ */ - if( !renamefile(h->tname, h->lockname) ) { + if( !riscos_renamefile(h->tname, h->lockname) ) { h->locked = 1; return 0; /* okay */ } @@ -340,7 +340,7 @@ release_dotlock( DOTLOCK h ) return -1; } #else /* __riscos__ */ - if( renamefile(h->lockname, h->tname) ) { + if( riscos_renamefile(h->lockname, h->tname) ) { log_error( "release_dotlock: error renaming lockfile `%s' to `%s'", h->lockname, h->tname); return -1; diff --git a/util/fileutil.c b/util/fileutil.c index 8651315f9..92dbc9ef6 100644 --- a/util/fileutil.c +++ b/util/fileutil.c @@ -124,7 +124,7 @@ make_filename( const char *first_part, ... ) #ifndef __riscos__ return name; #else /* __riscos__ */ - p = gstrans(name); + p = riscos_gstrans(name); m_free(name); return p; #endif /* __riscos__ */ @@ -147,8 +147,8 @@ compare_filenames( const char *a, const char *b ) int c = 0; char *abuf, *bbuf; - abuf = gstrans(a); - bbuf = gstrans(b); + abuf = riscos_gstrans(a); + bbuf = riscos_gstrans(b); c = ascii_strcasecmp (abuf, bbuf); diff --git a/util/riscos.c b/util/riscos.c index 6c3bd375d..70ec98fb7 100644 --- a/util/riscos.c +++ b/util/riscos.c @@ -23,9 +23,7 @@ #include #include -#include -#include -#include +#include #include #include #include @@ -35,8 +33,7 @@ #include "memory.h" #define __UNIXLIB_INTERNALS -#include -#include +#include /* needed for MMM_TYPE_* definitions */ #undef __UNIXLIB_INTERNALS @@ -47,7 +44,7 @@ struct fds_item { struct fds_item *next; }; static struct fds_item *fds_list = NULL; -static int initialized = 0; +static int fdlist_initialized = 0; /* local RISC OS functions */ @@ -59,10 +56,10 @@ is_read_only(const char *filename) if (_swix(OS_File, _INR(0,1) | _OUT(0) | _OUT(5), 17, filename, &type, &attr)) - log_fatal("Can't get file attributes for %s!\n", filename); + log_fatal("Can't get file attributes for file \"%s\"!\n", filename); if (type == 0) - log_fatal("Can't find file %s!\n", filename); + log_fatal("Can't find file \"%s\"!\n", filename); if (_swix(OS_File, _INR(0,1) | _IN(5), 4, filename, attr)) return 1; @@ -79,6 +76,30 @@ riscos_global_defaults(void) __feature_imagefs_is_file = 1; } +int +riscos_load_module(const char *name, const char * const path[], int fatal) +{ + int i; + + /* Is module already loaded? */ + if (!_swix(OS_Module, _INR(0,1), 18, name)) + 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 module in the default locations */ + if (fatal) + log_fatal("Operation cannot be performed without \"%s\" module!\n", + name); + else + log_info("Can't load \"%s\" module, continuing anyway!\n", name); + + return 0; +} + int riscos_get_filetype_from_string(const char *string, int len) { @@ -98,7 +119,7 @@ riscos_get_filetype(const char *filename) int result; if (_swix(OS_File, _INR(0,1) | _OUT(6), 23, filename, &result)) - log_fatal("Can't get filetype for file %s!\n", filename); + log_fatal("Can't get filetype for file \"%s\"!\n", filename); return result; } @@ -107,18 +128,18 @@ void riscos_set_filetype_by_number(const char *filename, int type) { if (_swix(OS_File, _INR(0,2), 18, filename, type)) - log_fatal("Can't set filetype for file %s!\n" + log_fatal("Can't set filetype for file \"%s\"!\n" "Is the file on a read-only file system?\n", filename); } void -riscos_set_filetype(const char *filename, const char *mimetype) +riscos_set_filetype_by_mimetype(const char *filename, const char *mimetype) { int result; if (_swix(MimeMap_Translate, _INR(0,2) | _OUT(3), MMM_TYPE_MIME, mimetype, MMM_TYPE_RISCOS, &result)) - log_fatal("Can't translate MIME type %s!\n", mimetype); + log_fatal("Can't translate MIME type \"%s\"!\n", mimetype); riscos_set_filetype_by_number(filename, result); } @@ -133,7 +154,8 @@ riscos_getpid(void) if (state) if (_swix(Wimp_ReadSysInfo, _IN(0) | _OUT(0), 5, &state)) - log_fatal("Wimp_ReadSysInfo failed: Can't get task handle (R0=5)!\n"); + log_fatal("Wimp_ReadSysInfo failed: " + "Can't get task handle (R0=5)!\n"); return (pid_t) state; } @@ -181,7 +203,7 @@ riscos_getchar(void) #ifdef DEBUG void -dump_fdlist(void) +riscos_dump_fdlist(void) { struct fds_item *iter = fds_list; printf("List of open file descriptors:\n"); @@ -193,7 +215,7 @@ dump_fdlist(void) #endif /* DEBUG */ int -fdopenfile(const char *filename, const int allow_write) +riscos_fdopenfile(const char *filename, const int allow_write) { struct fds_item *h; int fd; @@ -202,11 +224,12 @@ fdopenfile(const char *filename, const int allow_write) else fd = open(filename, O_RDONLY); if (fd == -1) - log_error("Can't open file %s: %i, %s!\n", filename, errno, strerror(errno)); + log_error("Can't open file \"%s\": %i, %s!\n", + filename, errno, strerror(errno)); - if (!initialized) { - atexit (close_fds); - initialized = 1; + if (!fdlist_initialized) { + atexit (riscos_close_fds); + fdlist_initialized = 1; } h = fds_list; @@ -220,7 +243,7 @@ fdopenfile(const char *filename, const int allow_write) } void -close_fds(void) +riscos_close_fds(void) { FILE *fp; struct fds_item *h = fds_list; @@ -236,7 +259,7 @@ close_fds(void) } int -renamefile(const char *old, const char *new) +riscos_renamefile(const char *old, const char *new) { _kernel_oserror *e; @@ -252,7 +275,7 @@ renamefile(const char *old, const char *new) } char * -gstrans(const char *old) +riscos_gstrans(const char *old) { int size = 256, last; char *buf, *tmp; @@ -284,7 +307,7 @@ gstrans(const char *old) char * riscos_make_basename(const char *filepath, const char *realfname) { - char *p = (char*)filepath-1, *result; + char *result, *p = (char*)filepath-1; int i, filetype; if ( !(p=strrchr(filepath, DIRSEP_C)) ) @@ -311,9 +334,61 @@ riscos_make_basename(const char *filepath, const char *realfname) return result; } +#define RegEx_CompilePattern 0x52AC0 +#define RegEx_Search 0x52AC2 +#define RegEx_Free 0x52AC7 +#define RegEx_CompileExtendedPattern 0x52AC9 + +static const char * const regex_path[] = { + "GnuPG:RegEx", + "System:310.Modules.RegEx", + "System:Modules.RegEx", + NULL +}; + +int +riscos_check_regexp(const char *exp, const char *string, int debug) +{ + static int regex_initialized = 0; + int ret; + char *buf; + + if (!regex_initialized) + regex_initialized = riscos_load_module("RegEx", regex_path, 0); + + if (!regex_initialized) { + log_info("Regular expressions cannot be used!\n"); + return 0; + } + + if (_swix(RegEx_CompileExtendedPattern, _INR(0,2) | _OUT(0) | _OUT(3), + 0, exp, 1<<18, + &buf, &ret)) { + log_info("RegEx could not compile pattern \"%s\".\n", exp); + log_info("ErrorCode = %i\n", ret); + return 0; + } + + if (_swix(RegEx_Search, _INR(0,4) | _OUT(5), + buf, string, -1, 0, -1, + &ret)) { + log_info("RegEx error during execution of serach pattern \"%s\"\n", + exp); + log_info("on string \"%s\"\n", string); + return 0; + } + + _swix(RegEx_Free, _IN(0), buf); + + if(debug) + log_debug("regexp \"%s\" on \"%s\": %s\n",exp,string,ret>=0?"YES":"NO"); + + return (ret>=0); +} + #ifdef DEBUG void -list_openfiles(void) +riscos_list_openfiles(void) { char *name; int i, len; @@ -345,7 +420,7 @@ list_openfiles(void) #endif void -not_implemented(const char *feature) +riscos_not_implemented(const char *feature) { log_info("%s is not implemented in the RISC OS version!\n", feature); }