1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

added option file handling

This commit is contained in:
Werner Koch 1997-12-12 12:03:58 +00:00
parent 935965049d
commit 68ea0f4353
38 changed files with 2772 additions and 551 deletions

View file

@ -30,6 +30,7 @@
#include "mpi.h"
#include "../cipher/md5.h"
#include "../cipher/rmd.h"
#include "../cipher/sha1.h"
#ifdef HAVE_RSA_CIPHER
#include "../cipher/rsa.h"
#endif
@ -71,6 +72,7 @@ typedef struct {
union {
MD5HANDLE md5;
RMDHANDLE rmd;
SHA1HANDLE sha1;
} u;
int datalen;
char data[1];

View file

@ -50,5 +50,7 @@
#define G10ERR_NI_CIPHER 28
#define G10ERR_SIG_CLASS 29
#define G10ERR_BAD_MPI 30
#define G10ERR_RESOURCE_LIMIT 31
#define G10ERR_INV_KEYRING 32
#endif /*G10_ERRORS_H*/

View file

@ -39,18 +39,14 @@ typedef struct iobuf_struct *IOBUF;
struct iobuf_struct {
int usage; /* 1 input , 2 output, 3 temp */
unsigned long nlimit;
unsigned long nbytes;
unsigned long nbytes; /* used together with nlimit */
unsigned long ntotal; /* total bytes read (position of stream) */
struct {
size_t size; /* allocated size */
size_t start; /* number of invalid bytes at the begin of the buffer */
size_t len; /* currently filled to this size */
byte *buf;
} d;
struct {
size_t size;
size_t len;
char *buf;
} recorder;
int filter_eof;
int (*filter)( void *opaque, int control,
IOBUF chain, byte *buf, size_t *len);
@ -80,6 +76,9 @@ void iobuf_clear_eof(IOBUF a);
void iobuf_set_limit( IOBUF a, unsigned long nlimit );
ulong iobuf_tell( IOBUF a );
int iobuf_seek( IOBUF a, ulong newpos );
int iobuf_readbyte(IOBUF a);
int iobuf_writebyte(IOBUF a, unsigned c);
int iobuf_write(IOBUF a, byte *buf, unsigned buflen );
@ -88,10 +87,6 @@ int iobuf_writestr(IOBUF a, const char *buf );
int iobuf_write_temp( IOBUF a, IOBUF temp );
size_t iobuf_temp_to_buffer( IOBUF a, byte *buffer, size_t buflen );
void iobuf_start_recorder( IOBUF a );
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 );
@ -104,8 +99,7 @@ int iobuf_in_block_mode( IOBUF a );
* returned value to be in the range 0 ..255.
*/
#define iobuf_get(a) \
( ((a)->recorder.buf || (a)->nlimit \
|| (a)->d.start >= (a)->d.len )? \
( ((a)->nlimit || (a)->d.start >= (a)->d.len )? \
iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
#define iobuf_get_noeof(a) (iobuf_get((a))&0xff)

View file

@ -34,6 +34,7 @@
#define m_free(n) m_debug_free((n), M_DBGINFO(__LINE__) )
#define m_check(n) m_debug_check((n), M_DBGINFO(__LINE__) )
#define m_copy(a) m_debug_copy((a), M_DBGINFO(__LINE__) )
#define m_strdup(a) m_debug_strdup((a), M_DBGINFO(__LINE__) )
void *m_debug_alloc( size_t n, const char *info );
void *m_debug_alloc_clear( size_t n, const char *info );
@ -43,6 +44,7 @@ void *m_debug_realloc( void *a, size_t n, const char *info );
void m_debug_free( void *p, const char *info );
void m_debug_check( const void *a, const char *info );
void *m_debug_copy( const void *a, const char *info );
char *m_debug_strdup( const char *a, const char *info );
#else
void *m_alloc( size_t n );
@ -52,10 +54,10 @@ void *m_alloc_secure_clear( size_t n );
void *m_realloc( void *a, size_t n );
void m_free( void *p );
void m_check( const void *a );
void *m_copy( void *a );
void *m_copy( const void *a );
char *m_strdup( const char * a);
#endif
size_t m_size( const void *a );
int m_is_secure( const void *p );

View file

@ -79,6 +79,7 @@ const char *strusage( int level );
/*-- fileutil.c --*/
char *make_filename( const char *first_part, ... );
/*-- miscutil.c --*/
u32 make_timestamp(void);