Armor works now

This commit is contained in:
Werner Koch 1997-11-21 14:53:57 +00:00
parent 25c8f1a3d7
commit 2f3cb7e30a
15 changed files with 221 additions and 282 deletions

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = util mpi cipher tools g10
SUBDIRS = util mpi cipher tools g10 psst
EXTRA_DIST =

View File

@ -38,7 +38,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
SUBDIRS = util mpi cipher tools g10
SUBDIRS = util mpi cipher tools g10 psst
EXTRA_DIST =
ACCONFIG = acconfig.h
CONFIG_HEADER_IN = config.h.in

30
TODO Normal file
View File

@ -0,0 +1,30 @@
* write the assembler function for mpihelp ....
* improve iobuf by reading more than one byte at once,
this shoud espceially done for the buffer in the chain.
* add a way to difference between errors and eof in the underflow/flush
function of iobuf.
* filter all output read from the input when displaying it to the user.
* remove idea.
* keyring editing
* improve the prime number generator
* remove some debugging stuff (e.g. the listing mode in mainproc)
* add trust stuff
* make ttyio.c work (hide passwords etc..)
* add signal handling
* add writing of signatures and checking of detached signatures.
* add option file handling.
* use correct ASN values for DEK encoding
* add compress handling
* add checking of armor trailers
* fix the memory stuff (secure memory)
* add real secure memory
* look for a way to reuse RSA signatures
* add ElGamal and make it the default one.
* find a way to remove the arnor filter after it
has detected, that the data is not armored.
* Use the Chines Remainder Theorem to speed up RSA calculations.
* remove all "Fixmes"
* add credits for the MPI lib.
* speed up the RIPE-MD-160

View File

@ -57,7 +57,7 @@ else
fi
AC_OUTPUT([ Makefile util/Makefile mpi/Makefile cipher/Makefile \
g10/Makefile tools/Makefile ],
g10/Makefile tools/Makefile psst/Makefile ],
[echo timestamp > stamp-h ])

View File

@ -16,6 +16,7 @@ g10_SOURCES = g10.c \
keygen.c \
main.h \
mainproc.c \
armor.c \
mdfilter.c \
options.h \
overwrite.c \

View File

@ -54,6 +54,7 @@ g10_SOURCES = g10.c \
keygen.c \
main.h \
mainproc.c \
armor.c \
mdfilter.c \
options.h \
overwrite.c \
@ -85,9 +86,9 @@ LIBS = @LIBS@
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(LDFLAGS) -o $@
g10_OBJECTS = g10.o build-packet.o compressed.o encode.o encr-data.o \
free-packet.o getkey.o keygen.o mainproc.o mdfilter.o overwrite.o \
parse-packet.o passphrase.o plaintext.o pubkey-enc.o seckey-cert.o \
seskey.o sig-check.o
free-packet.o getkey.o keygen.o mainproc.o armor.o mdfilter.o \
overwrite.o parse-packet.o passphrase.o plaintext.o pubkey-enc.o \
seckey-cert.o seskey.o sig-check.o
EXTRA_g10_SOURCES =
g10_LDADD = $(LDADD)
DIST_COMMON = Makefile.am Makefile.in
@ -102,10 +103,10 @@ DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA)
TAR = tar
DEP_FILES = $(srcdir)/.deps/build-packet.P $(srcdir)/.deps/compressed.P \
$(srcdir)/.deps/encode.P $(srcdir)/.deps/encr-data.P \
$(srcdir)/.deps/free-packet.P $(srcdir)/.deps/g10.P \
$(srcdir)/.deps/getkey.P $(srcdir)/.deps/keygen.P \
DEP_FILES = $(srcdir)/.deps/armor.P $(srcdir)/.deps/build-packet.P \
$(srcdir)/.deps/compressed.P $(srcdir)/.deps/encode.P \
$(srcdir)/.deps/encr-data.P $(srcdir)/.deps/free-packet.P \
$(srcdir)/.deps/g10.P $(srcdir)/.deps/getkey.P $(srcdir)/.deps/keygen.P \
$(srcdir)/.deps/mainproc.P $(srcdir)/.deps/mdfilter.P \
$(srcdir)/.deps/overwrite.P $(srcdir)/.deps/parse-packet.P \
$(srcdir)/.deps/passphrase.P $(srcdir)/.deps/plaintext.P \

