diff options
author | Ben Laurie <ben@openssl.org> | 1999-01-17 16:26:24 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 1999-01-17 16:26:24 +0000 |
commit | 649cdb7be91d75184a51993b37fa6a9813dd2ef1 (patch) | |
tree | 9b899572037fa553f470ab990c43d86911b1065f /crypto/cast/c_enc.c | |
parent | fdd3b6421597e412fe3e80f09495caff4c8bd897 (diff) | |
download | openssl-649cdb7be91d75184a51993b37fa6a9813dd2ef1.tar.gz |
Fix major cockup with short keys in CAST-128.
Diffstat (limited to 'crypto/cast/c_enc.c')
-rw-r--r-- | crypto/cast/c_enc.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/crypto/cast/c_enc.c b/crypto/cast/c_enc.c index d998dd4953..5e6ecb31f5 100644 --- a/crypto/cast/c_enc.c +++ b/crypto/cast/c_enc.c @@ -81,10 +81,13 @@ CAST_KEY *key; E_CAST( 9,k,r,l,+,^,-); E_CAST(10,k,l,r,^,-,+); E_CAST(11,k,r,l,-,+,^); - E_CAST(12,k,l,r,+,^,-); - E_CAST(13,k,r,l,^,-,+); - E_CAST(14,k,l,r,-,+,^); - E_CAST(15,k,r,l,+,^,-); + if(!k->short_key) + { + E_CAST(12,k,l,r,+,^,-); + E_CAST(13,k,r,l,^,-,+); + E_CAST(14,k,l,r,-,+,^); + E_CAST(15,k,r,l,+,^,-); + } data[1]=l&0xffffffffL; data[0]=r&0xffffffffL; @@ -100,10 +103,13 @@ CAST_KEY *key; l=data[0]; r=data[1]; - E_CAST(15,k,l,r,+,^,-); - E_CAST(14,k,r,l,-,+,^); - E_CAST(13,k,l,r,^,-,+); - E_CAST(12,k,r,l,+,^,-); + if(!k->short_key) + { + E_CAST(15,k,l,r,+,^,-); + E_CAST(14,k,r,l,-,+,^); + E_CAST(13,k,l,r,^,-,+); + E_CAST(12,k,r,l,+,^,-); + } E_CAST(11,k,l,r,-,+,^); E_CAST(10,k,r,l,^,-,+); E_CAST( 9,k,l,r,+,^,-); |