aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cipher/ChangeLog5
-rw-r--r--cipher/cipher.c17
2 files changed, 17 insertions, 5 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 269d67d23..8b9306b8b 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,8 @@
+2002-08-12 Werner Koch <[email protected]>
+
+ * cipher.c: Include the DUMMY cipher only when the new ALLOW_DUMMY
+ is defined. It should only be defined for hard core debugging.
+
2002-08-08 David Shaw <[email protected]>
* Makefile.am, md.c (load_digest_module): Allow switching TIGER on
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 1924dcf16..6a545db78 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -29,6 +29,10 @@
#include "cipher.h"
#include "algorithms.h"
+/* We have support for a DUMMY encryption cipher which comes handy to
+ debug MDCs and similar things. Because this is a bit dangerous it
+ is not enabled. */
+/*#define ALLOW_DUMMY 1 */
#define MAX_BLOCKSIZE 16
#define TABLE_SIZE 14
@@ -62,13 +66,16 @@ struct cipher_handle_s {
};
-#ifdef IS_DEVELOPMENT_VERSION
+#ifdef ALLOW_DUMMY
static int
dummy_setkey( void *c, byte *key, unsigned keylen ) { return 0; }
static void
dummy_encrypt_block( void *c, byte *outbuf, byte *inbuf ) { BUG(); }
static void
dummy_decrypt_block( void *c, byte *outbuf, byte *inbuf ) { BUG(); }
+#ifdef __GNUC__
+# warning DUMMY cipher module is enabled
+#endif
#endif
@@ -170,7 +177,7 @@ setup_cipher_table(void)
if (cipher_table[i].name)
i++; /* Note that IDEA is usually no available. */
-#ifdef IS_DEVELOPMENT_VERSION
+#ifdef ALLOW_DUMMY
cipher_table[i].algo = CIPHER_ALGO_DUMMY;
cipher_table[i].name = "DUMMY";
cipher_table[i].blocksize = 8;
@@ -379,7 +386,7 @@ cipher_open( int algo, int mode, int secure )
else
hd->mode = mode;
-#ifdef IS_DEVELOPMENT_VERSION
+#ifdef ALLOW_DUMMY
if( algo == CIPHER_ALGO_DUMMY )
hd->mode = CIPHER_MODE_DUMMY;
#endif
@@ -611,7 +618,7 @@ cipher_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes )
case CIPHER_MODE_PHILS_CFB:
do_cfb_encrypt(c, outbuf, inbuf, nbytes );
break;
-#ifdef IS_DEVELOPMENT_VERSION
+#ifdef ALLOW_DUMMY
case CIPHER_MODE_DUMMY:
if( inbuf != outbuf )
memmove( outbuf, inbuf, nbytes );
@@ -643,7 +650,7 @@ cipher_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes )
case CIPHER_MODE_PHILS_CFB:
do_cfb_decrypt(c, outbuf, inbuf, nbytes );
break;
-#ifdef IS_DEVELOPMENT_VERSION
+#ifdef ALLOW_DUMMY
case CIPHER_MODE_DUMMY:
if( inbuf != outbuf )
memmove( outbuf, inbuf, nbytes );