From d7a28c72a893041f8c8e7b523096601bfdb85fb7 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Tue, 30 Dec 2003 00:57:05 +0000 Subject: [PATCH] * rijndael.c, rndunix.c, twofish.c: Remove dead IS_MODULE code. * g10c.c: Dead code. Remove. * Makefile.am: Don't compile g10c.c. --- cipher/ChangeLog | 8 +++++ cipher/Makefile.am | 1 - cipher/g10c.c | 46 ----------------------------- cipher/rijndael.c | 70 +------------------------------------------- cipher/rndunix.c | 2 -- cipher/twofish.c | 73 +--------------------------------------------- 6 files changed, 10 insertions(+), 190 deletions(-) delete mode 100644 cipher/g10c.c diff --git a/cipher/ChangeLog b/cipher/ChangeLog index beda87731..2fc464505 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,11 @@ +2003-12-29 David Shaw + + * rijndael.c, rndunix.c, twofish.c: Remove dead IS_MODULE code. + + * g10c.c: Dead code. Remove. + + * Makefile.am: Don't compile g10c.c. + 2003-12-28 Stefan Bellon * rndriscos.c (rndriscos_gather_random) [__riscos__]: Declare diff --git a/cipher/Makefile.am b/cipher/Makefile.am index def6c36af..85b0a47dd 100644 --- a/cipher/Makefile.am +++ b/cipher/Makefile.am @@ -42,7 +42,6 @@ libcipher_a_SOURCES = cipher.c \ rmd.h \ dsa.h \ dsa.c \ - g10c.c \ smallprime.c \ algorithms.h \ rndlinux.c \ diff --git a/cipher/g10c.c b/cipher/g10c.c deleted file mode 100644 index 7b0f4fa61..000000000 --- a/cipher/g10c.c +++ /dev/null @@ -1,46 +0,0 @@ -/* g10c.c - Wrapper for cipher functions - * Copyright (C) 1998, 1999 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 - */ - -#include -#include -#include -#include "mpi.h" -#include "random.h" -#include "cipher.h" - - -/* FIXME: The modules should use functions from libgcrypt */ - - -const char *g10c_revision_string(int dummy) { return "$Revision$"; } - -MPI -g10c_generate_secret_prime( unsigned nbits ) -{ - return generate_secret_prime( nbits ); -} - - -char * -g10c_get_random_bits( unsigned nbits, int level, int secure ) -{ - return (char*)get_random_bits( nbits, level, secure ); -} - diff --git a/cipher/rijndael.c b/cipher/rijndael.c index c9eecbe95..f7b678f4d 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -2128,10 +2128,7 @@ selftest (void) return NULL; } -#ifdef IS_MODULE -static -#endif - const char * +const char * rijndael_get_info (int algo, size_t *keylen, size_t *blocksize, size_t *contextsize, int (**r_setkey) (void *c, byte *key, unsigned keylen), @@ -2158,68 +2155,3 @@ rijndael_get_info (int algo, size_t *keylen, return "AES256"; return NULL; } - - -#ifdef IS_MODULE -static -const char * const gnupgext_version = "RIJNDAEL ($Revision$)"; - -static struct { - int class; - int version; - int value; - void (*func)(void); -} func_table[] = { - { 20, 1, 0, (void(*)(void))rijndael_get_info }, - { 21, 1, 7 }, - { 21, 1, 8 }, - { 21, 1, 9 }, -}; - - - -/**************** - * Enumerate the names of the functions together with information about - * this function. Set sequence to an integer with a initial value of 0 and - * do not change it. - * If what is 0 all kind of functions are returned. - * Return values: class := class of function: - * 10 = message digest algorithm info function - * 11 = integer with available md algorithms - * 20 = cipher algorithm info function - * 21 = integer with available cipher algorithms - * 30 = public key algorithm info function - * 31 = integer with available pubkey algorithms - * version = interface version of the function/pointer - * (currently this is 1 for all functions) - */ -static -void * -gnupgext_enum_func ( int what, int *sequence, int *class, int *vers ) -{ - void *ret; - int i = *sequence; - - do { - if ( i >= DIM(func_table) || i < 0 ) { - return NULL; - } - *class = func_table[i].class; - *vers = func_table[i].version; - switch( *class ) { - case 11: - case 21: - case 31: - ret = &func_table[i].value; - break; - default: - ret = func_table[i].func; - break; - } - i++; - } while ( what && what != *class ); - - *sequence = i; - return ret; -} -#endif diff --git a/cipher/rndunix.c b/cipher/rndunix.c index 7156c739c..a07fde325 100644 --- a/cipher/rndunix.c +++ b/cipher/rndunix.c @@ -100,9 +100,7 @@ #include #include "types.h" /* for byte and u32 typedefs */ -#ifndef IS_MODULE #include "algorithms.h" -#endif #include "util.h" #ifndef EAGAIN diff --git a/cipher/twofish.c b/cipher/twofish.c index 554b4aa3e..5026f0305 100644 --- a/cipher/twofish.c +++ b/cipher/twofish.c @@ -557,7 +557,6 @@ burn_stack (int bytes) } - /* Perform the key setup. Note that this works only with 128- and 256-bit * keys, despite the API that looks like it might support other sizes. */ @@ -1010,10 +1009,7 @@ main() #endif /* TEST */ -#ifdef IS_MODULE -static -#endif - const char * +const char * twofish_get_info (int algo, size_t *keylen, size_t *blocksize, size_t *contextsize, int (**r_setkey) (void *c, byte *key, unsigned keylen), @@ -1039,70 +1035,3 @@ twofish_get_info (int algo, size_t *keylen, return "TWOFISH128"; return NULL; } - - -#ifdef IS_MODULE -static -const char * const gnupgext_version = "TWOFISH ($Revision$)"; - -static struct { - int class; - int version; - int value; - void (*func)(void); -} func_table[] = { - { 20, 1, 0, (void(*)(void))twofish_get_info }, - { 21, 1, 10 }, - { 21, 1, 102 }, -}; - - - -/**************** - * Enumerate the names of the functions together with information about - * this function. Set sequence to an integer with a initial value of 0 and - * do not change it. - * If what is 0 all kind of functions are returned. - * Return values: class := class of function: - * 10 = message digest algorithm info function - * 11 = integer with available md algorithms - * 20 = cipher algorithm info function - * 21 = integer with available cipher algorithms - * 30 = public key algorithm info function - * 31 = integer with available pubkey algorithms - * version = interface version of the function/pointer - * (currently this is 1 for all functions) - */ -static void * -gnupgext_enum_func ( int what, int *sequence, int *class, int *vers ) -{ - void *ret; - int i = *sequence; - - do { - if ( i >= DIM(func_table) || i < 0 ) { - return NULL; - } - *class = func_table[i].class; - *vers = func_table[i].version; - switch( *class ) { - case 11: - case 21: - case 31: - ret = &func_table[i].value; - break; - default: -#ifndef __riscos__ - ret = func_table[i].func; -#else /* __riscos__ */ - ret = (void *) func_table[i].func; -#endif /* __riscos__ */ - break; - } - i++; - } while ( what && what != *class ); - - *sequence = i; - return ret; -} -#endif