aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/twofish.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-02-10 16:22:40 +0000
committerWerner Koch <[email protected]>1999-02-10 16:22:40 +0000
commit9a4f506a18ed04f5dbd69d74ec0c35ade79e357a (patch)
tree07178f77cb23862b045b0edf8a2bc5ce188432cd /cipher/twofish.c
parentSee ChangeLog: Sun Jan 24 18:16:26 CET 1999 Werner Koch (diff)
downloadgnupg-9a4f506a18ed04f5dbd69d74ec0c35ade79e357a.tar.gz
gnupg-9a4f506a18ed04f5dbd69d74ec0c35ade79e357a.zip
See ChangeLog: Wed Feb 10 17:15:39 CET 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r--cipher/twofish.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cipher/twofish.c b/cipher/twofish.c
index 6ff7dee9f..d1e171bad 100644
--- a/cipher/twofish.c
+++ b/cipher/twofish.c
@@ -24,6 +24,7 @@
#include "types.h" /* for byte and u32 typedefs */
#include "util.h"
#include "errors.h"
+#include "dynload.h"
/* Prototype for the self-test function. */
@@ -462,7 +463,7 @@ twofish_setkey (TWOFISH_context *ctx, const byte *key, const unsigned keylen)
static const char *selftest_failed=0;
/* Check key length. */
- if( keylen != 16 )
+ if( keylen != 16 ) /* enhance this code for 256 bit keys */
return G10ERR_WRONG_KEYLEN;
/* Do self-test if necessary. */
@@ -840,16 +841,18 @@ twofish_get_info (int algo, size_t *keylen,
void (**r_decrypt) (void *c, byte *outbuf, byte *inbuf)
)
{
- *keylen = 128;
+ *keylen = algo==10? 256 : 128;
*blocksize = 16;
*contextsize = sizeof (TWOFISH_context);
*r_setkey = FNCCAST_SETKEY (twofish_setkey);
*r_encrypt= FNCCAST_CRYPT (twofish_encrypt);
*r_decrypt= FNCCAST_CRYPT (twofish_decrypt);
+ if( algo == 10 )
+ return "TWOFISH";
if (algo == 102) /* This algorithm number is assigned for
* experiments, so we can use it */
- return "TWOFISH";
+ return "TWOFISH128";
return NULL;
}
@@ -863,6 +866,7 @@ static struct {
void (*func)(void);
} func_table[] = {
{ 20, 1, 0, (void(*)(void))twofish_get_info },
+ { 21, 1, 10 },
{ 21, 1, 102 },
};