View File

@ -33,14 +33,13 @@
#include "memory.h"
#include "util.h"
#include "main.h"
#include "filter.h"
static int encode_simple( const char *filename, int mode );
static IOBUF open_outfile( const char *iname );
static int armor_filter( void *opaque, int control,
IOBUF chain, byte *buf, size_t *ret_len);
static int compress_filter( void *opaque, int control,
IOBUF chain, byte *buf, size_t *ret_len);
static int cipher_filter( void *opaque, int control,
@ -56,51 +55,6 @@ typedef struct {
} cipher_filter_context_t;
typedef struct {
int status;
int what;
byte buf[3];
int idx, idx2;
u32 crc;
} armor_filter_context_t;
#define CRCINIT 0xB704CE
#define CRCPOLY 0X864CFB
#define CRCUPDATE(a,c) do { \
a = ((a) << 8) ^ crc_table[((a)&0xff >> 16) ^ (c)]; \
a &= 0x00ffffff; \
} while(0)
static u32 crc_table[256];
static int crc_table_initialized;
static void
init_crc_table(void)
{
int i, j;
u32 t;
crc_table[0] = 0;
for(i=j=0; j < 128; j++ ) {
t = crc_table[j];
if( t & 0x00800000 ) {
t <<= 1;
crc_table[i++] = t ^ CRCPOLY;
crc_table[i++] = t;
}
else {
t <<= 1;
crc_table[i++] = t;
crc_table[i++] = t ^ CRCPOLY;
}
}
crc_table_initialized=1;
}
/****************
@ -434,125 +388,6 @@ open_outfile( const char *iname )
return a;
}
static int
armor_filter( void *opaque, int control,
IOBUF a, byte *buffer, size_t *ret_len)
{
static byte bintoasc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
size_t size = *ret_len;
armor_filter_context_t *afx = opaque;
int rc=0, i, c;
byte buf[3];
int idx, idx2;
u32 crc;
if( control == IOBUFCTRL_FLUSH ) {
if( !afx->status ) { /* write the header line */
if( !afx->what )
iobuf_writestr(a, "-----BEGIN PGP MESSAGE-----\n");
else
iobuf_writestr(a, "-----BEGIN PGP PUBLIC KEY BLOCK-----\n");
iobuf_writestr(a, "Version: G10 pre-release " VERSION "\n");
iobuf_writestr(a, "Comment: This is a alpha test version!\n\n");
afx->status++;
afx->idx = 0;
afx->idx2 = 0;
afx->crc = CRCINIT;
}
crc = afx->crc;
idx = afx->idx;
idx2 = afx->idx2;
for(i=0; i < idx; i++ )
buf[i] = afx->buf[i];
for(i=0; i < size; i++ )
crc = (crc << 8) ^ crc_table[(crc >> 16)&0xff ^ buffer[i]];
crc &= 0x00ffffff;
for( ; size; buffer++, size-- ) {
buf[idx++] = *buffer;
if( idx > 2 ) {
idx = 0;
c = bintoasc[(*buf >> 2) & 077];
iobuf_put(a, c);
c = bintoasc[(((*buf<<4)&060)|((buf[1] >> 4)&017))&077];
iobuf_put(a, c);
c = bintoasc[(((buf[1]<<2)&074)|((buf[2]>>6)&03))&077];
iobuf_put(a, c);
c = bintoasc[buf[2]&077];
iobuf_put(a, c);
if( ++idx2 > (72/4) ) {
iobuf_put(a, '\n');
idx2=0;
}
}
}
for(i=0; i < idx; i++ )
afx->buf[i] = buf[i];
afx->idx = idx;
afx->idx2 = idx2;
afx->crc = crc;
}
else if( control == IOBUFCTRL_INIT ) {
if( !crc_table_initialized )
init_crc_table();
}
else if( control == IOBUFCTRL_FREE ) {
if( afx->status ) { /* pad, write cecksum, and bottom line */
crc = afx->crc;
idx = afx->idx;
idx2 = afx->idx2;
for(i=0; i < idx; i++ )
buf[i] = afx->buf[i];
if( idx ) {
c = bintoasc[(*buf>>2)&077];
iobuf_put(a, c);
if( idx == 1 ) {
c = bintoasc[((*buf << 4) & 060) & 077];
iobuf_put(a, c);
iobuf_put(a, '=');
iobuf_put(a, '=');
}
else { /* 2 */
c = bintoasc[(((*buf<<4)&060)|((buf[1]>>4)&017))&077];
iobuf_put(a, c);
c = bintoasc[((buf[1] << 2) & 074) & 077];
iobuf_put(a, c);
iobuf_put(a, '=');
}
++idx2;
}
/* may need a linefeed */
if( idx2 < (72/4) )
iobuf_put(a, '\n');
/* write the CRC */
iobuf_put(a, '=');
buf[0] = crc >>16;
buf[1] = crc >> 8;
buf[2] = crc;
c = bintoasc[(*buf >> 2) & 077];
iobuf_put(a, c);
c = bintoasc[(((*buf<<4)&060)|((buf[1] >> 4)&017))&077];
iobuf_put(a, c);
c = bintoasc[(((buf[1]<<2)&074)|((buf[2]>>6)&03))&077];
iobuf_put(a, c);
c = bintoasc[buf[2]&077];
iobuf_put(a, c);
iobuf_put(a, '\n');
/* and the the trailer */
if( !afx->what )
iobuf_writestr(a, "-----END PGP MESSAGE-----\n");
else
iobuf_writestr(a, "-----END PGP PUBLIC KEY BLOCK-----\n");
}
}
else if( control == IOBUFCTRL_DESC )
*(char**)buf = "armor_filter";
return 0;
}
static int
compress_filter( void *opaque, int control,

View File

@ -28,8 +28,23 @@ typedef struct {
size_t maxbuf_size;
} md_filter_context_t;
typedef struct {
int status;
int what;
byte radbuf[4];
int idx, idx2;
u32 crc;
int inp_checked; /* set if inp has been checked */
int inp_bypass; /* set if the input is not armored */
int inp_eof;
} armor_filter_context_t;
/*-- mdfilter.c --*/
int md_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len);
/*-- armor.c --*/
int armor_filter( void *opaque, int control,
IOBUF chain, byte *buf, size_t *ret_len);
#endif /*G10_FILTER_H*/

