aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/cipher.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-04-18 08:18:52 +0000
committerWerner Koch <[email protected]>1999-04-18 08:18:52 +0000
commit1feae2011ccd122ffb9a8f28013a13e57fc0b4fd (patch)
tree981a2000ffe3b4349bf3f2b8dbe845a60c15c95a /cipher/cipher.c
parentSee ChangeLog: Fri Apr 9 12:26:25 CEST 1999 Werner Koch (diff)
downloadgnupg-1feae2011ccd122ffb9a8f28013a13e57fc0b4fd.tar.gz
gnupg-1feae2011ccd122ffb9a8f28013a13e57fc0b4fd.zip
See ChangeLog: Sun Apr 18 10:11:28 CEST 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r--cipher/cipher.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/cipher/cipher.c b/cipher/cipher.c
index cba011be1..c3712f985 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -83,6 +83,7 @@ setup_cipher_table(void)
int i;
i = 0;
+ if( getenv("GNUPG_ENABLE_TWOFISH") ) {
cipher_table[i].algo = CIPHER_ALGO_TWOFISH;
cipher_table[i].name = twofish_get_info( cipher_table[i].algo,
&cipher_table[i].keylen,
@@ -94,6 +95,7 @@ setup_cipher_table(void)
if( !cipher_table[i].name )
BUG();
i++;
+ }
cipher_table[i].algo = CIPHER_ALGO_BLOWFISH;
cipher_table[i].name = blowfish_get_info( cipher_table[i].algo,
&cipher_table[i].keylen,
@@ -368,12 +370,17 @@ cipher_setkey( CIPHER_HANDLE c, byte *key, unsigned keylen )
void
-cipher_setiv( CIPHER_HANDLE c, const byte *iv )
+cipher_setiv( CIPHER_HANDLE c, const byte *iv, unsigned ivlen )
{
- if( iv )
- memcpy( c->iv, iv, c->blocksize );
- else
- memset( c->iv, 0, c->blocksize );
+ memset( c->iv, 0, c->blocksize );
+ if( iv ) {
+ if( ivlen != c->blocksize )
+ log_info("WARNING: cipher_setiv: ivlen=%u blklen=%u\n",
+ ivlen, c->blocksize );
+ if( ivlen > c->blocksize )
+ ivlen = c->blocksize;
+ memcpy( c->iv, iv, ivlen );
+ }
c->unused = 0;
}