diff options
author | Werner Koch <wk@gnupg.org> | 1999-02-16 13:16:30 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-02-16 13:16:30 +0000 |
commit | 788077d888e7b95448ed8c1a84d7e5d6b9244d9f (patch) | |
tree | 413375191713a0e35c0f60b9c6bb669327060057 /cipher | |
parent | f5a7426be64684b9eaa6b2c1506374b3efc88aca (diff) | |
download | libgcrypt-788077d888e7b95448ed8c1a84d7e5d6b9244d9f.tar.gz |
See ChangeLog: Tue Feb 16 14:10:02 CET 1999 Werner Koch
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/blowfish.c | 2 | ||||
-rw-r--r-- | cipher/blowfish.h | 6 | ||||
-rw-r--r-- | cipher/cast5.c | 2 | ||||
-rw-r--r-- | cipher/cast5.h | 6 | ||||
-rw-r--r-- | cipher/cipher.c | 4 | ||||
-rw-r--r-- | cipher/des.h | 6 | ||||
-rw-r--r-- | cipher/dsa.c | 6 | ||||
-rw-r--r-- | cipher/dsa.h | 2 | ||||
-rw-r--r-- | cipher/dynload.c | 32 | ||||
-rw-r--r-- | cipher/dynload.h | 12 | ||||
-rw-r--r-- | cipher/elgamal.c | 14 | ||||
-rw-r--r-- | cipher/elgamal.h | 2 | ||||
-rw-r--r-- | cipher/md.c | 6 | ||||
-rw-r--r-- | cipher/pubkey.c | 26 | ||||
-rw-r--r-- | cipher/random.c | 2 | ||||
-rw-r--r-- | cipher/rndunix.c | 5 |
16 files changed, 65 insertions, 68 deletions
diff --git a/cipher/blowfish.c b/cipher/blowfish.c index 8cffa8b3..8bfce67c 100644 --- a/cipher/blowfish.c +++ b/cipher/blowfish.c @@ -455,7 +455,7 @@ decrypt_block( BLOWFISH_context *bc, byte *outbuf, byte *inbuf ) static const char* -selftest() +selftest(void) { BLOWFISH_context c; byte plain[] = "BLOWFISH"; diff --git a/cipher/blowfish.h b/cipher/blowfish.h index b1d65f36..827baa14 100644 --- a/cipher/blowfish.h +++ b/cipher/blowfish.h @@ -26,9 +26,9 @@ const char * blowfish_get_info( int algo, size_t *keylen, size_t *blocksize, size_t *contextsize, - int (**setkey)( void *c, byte *key, unsigned keylen ), - void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), - void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) + int (**setkeyf)( void *c, byte *key, unsigned keylen ), + void (**encryptf)( void *c, byte *outbuf, byte *inbuf ), + void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) ); #endif /*G10_BLOWFISH_H*/ diff --git a/cipher/cast5.c b/cipher/cast5.c index 6f131ca2..0e602bd2 100644 --- a/cipher/cast5.c +++ b/cipher/cast5.c @@ -455,7 +455,7 @@ decrypt_block( CAST5_context *c, byte *outbuf, byte *inbuf ) static const char* -selftest() +selftest(void) { CAST5_context c; byte key[16] = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, diff --git a/cipher/cast5.h b/cipher/cast5.h index df7f1651..798eaa23 100644 --- a/cipher/cast5.h +++ b/cipher/cast5.h @@ -25,9 +25,9 @@ const char * cast5_get_info( int algo, size_t *keylen, size_t *blocksize, size_t *contextsize, - int (**setkey)( void *c, byte *key, unsigned keylen ), - void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), - void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) + int (**setkeyf)( void *c, byte *key, unsigned keylen ), + void (**encryptf)( void *c, byte *outbuf, byte *inbuf ), + void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) ); #endif /*G10_CAST5_H*/ diff --git a/cipher/cipher.c b/cipher/cipher.c index 37d60251..601165b7 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -77,7 +77,7 @@ dummy_decrypt_block( void *c, byte *outbuf, byte *inbuf ) { BUG(); } * Put the static entries into the table. */ static void -setup_cipher_table() +setup_cipher_table(void) { int i; @@ -146,7 +146,7 @@ setup_cipher_table() * Try to load all modules and return true if new modules are available */ static int -load_cipher_modules() +load_cipher_modules(void) { static int done = 0; static int initialized = 0; diff --git a/cipher/des.h b/cipher/des.h index cf2f320d..f6856068 100644 --- a/cipher/des.h +++ b/cipher/des.h @@ -26,9 +26,9 @@ const char * des_get_info( int algo, size_t *keylen, size_t *blocksize, size_t *contextsize, - int (**setkey)( void *c, byte *key, unsigned keylen ), - void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), - void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) + int (**setkeyf)( void *c, byte *key, unsigned keylen ), + void (**encryptf)( void *c, byte *outbuf, byte *inbuf ), + void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) ); #endif /*G10_DES_H*/ diff --git a/cipher/dsa.c b/cipher/dsa.c index 7222df33..c8fcd66e 100644 --- a/cipher/dsa.c +++ b/cipher/dsa.c @@ -412,7 +412,7 @@ dsa_get_nbits( int algo, MPI *pkey ) */ const char * dsa_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig, - int *usage ) + int *use ) { *npkey = 4; *nskey = 5; @@ -420,8 +420,8 @@ dsa_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig, *nsig = 2; switch( algo ) { - case PUBKEY_ALGO_DSA: *usage = PUBKEY_USAGE_SIG; return "DSA"; - default: *usage = 0; return NULL; + case PUBKEY_ALGO_DSA: *use = PUBKEY_USAGE_SIG; return "DSA"; + default: *use = 0; return NULL; } } diff --git a/cipher/dsa.h b/cipher/dsa.h index e5bc8c7b..1456d65b 100644 --- a/cipher/dsa.h +++ b/cipher/dsa.h @@ -27,6 +27,6 @@ int dsa_verify( int algo, MPI hash, MPI *data, MPI *pkey, int (*cmp)(void *, MPI), void *opaquev ); unsigned dsa_get_nbits( int algo, MPI *pkey ); const char *dsa_get_info( int algo, int *npkey, int *nskey, - int *nenc, int *nsig, int *usage ); + int *nenc, int *nsig, int *use ); #endif /*G10_DSA_H*/ diff --git a/cipher/dynload.c b/cipher/dynload.c index b8c7c67d..75dcb396 100644 --- a/cipher/dynload.c +++ b/cipher/dynload.c @@ -101,15 +101,15 @@ register_cipher_extension( const char *mainpgm, const char *fname ) mainpgm_path = m_strdup(mainpgm); #endif if( *fname != '/' ) { /* do tilde expansion etc */ - char *p ; + char *tmp; if( strchr(fname, '/') ) - p = make_filename(fname, NULL); + tmp = make_filename(fname, NULL); else - p = make_filename(GNUPG_LIBDIR, fname, NULL); - el = m_alloc_clear( sizeof *el + strlen(p) ); - strcpy(el->name, p ); - m_free(p); + tmp = make_filename(GNUPG_LIBDIR, fname, NULL); + el = m_alloc_clear( sizeof *el + strlen(tmp) ); + strcpy(el->name, tmp ); + m_free(tmp); } else { el = m_alloc_clear( sizeof *el + strlen(fname) ); @@ -371,9 +371,9 @@ enum_gnupgext_digests( void **enum_context, const char * enum_gnupgext_ciphers( void **enum_context, int *algo, size_t *keylen, size_t *blocksize, size_t *contextsize, - int (**setkey)( void *c, byte *key, unsigned keylen ), - void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), - void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) + int (**setkeyf)( void *c, byte *key, unsigned keylen ), + void (**encryptf)( void *c, byte *outbuf, byte *inbuf ), + void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) ) { EXTLIST r; @@ -419,7 +419,7 @@ enum_gnupgext_ciphers( void **enum_context, int *algo, continue; *algo = *(int*)sym; algname = (*finfo)( *algo, keylen, blocksize, contextsize, - setkey, encrypt, decrypt ); + setkeyf, encryptf, decryptf ); if( algname ) { ctx->r = r; return algname; @@ -435,11 +435,11 @@ enum_gnupgext_ciphers( void **enum_context, int *algo, const char * enum_gnupgext_pubkeys( void **enum_context, int *algo, - int *npkey, int *nskey, int *nenc, int *nsig, int *usage, + int *npkey, int *nskey, int *nenc, int *nsig, int *use, int (**generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ), int (**check_secret_key)( int algo, MPI *skey ), - int (**encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ), - int (**decrypt)( int algo, MPI *result, MPI *data, MPI *skey ), + int (**encryptf)( int algo, MPI *resarr, MPI data, MPI *pkey ), + int (**decryptf)( int algo, MPI *result, MPI *data, MPI *skey ), int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ), int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey, int (*cmp)(void *, MPI), void *opaquev ), @@ -491,9 +491,9 @@ enum_gnupgext_pubkeys( void **enum_context, int *algo, if( vers != 1 || class != 31 ) continue; *algo = *(int*)sym; - algname = (*finfo)( *algo, npkey, nskey, nenc, nsig, usage, - generate, check_secret_key, encrypt, - decrypt, sign, verify, get_nbits ); + algname = (*finfo)( *algo, npkey, nskey, nenc, nsig, use, + generate, check_secret_key, encryptf, + decryptf, sign, verify, get_nbits ); if( algname ) { ctx->r = r; return algname; diff --git a/cipher/dynload.h b/cipher/dynload.h index 792531cf..af894071 100644 --- a/cipher/dynload.h +++ b/cipher/dynload.h @@ -37,19 +37,19 @@ enum_gnupgext_digests( void **enum_context, const char * enum_gnupgext_ciphers( void **enum_context, int *algo, size_t *keylen, size_t *blocksize, size_t *contextsize, - int (**setkey)( void *c, byte *key, unsigned keylen ), - void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), - void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) + int (**setkeyf)( void *c, byte *key, unsigned keylen ), + void (**encryptf)( void *c, byte *outbuf, byte *inbuf ), + void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) ); const char * enum_gnupgext_pubkeys( void **enum_context, int *algo, - int *npkey, int *nskey, int *nenc, int *nsig, int *usage, + int *npkey, int *nskey, int *nenc, int *nsig, int *use, int (**generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ), int (**check_secret_key)( int algo, MPI *skey ), - int (**encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ), - int (**decrypt)( int algo, MPI *result, MPI *data, MPI *skey ), + int (**encryptf)( int algo, MPI *resarr, MPI data, MPI *pkey ), + int (**decryptf)( int algo, MPI *result, MPI *data, MPI *skey ), int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ), int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey, int (*cmp)(void *, MPI), void *opaquev ), diff --git a/cipher/elgamal.c b/cipher/elgamal.c index 9a9b3562..90d5aca1 100644 --- a/cipher/elgamal.c +++ b/cipher/elgamal.c @@ -109,9 +109,9 @@ gen_k( MPI p ) for(;;) { if( DBG_CIPHER ) fputc('.', stderr); - { char *p = get_random_bits( nbits, 1, 1 ); - mpi_set_buffer( k, p, (nbits+7)/8, 0 ); - m_free(p); + { char *pp = get_random_bits( nbits, 1, 1 ); + mpi_set_buffer( k, pp, (nbits+7)/8, 0 ); + m_free(pp); /* make sure that the number is of the exact lenght */ if( mpi_test_bit( k, nbits-1 ) ) mpi_set_highbit( k, nbits-1 ); @@ -530,7 +530,7 @@ elg_get_nbits( int algo, MPI *pkey ) */ const char * elg_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig, - int *usage ) + int *use ) { *npkey = 3; *nskey = 4; @@ -539,12 +539,12 @@ elg_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig, switch( algo ) { case PUBKEY_ALGO_ELGAMAL: - *usage = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC; + *use = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC; return "ELG"; case PUBKEY_ALGO_ELGAMAL_E: - *usage = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC; + *use = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC; return "ELG-E"; - default: *usage = 0; return NULL; + default: *use = 0; return NULL; } } diff --git a/cipher/elgamal.h b/cipher/elgamal.h index ac708a9b..f104c2a5 100644 --- a/cipher/elgamal.h +++ b/cipher/elgamal.h @@ -29,7 +29,7 @@ int elg_verify( int algo, MPI hash, MPI *data, MPI *pkey, int (*cmp)(void *, MPI), void *opaquev ); unsigned elg_get_nbits( int algo, MPI *pkey ); const char *elg_get_info( int algo, int *npkey, int *nskey, - int *nenc, int *nsig, int *usage ); + int *nenc, int *nsig, int *use ); #endif /*G10_ELGAMAL_H*/ diff --git a/cipher/md.c b/cipher/md.c index 6c4d1124..95167ff4 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -479,15 +479,15 @@ md_asn_oid( int algo, size_t *asnlen, size_t *mdlen ) void md_start_debug( MD_HANDLE md, const char *suffix ) { - static int index=0; + static int idx=0; char buf[25]; if( md->debug ) { log_debug("Oops: md debug already started\n"); return; } - index++; - sprintf(buf, "dbgmd-%05d.%.10s", index, suffix ); + idx++; + sprintf(buf, "dbgmd-%05d.%.10s", idx, suffix ); md->debug = fopen(buf, "w"); if( !md->debug ) log_debug("md debug: can't open %s\n", buf ); diff --git a/cipher/pubkey.c b/cipher/pubkey.c index 58ba0000..dbdd8ae2 100644 --- a/cipher/pubkey.c +++ b/cipher/pubkey.c @@ -42,7 +42,7 @@ struct pubkey_table_s { int nskey; int nenc; int nsig; - int usage; + int use; int (*generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ); int (*check_secret_key)( int algo, MPI *skey ); int (*encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ); @@ -91,7 +91,7 @@ dummy_get_nbits( int algo, MPI *pkey ) * Put the static entries into the table. */ static void -setup_pubkey_table() +setup_pubkey_table(void) { int i; @@ -102,7 +102,7 @@ setup_pubkey_table() &pubkey_table[i].nskey, &pubkey_table[i].nenc, &pubkey_table[i].nsig, - &pubkey_table[i].usage ); + &pubkey_table[i].use ); pubkey_table[i].generate = elg_generate; pubkey_table[i].check_secret_key = elg_check_secret_key; pubkey_table[i].encrypt = elg_encrypt; @@ -119,7 +119,7 @@ setup_pubkey_table() &pubkey_table[i].nskey, &pubkey_table[i].nenc, &pubkey_table[i].nsig, - &pubkey_table[i].usage ); + &pubkey_table[i].use ); pubkey_table[i].generate = elg_generate; pubkey_table[i].check_secret_key = elg_check_secret_key; pubkey_table[i].encrypt = elg_encrypt; @@ -136,7 +136,7 @@ setup_pubkey_table() &pubkey_table[i].nskey, &pubkey_table[i].nenc, &pubkey_table[i].nsig, - &pubkey_table[i].usage ); + &pubkey_table[i].use ); pubkey_table[i].generate = dsa_generate; pubkey_table[i].check_secret_key = dsa_check_secret_key; pubkey_table[i].encrypt = dummy_encrypt; @@ -157,7 +157,7 @@ setup_pubkey_table() * Try to load all modules and return true if new modules are available */ static int -load_pubkey_modules() +load_pubkey_modules(void) { static int initialized = 0; static int done = 0; @@ -187,7 +187,7 @@ load_pubkey_modules() /* now load all extensions */ while( (name = enum_gnupgext_pubkeys( &context, &ct->algo, &ct->npkey, &ct->nskey, &ct->nenc, - &ct->nsig, &ct->usage, + &ct->nsig, &ct->use, &ct->generate, &ct->check_secret_key, &ct->encrypt, @@ -273,21 +273,21 @@ check_pubkey_algo( int algo ) } /**************** - * a usage of 0 means: don't care + * a use of 0 means: don't care */ int -check_pubkey_algo2( int algo, unsigned usage ) +check_pubkey_algo2( int algo, unsigned use ) { int i; do { for(i=0; pubkey_table[i].name; i++ ) if( pubkey_table[i].algo == algo ) { - if( (usage & PUBKEY_USAGE_SIG) - && !(pubkey_table[i].usage & PUBKEY_USAGE_SIG) ) + if( (use & PUBKEY_USAGE_SIG) + && !(pubkey_table[i].use & PUBKEY_USAGE_SIG) ) return G10ERR_WR_PUBKEY_ALGO; - if( (usage & PUBKEY_USAGE_ENC) - && !(pubkey_table[i].usage & PUBKEY_USAGE_ENC) ) + if( (use & PUBKEY_USAGE_ENC) + && !(pubkey_table[i].use & PUBKEY_USAGE_ENC) ) return G10ERR_WR_PUBKEY_ALGO; return 0; /* okay */ } diff --git a/cipher/random.c b/cipher/random.c index bcd017d4..eedfcfa6 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -106,7 +106,7 @@ static int gather_faked( void (*add)(const void*, size_t, int), int requester, static void -initialize() +initialize(void) { /* The data buffer is allocated somewhat larger, so that * we can use this extra space (which is allocated in secure memory) diff --git a/cipher/rndunix.c b/cipher/rndunix.c index 0132cd90..b7381a55 100644 --- a/cipher/rndunix.c +++ b/cipher/rndunix.c @@ -401,11 +401,8 @@ slow_poll(FILE *dbgfp, int dbgall, size_t *nbytes ) fd_set fds; #if defined( __hpux ) size_t maxFD = 0; - int pageSize = 4096; /* PHUX doesn't have getpagesize() */ - #elif defined( _M_XENIX ) || defined( __aux ) - int maxFD = 0, pageSize = 4096;/* Nor do others, but they get fd right */ #else - int maxFD = 0, pageSize = getpagesize(); + int maxFD = 0; #endif /* OS-specific brokenness */ int bufPos, i, usefulness = 0; |