From ed3609258828942808702a07ef2986d7328efa3f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 12 Jan 1998 10:18:17 +0000 Subject: started with trust stuff --- include/cipher.h | 34 +--------------------------------- include/errors.h | 1 + include/mpi.h | 26 +++++--------------------- 3 files changed, 7 insertions(+), 54 deletions(-) (limited to 'include') diff --git a/include/cipher.h b/include/cipher.h index fd7886c90..1f615e54d 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -28,9 +28,7 @@ #define DBG_CIPHER cipher_debug_mode #include "mpi.h" -#include "../cipher/md5.h" -#include "../cipher/rmd.h" -#include "../cipher/sha1.h" +#include "../cipher/md.h" #ifdef HAVE_RSA_CIPHER #include "../cipher/rsa.h" #endif @@ -67,26 +65,9 @@ typedef struct { byte key[20]; /* this is the largest used keylen */ } DEK; -typedef struct { - int algo; /* digest algo */ - union { - MD5HANDLE md5; - RMDHANDLE rmd; - SHA1HANDLE sha1; - } u; - int datalen; - char data[1]; -} MD_HANDLE; - int cipher_debug_mode; -#ifdef HAVE_RSA_CIPHER - #define is_valid_pubkey_algo(a) ( (a) == PUBKEY_ALGO_ELGAMAL \ - || (a) == PUBKEY_ALGO_RSA ) -#else - #define is_valid_pubkey_algo(a) ( (a) == PUBKEY_ALGO_ELGAMAL ) -#endif /*-- misc.c --*/ int string_to_cipher_algo( const char *string ); @@ -96,19 +77,6 @@ int check_cipher_algo( int algo ); int check_pubkey_algo( int algo ); int check_digest_algo( int algo ); -/*-- md.c --*/ -int md_okay( int algo ); -MD_HANDLE *md_open( int algo, int secure ); -MD_HANDLE *md_copy( MD_HANDLE *a ); -MD_HANDLE *md_makecontainer( int algo ); /* used for a bad kludge */ -void md_write( MD_HANDLE *a, byte *inbuf, size_t inlen); -void md_putchar( MD_HANDLE *a, int c ); -byte *md_final(MD_HANDLE *a); -void md_close(MD_HANDLE *a); - -MD_HANDLE *md5_copy2md( MD5HANDLE a ); /* (in md5.c) */ -MD_HANDLE *rmd160_copy2md( RMDHANDLE a ); /* (in rmd160.c) */ - /*-- random.c --*/ void randomize_buffer( byte *buffer, size_t length, int level ); byte get_random_byte( int level ); diff --git a/include/errors.h b/include/errors.h index 9679e9153..450d910cf 100644 --- a/include/errors.h +++ b/include/errors.h @@ -52,5 +52,6 @@ #define G10ERR_BAD_MPI 30 #define G10ERR_RESOURCE_LIMIT 31 #define G10ERR_INV_KEYRING 32 +#define G10ERR_TRUSTDB 33 /* a problem with the trustdb */ #endif /*G10_ERRORS_H*/ diff --git a/include/mpi.h b/include/mpi.h index 4e25ab201..7c4639f18 100644 --- a/include/mpi.h +++ b/include/mpi.h @@ -39,27 +39,11 @@ #define DBG_MPI mpi_debug_mode int mpi_debug_mode; -#if defined(__i386__) - #define BITS_PER_MPI_LIMB 32 - #define BYTES_PER_MPI_LIMB 4 - #define BYTES_PER_MPI_LIMB2 8 - typedef unsigned long int mpi_limb_t; - typedef signed long int mpi_limb_signed_t; -#elif defined(__hppa__) - #define BITS_PER_MPI_LIMB 32 - #define BYTES_PER_MPI_LIMB 4 - #define BYTES_PER_MPI_LIMB2 8 - typedef unsigned long int mpi_limb_t; - typedef signed long int mpi_limb_signed_t; -#elif defined(__alpha__) - #define BITS_PER_MPI_LIMB 64 - #define BYTES_PER_MPI_LIMB 8 - #define BYTES_PER_MPI_LIMB2 16 - typedef unsigned long int mpi_limb_t; - typedef signed long int mpi_limb_signed_t; -#else - #error add definions for this machine here -#endif +#define BITS_PER_MPI_LIMB (8*SIZEOF_UNSIGNED_LONG) +#define BYTES_PER_MPI_LIMB SIZEOF_UNSIGNED_LONG +#define BYTES_PER_MPI_LIMB2 (2*SIZEOF_UNSIGNED_LONG) +typedef unsigned long int mpi_limb_t; +typedef signed long int mpi_limb_signed_t; typedef struct mpi_struct { int alloced; /* array size (# of allocated limbs) */ -- cgit v1.2.3