View File

@ -31,6 +31,7 @@
#include "keydb.h"
#include "mpi.h"
#include "cipher.h"
#include "filter.h"
const char *
@ -51,11 +52,15 @@ strusage( int level )
"\nSyntax: g10 [options] [files]\n"
"sign, check, encrypt or decrypt\n"
"default operation depends on the input data\n"
#ifndef HAVE_RSA_CIPHER
"This version does not support RSA!\n"
#ifdef HAVE_RSA_CIPHER
"WARNING: This version has RSA support! Your are not allowed to\n"
" use it inside the Unites States until Sep 30, 2000!\n"
#endif
;
break;
case 26:
p = "Please report bugs to <g10-bugs@isil.d.shuttle.de>.\n";
break;
default: p = default_strusage(level);
}
return p;
@ -75,6 +80,7 @@ set_debug(void)
}
int
main( int argc, char **argv )
{
@ -115,6 +121,7 @@ main( int argc, char **argv )
const char *fname, *fname_print;
STRLIST sl, remusr= NULL;
int nrings=0;
armor_filter_context_t afx;
opt.compress = -1; /* defaults to default compression level */
while( arg_parse( &pargs, opts) ) {
@ -210,6 +217,9 @@ main( int argc, char **argv )
usage(1);
if( !(a = iobuf_open(fname)) )
log_fatal("can't open '%s'\n", fname_print);
/* push the armor filter, so it can peek at the input data */
memset( &afx, 0, sizeof afx);
iobuf_push_filter( a, armor_filter, &afx );
proc_packets( a );
iobuf_close(a);
break;

View File

@ -432,12 +432,12 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen,
X(q);
X(u);
#undef X
log_mpidump("rsa n=", cert->d.rsa.rsa_n );
/* log_mpidump("rsa n=", cert->d.rsa.rsa_n );
log_mpidump("rsa e=", cert->d.rsa.rsa_e );
log_mpidump("rsa d=", cert->d.rsa.rsa_d );
log_mpidump("rsa p=", cert->d.rsa.rsa_p );
log_mpidump("rsa q=", cert->d.rsa.rsa_q );
log_mpidump("rsa u=", cert->d.rsa.rsa_u );
log_mpidump("rsa u=", cert->d.rsa.rsa_u ); */
}
}
}

