summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--THANKS1
-rw-r--r--cipher/ChangeLog6
-rw-r--r--cipher/cipher.c11
-rw-r--r--cipher/des.c65
-rw-r--r--doc/ChangeLog4
-rw-r--r--doc/gcrypt.texi4
-rw-r--r--src/ChangeLog5
-rw-r--r--src/gcrypt.h4
9 files changed, 98 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 4e0a10bb..0a3ee641 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Noteworthy changes in version 1.1.9
+------------------------------------------------
+
+ * Support for plain old DES.
+
+
Noteworthy changes in version 1.1.8 (2002-06-25)
------------------------------------------------
diff --git a/THANKS b/THANKS
index 69aed0dc..00fc768d 100644
--- a/THANKS
+++ b/THANKS
@@ -93,6 +93,7 @@ Roddy Strachan roddy@satlink.com.au
Roland Rosenfeld roland@spinnaker.rhein.de
Ross Golder rossigee@bigfoot.com
Serge Munhoven munhoven@mema.ucl.ac.be
+Simon Josefsson jas@extundo.com
SL Baur steve@xemacs.org
Stephan Austermuehle au@hcsd.de
Stefan Karrmann S.Karrmann@gmx.net
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 91ca3231..30376ece 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,9 @@
+2002-08-14 Werner Koch <wk@gnupg.org>
+
+ * des.c (do_des_setkey,do_des_encrypt, do_des_decrypt): New.
+ (_gcry_des_get_info): Support plain old DES.
+ * cipher.c (setup_cipher_table): Put DES into the table.
+
2002-07-25 Werner Koch <wk@gnupg.org>
* rndunix.c (_gcry_rndunix_constructor): Prefixed with _gcry_.
diff --git a/cipher/cipher.c b/cipher/cipher.c
index a5e05068..750fb7e4 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -219,6 +219,17 @@ setup_cipher_table(void)
if( !cipher_table[i].name )
BUG();
i++;
+ cipher_table[i].algo = GCRY_CIPHER_DES;
+ cipher_table[i].name = _gcry_des_get_info( cipher_table[i].algo,
+ &cipher_table[i].keylen,
+ &cipher_table[i].blocksize,
+ &cipher_table[i].contextsize,
+ &cipher_table[i].setkey,
+ &cipher_table[i].encrypt,
+ &cipher_table[i].decrypt );
+ if( !cipher_table[i].name )
+ BUG();
+
cipher_table[i].algo = CIPHER_ALGO_DUMMY;
cipher_table[i].name = "DUMMY";
cipher_table[i].blocksize = 8;
diff --git a/cipher/des.c b/cipher/des.c
index 1c86107b..6a9e620f 100644
--- a/cipher/des.c
+++ b/cipher/des.c
@@ -150,10 +150,16 @@ burn_stack (int bytes)
/* Some defines/checks to support standalone modules */
-#ifndef CIPHER_ALGO_3DES
- #define CIPHER_ALGO_3DES 2
-#elif CIPHER_ALGO_3DES != 2
- #error CIPHER_ALGO_3DES is defined to a wrong value.
+#ifndef GCRY_CIPHER_3DES
+# define CIPHER_ALGO_3DES 2
+#elif GCRY_CIPHER_3DES != 2
+# error CIPHER_ALGO_3DES is defined to a wrong value.
+#endif
+
+#ifndef GCRY_CIPHER_DES
+# define CIPHER_ALGO_DES 302
+#elif GCRY_CIPHER_DES != 302
+# error CIPHER_ALGO_DES is defined to a wrong value.
#endif
@@ -988,6 +994,43 @@ do_tripledes_decrypt( struct _tripledes_ctx *ctx, byte *outbuf, byte *inbuf )
}
+
+
+static int
+do_des_setkey ( struct _des_ctx *ctx, byte *key, unsigned keylen )
+{
+ if( selftest_failed )
+ return GCRYERR_SELFTEST;
+ if( keylen != 8 )
+ return GCRYERR_INV_KEYLEN;
+
+ des_setkey (ctx, key);
+
+ if( is_weak_key( key ) ) {
+ burn_stack (64);
+ return GCRYERR_WEAK_KEY;
+ }
+ burn_stack (64);
+
+ return 0;
+}
+
+
+static void
+do_des_encrypt( struct _des_ctx *ctx, byte *outbuf, byte *inbuf )
+{
+ des_ecb_encrypt ( ctx, inbuf, outbuf );
+ burn_stack (32);
+}
+
+static void
+do_des_decrypt( struct _des_ctx *ctx, byte *outbuf, byte *inbuf )
+{
+ des_ecb_decrypt ( ctx, inbuf, outbuf );
+ burn_stack (32);
+}
+
+
/****************
* Return some information about the algorithm. We need algo here to
* distinguish different flavors of the algorithm.
@@ -1015,7 +1058,7 @@ _gcry_des_get_info( int algo, size_t *keylen,
}
- if( algo == CIPHER_ALGO_3DES ) {
+ if( algo == GCRY_CIPHER_3DES ) {
*keylen = 192;
*blocksize = 8;
*contextsize = sizeof(struct _tripledes_ctx);
@@ -1027,6 +1070,18 @@ _gcry_des_get_info( int algo, size_t *keylen,
= do_tripledes_decrypt;
return "3DES";
}
+ else if( algo == GCRY_CIPHER_DES ) {
+ *keylen = 64;
+ *blocksize = 8;
+ *contextsize = sizeof(struct _des_ctx);
+ *(int (**)(struct _des_ctx*, byte*, unsigned))r_setkey
+ = do_des_setkey;
+ *(void (**)(struct _des_ctx*, byte*, byte*))r_encrypt
+ = do_des_encrypt;
+ *(void (**)(struct _des_ctx*, byte*, byte*))r_decrypt
+ = do_des_decrypt;
+ return "DES";
+ }
return NULL;
}
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 335b91b1..672083e4 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2002-08-14 Werner Koch <wk@gnupg.org>
+
+ * gcrypt.texi: Typo fixes.
+
2002-05-14 Werner Koch <wk@gnupg.org>
* lgpl.texi: New.
diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index 974792f4..091e21e0 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -151,7 +151,7 @@ subject to the terms of the GNU General Public License
list of these parts.
@item It encapsulates the low level cryptography
-`Libgcrypt' a high level interface to cryptographic buiilding blocks
+`Libgcrypt' a high level interface to cryptographic building blocks
using an extendable and flexible API.
@end table
@@ -225,7 +225,7 @@ are created.
@node Building the source
@section Building the source
-If you want to compile a source file including the `gcry.h' header
+If you want to compile a source file including the `gcrypt.h' header
file, you must make sure that the compiler can find it in the
directory hierarchy. This is accomplished by adding the path to the
directory in which the header file is located to the compilers include
diff --git a/src/ChangeLog b/src/ChangeLog
index 1018d2ae..269047be 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2002-08-14 Werner Koch <wk@gnupg.org>
+
+ * gcrypt.h: Add GCRY_CIPGER_DES. Included string.h for size_t.
+ Suggested by Simon Josefsson.
+
2002-07-25 Werner Koch <wk@gnupg.org>
* cipher.h: Added prototypes for progress functions.
diff --git a/src/gcrypt.h b/src/gcrypt.h
index 66a43357..9d8b9cc4 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -22,6 +22,7 @@
#define _GCRYPT_H
#include <stdarg.h>
+#include <string.h>
#ifdef __cplusplus
extern "C" {
@@ -479,7 +480,8 @@ enum gcry_cipher_algos
GCRY_CIPHER_AES256 = 9,
GCRY_CIPHER_TWOFISH = 10,
/* other cipher numbers are above 300 for OpenPGP reasons. */
- GCRY_CIPHER_ARCFOUR = 301
+ GCRY_CIPHER_ARCFOUR = 301,
+ GCRY_CIPHER_DES = 302
};
/* The Rijndael algorithm is basically AES, so provide some macros. */