aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-04-10 17:25:22 +0000
committerDavid Shaw <[email protected]>2002-04-10 17:25:22 +0000
commitf29240cc2ed4e099100bee449854b46c70c20d0d (patch)
treee95a56df3a850353b5c217473b4be3f59736b1f6
parent* pl.po: Updated. (diff)
downloadgnupg-f29240cc2ed4e099100bee449854b46c70c20d0d.tar.gz
gnupg-f29240cc2ed4e099100bee449854b46c70c20d0d.zip
cipher.c (setup_cipher_table, cipher_open, cipher_encrypt, cipher_decrypt,
dummy_setkey, dummy_encrypt_block, dummy_decrypt_block): the dummy cipher should only be built on development versions.
-rw-r--r--cipher/ChangeLog7
-rw-r--r--cipher/cipher.c20
2 files changed, 23 insertions, 4 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index e2ff61f30..76db76885 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,10 @@
+2002-04-10 David Shaw <[email protected]>
+
+ * cipher.c (setup_cipher_table, cipher_open, cipher_encrypt,
+ cipher_decrypt, dummy_setkey, dummy_encrypt_block,
+ dummy_decrypt_block): the dummy cipher should only be built on
+ development versions.
+
2002-04-06 Werner Koch <[email protected]>
* rijndael.c (rijndael_get_info): We do only support a 128 bit
diff --git a/cipher/cipher.c b/cipher/cipher.c
index d2b4032f2..2744f041a 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -65,13 +65,14 @@ struct cipher_handle_s {
};
+#ifdef IS_DEVELOPMENT_VERSION
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(); }
-
+#endif
/****************
@@ -161,6 +162,8 @@ setup_cipher_table(void)
if( !cipher_table[i].name )
BUG();
i++;
+
+#ifdef IS_DEVELOPMENT_VERSION
cipher_table[i].algo = CIPHER_ALGO_DUMMY;
cipher_table[i].name = "DUMMY";
cipher_table[i].blocksize = 8;
@@ -170,6 +173,7 @@ setup_cipher_table(void)
cipher_table[i].encrypt = dummy_encrypt_block;
cipher_table[i].decrypt = dummy_decrypt_block;
i++;
+#endif
for( ; i < TABLE_SIZE; i++ )
cipher_table[i].name = NULL;
@@ -406,9 +410,8 @@ cipher_open( int algo, int mode, int secure )
hd->setkey = cipher_table[i].setkey;
hd->encrypt = cipher_table[i].encrypt;
hd->decrypt = cipher_table[i].decrypt;
- if( algo == CIPHER_ALGO_DUMMY )
- hd->mode = CIPHER_MODE_DUMMY;
- else if( mode == CIPHER_MODE_AUTO_CFB ) {
+
+ if( mode == CIPHER_MODE_AUTO_CFB ) {
if( algo >= 100 )
hd->mode = CIPHER_MODE_CFB;
else
@@ -417,6 +420,11 @@ cipher_open( int algo, int mode, int secure )
else
hd->mode = mode;
+#ifdef IS_DEVELOPMENT_VERSION
+ if( algo == CIPHER_ALGO_DUMMY )
+ hd->mode = CIPHER_MODE_DUMMY;
+#endif
+
return hd;
}
@@ -644,10 +652,12 @@ 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
case CIPHER_MODE_DUMMY:
if( inbuf != outbuf )
memmove( outbuf, inbuf, nbytes );
break;
+#endif
default: log_fatal("cipher_encrypt: invalid mode %d\n", c->mode );
}
}
@@ -674,10 +684,12 @@ 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
case CIPHER_MODE_DUMMY:
if( inbuf != outbuf )
memmove( outbuf, inbuf, nbytes );
break;
+#endif
default: log_fatal("cipher_decrypt: invalid mode %d\n", c->mode );
}
}