View File

@ -58,6 +58,8 @@ struct iobuf_struct {
IOBUF chain; /* next iobuf used for i/o if any (passed to filter) */
int no, subno;
const char *desc;
void *opaque; /* can be used to old any information */
/* this value is copied to all instances */
};
int iobuf_debug_mode;
@ -91,6 +93,7 @@ void iobuf_push_recorder( IOBUF a, int c );
char *iobuf_stop_recorder( IOBUF a, size_t *n );
u32 iobuf_get_filelength( IOBUF a );
const char *iobuf_get_fname( IOBUF a );
void iobuf_set_block_mode( IOBUF a, size_t n );
int iobuf_in_block_mode( IOBUF a );

View File

@ -55,6 +55,7 @@ typedef struct {
} ARGPARSE_OPTS;
/*-- logger.c --*/
void set_log_pid( int pid );
void printstr( int level, const char *fmt, ... );
void log_bug( const char *fmt, ... );
void log_fatal( const char *fmt, ... );

View File

@ -27,101 +27,101 @@
#include "util.h"
#ifdef DOCUMENTATION
@Summary arg_parse
#include <wk/lib.h>
typedef struct {
char *argc; /* pointer to argc (value subject to change) */
char ***argv; /* pointer to argv (value subject to change) */
unsigned flags; /* Global flags (DO NOT CHANGE) */
int err; /* print error about last option */
/* 1 = warning, 2 = abort */
int r_opt; /* return option */
int r_type; /* type of return value (0 = no argument found)*/
union {
int ret_int;
long ret_long
ulong ret_ulong;
char *ret_str;
} r; /* Return values */
struct {
int index;
const char *last;
} internal; /* DO NOT CHANGE */
} ARGPARSE_ARGS;
typedef struct {
int short_opt;
const char *long_opt;
unsigned flags;
} ARGPARSE_OPTS;
int arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts );
@Description
This is my replacement for getopt(). See the example for a typical usage.
Global flags are:
Bit 0 : Do not remove options form argv
Bit 1 : Do not stop at last option but return other args
with r_opt set to -1.
Bit 2 : Assume options and real args are mixed.
Bit 3 : Do not use -- to stop option processing.
Bit 4 : Do not skip the first arg.
Bit 5 : allow usage of long option with only one dash
all other bits must be set to zero, this value is modified by the function
so assume this is write only.
Local flags (for each option):
Bit 2-0 : 0 = does not take an argument
1 = takes int argument
2 = takes string argument
3 = takes long argument
4 = takes ulong argument
Bit 3 : argument is optional (r_type will the be set to 0)
Bit 4 : allow 0x etc. prefixed values.
If can stop the option processing by setting opts to NULL, the function will
then return 0.
@Return Value
Returns the args.r_opt or 0 if ready
r_opt may be -2 to indicate an unknown option.
@See Also
ArgExpand
@Notes
You do not need to process the options 'h', '--help' or '--version'
because this function includes standard help processing; but if you
specify '-h', '--help' or '--version' you have to do it yourself.
The option '--' stops argument processing; if bit 1 is set the function
continues to return normal arguments.
To process float args or unsigned args you must use a string args and do
the conversion yourself.
@Example
ARGPARSE_OPTS opts[] = {
{ 'v', "verbose", 0 },
{ 'd', "debug", 0 },
{ 'o', "output", 2 },
{ 'c', "cross-ref", 2|8 },
{ 'm', "my-option", 1|8 },
{ 500, "have-no-short-option-for-this-long-option", 0 },
{0} };
ARGPARSE_ARGS pargs = { &argc, &argv, 0 }
while( ArgParse( &pargs, &opts) ) {
switch( pargs.r_opt ) {
case 'v': opt.verbose++; break;
case 'd': opt.debug++; break;
case 'o': opt.outfile = pargs.r.ret_str; break;
case 'c': opt.crf = pargs.r_type? pargs.r.ret_str:"a.crf"; break;
case 'm': opt.myopt = pargs.r_type? pargs.r.ret_int : 1; break;
case 500: opt.a_long_one++; break
default : pargs.err = 1; break; /* force warning output */
}
}
if( argc > 1 )
log_fatal( "Too many args");
#endif /*DOCUMENTATION*/
/*********************************
* @Summary arg_parse
* #include <wk/lib.h>
*
* typedef struct {
* char *argc; pointer to argc (value subject to change)
* char ***argv; pointer to argv (value subject to change)
* unsigned flags; Global flags (DO NOT CHANGE)
* int err; print error about last option
* 1 = warning, 2 = abort
* int r_opt; return option
* int r_type; type of return value (0 = no argument found)
* union {
* int ret_int;
* long ret_long
* ulong ret_ulong;
* char *ret_str;
* } r; Return values
* struct {
* int index;
* const char *last;
* } internal; DO NOT CHANGE
* } ARGPARSE_ARGS;
*
* typedef struct {
* int short_opt;
* const char *long_opt;
* unsigned flags;
* } ARGPARSE_OPTS;
*
* int arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts );
*
* @Description
* This is my replacement for getopt(). See the example for a typical usage.
* Global flags are:
* Bit 0 : Do not remove options form argv
* Bit 1 : Do not stop at last option but return other args
* with r_opt set to -1.
* Bit 2 : Assume options and real args are mixed.
* Bit 3 : Do not use -- to stop option processing.
* Bit 4 : Do not skip the first arg.
* Bit 5 : allow usage of long option with only one dash
* all other bits must be set to zero, this value is modified by the function
* so assume this is write only.
* Local flags (for each option):
* Bit 2-0 : 0 = does not take an argument
* 1 = takes int argument
* 2 = takes string argument
* 3 = takes long argument
* 4 = takes ulong argument
* Bit 3 : argument is optional (r_type will the be set to 0)
* Bit 4 : allow 0x etc. prefixed values.
* If can stop the option processing by setting opts to NULL, the function will
* then return 0.
* @Return Value
* Returns the args.r_opt or 0 if ready
* r_opt may be -2 to indicate an unknown option.
* @See Also
* ArgExpand
* @Notes
* You do not need to process the options 'h', '--help' or '--version'
* because this function includes standard help processing; but if you
* specify '-h', '--help' or '--version' you have to do it yourself.
* The option '--' stops argument processing; if bit 1 is set the function
* continues to return normal arguments.
* To process float args or unsigned args you must use a string args and do
* the conversion yourself.
* @Example
*
* ARGPARSE_OPTS opts[] = {
* { 'v', "verbose", 0 },
* { 'd', "debug", 0 },
* { 'o', "output", 2 },
* { 'c', "cross-ref", 2|8 },
* { 'm', "my-option", 1|8 },
* { 500, "have-no-short-option-for-this-long-option", 0 },
* {0} };
* ARGPARSE_ARGS pargs = { &argc, &argv, 0 }
*
* while( ArgParse( &pargs, &opts) ) {
* switch( pargs.r_opt ) {
* case 'v': opt.verbose++; break;
* case 'd': opt.debug++; break;
* case 'o': opt.outfile = pargs.r.ret_str; break;
* case 'c': opt.crf = pargs.r_type? pargs.r.ret_str:"a.crf"; break;
* case 'm': opt.myopt = pargs.r_type? pargs.r.ret_int : 1; break;
* case 500: opt.a_long_one++; break
* default : pargs.err = 1; break; -- force warning output --
* }
* }
* if( argc > 1 )
* log_fatal( "Too many args");
*
*/
static void set_opt_arg(ARGPARSE_ARGS *arg, unsigned flags, char *s);
@ -394,6 +394,10 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags )
if( flags & 32 )
puts("\n(A single dash may be used instead of the double ones)");
}
if( *(s=strusage(26)) ) { /* bug reports to ... */
putchar('\n');
fputs(s, stdout);
}
fflush(stdout);
exit(0);
}
@ -487,6 +491,7 @@ default_strusage( int level )
case 15: p = "[Untitled]"; break;
case 23: p = "[unknown]"; break;
case 24: p = ""; break;
case 26: p = ""; break;
case 12: p =
"This is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"

View File

@ -249,6 +249,7 @@ iobuf_alloc(int usage, size_t bufsize)
a->d.size = bufsize;
a->no = ++number;
a->subno = 0;
a->opaque = NULL;
return a;
}
@ -280,7 +281,13 @@ iobuf_close( IOBUF a )
int
iobuf_cancel( IOBUF a )
{
/* FIXME: do an unlink if usage is 2 */
const char *s;
if( a->usage == 2 ) {
s = iobuf_get_fname(a);
if( s && *s )
remove(s); /* remove the file. Fixme: this will fail for MSDOZE*/
} /* because the file is still open */
return iobuf_close(a);
}
@ -404,6 +411,7 @@ iobuf_push_filter( IOBUF a,
b->recorder.buf = NULL;
/* make a link from the new stream to the original stream */
a->chain = b;
a->opaque = b->opaque;
/* setup the function on the new stream */
a->filter = f;
@ -733,6 +741,23 @@ iobuf_get_filelength( IOBUF a )
return 0;
}
/****************
* Retrieve the filename
*/
const char *
iobuf_get_fname( IOBUF a )
{
struct stat st;
for( ; a; a = a->chain )
if( !a->chain && a->filter == file_filter ) {
file_filter_ctx_t *b = a->filter_ov;
return b->fname;
}
return NULL;
}
/****************
* Start the block write mode, see rfc1991.new for details.
* A value of 0 for N stops this mode (flushes and writes

View File

@ -25,6 +25,19 @@
#include "util.h"
static char pidstring[15];
void
set_log_pid( int pid )
{
if( pid )
sprintf(pidstring,"[%u]", (unsigned)pid );
else
*pidstring = 0;
}
/****************
* General interface for printing a line
* level 0 := print to /dev/null
@ -62,7 +75,7 @@ log_info( const char *fmt, ... )
{
va_list arg_ptr ;
fprintf(stderr, "info: " ) ;
fprintf(stderr, "info%s: ", pidstring ) ;
va_start( arg_ptr, fmt ) ;
vfprintf(stderr,fmt,arg_ptr) ;
va_end(arg_ptr);
@ -73,7 +86,7 @@ log_error( const char *fmt, ... )
{
va_list arg_ptr ;
fprintf(stderr, "error: " ) ;
fprintf(stderr, "error%s: ", pidstring ) ;
va_start( arg_ptr, fmt ) ;
vfprintf(stderr,fmt,arg_ptr) ;
va_end(arg_ptr);
@ -84,7 +97,7 @@ log_fatal( const char *fmt, ... )
{
va_list arg_ptr ;
fprintf(stderr, "Fatal: " ) ;
fprintf(stderr, "Fatal%s: ", pidstring ) ;
va_start( arg_ptr, fmt ) ;
vfprintf(stderr,fmt,arg_ptr) ;
va_end(arg_ptr);
@ -96,7 +109,7 @@ log_bug( const char *fmt, ... )
{
va_list arg_ptr ;
fprintf(stderr, "\nInternal Error: " ) ;
fprintf(stderr, "\nInternal Error%s: ", pidstring ) ;
va_start( arg_ptr, fmt ) ;
vfprintf(stderr,fmt,arg_ptr) ;
va_end(arg_ptr);
@ -109,7 +122,7 @@ log_debug( const char *fmt, ... )
{
va_list arg_ptr ;
fprintf(stderr, "DBG: " ) ;
fprintf(stderr, "DBG%s: ", pidstring ) ;
va_start( arg_ptr, fmt ) ;
vfprintf(stderr,fmt,arg_ptr) ;
va_end(arg_ptr);
@ -122,7 +135,7 @@ log_hexdump( const char *text, char *buf, size_t len )
{
int i;
fprintf(stderr, "DBG: %s", text );
fprintf(stderr, "DBG%s: %s", pidstring, text );
for(i=0; i < len; i++ )
fprintf(stderr, " %02X", ((byte*)buf)[i] );
fputc('\n', stderr);
@ -132,7 +145,7 @@ log_hexdump( const char *text, char *buf, size_t len )
void
log_mpidump( const char *text, MPI a )
{
fprintf(stderr, "DBG: %s", text );
fprintf(stderr, "DBG%s: %s", pidstring, text );
mpi_print(stderr, a, 1 );
fputc('\n', stderr);
}