projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR: 2632
[oweals/openssl.git]
/
crypto
/
cast
/
c_enc.c
diff --git
a/crypto/cast/c_enc.c
b/crypto/cast/c_enc.c
index d998dd4953e8f2595f17ae74862cb82090874794..357c41ebf08a7864525393bf630d2d0ed49598d3 100644
(file)
--- a/
crypto/cast/c_enc.c
+++ b/
crypto/cast/c_enc.c
@@
-56,14
+56,13
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
-#include
"cast.h"
+#include
<openssl/cast.h>
#include "cast_lcl.h"
#include "cast_lcl.h"
-void CAST_encrypt(data,key)
-CAST_LONG *data;
-CAST_KEY *key;
+void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key)
{
{
- register CAST_LONG l,r,*k,t;
+ register CAST_LONG l,r,t;
+ const register CAST_LONG *k;
k= &(key->data[0]);
l=data[0];
k= &(key->data[0]);
l=data[0];
@@
-81,29
+80,34
@@
CAST_KEY *key;
E_CAST( 9,k,r,l,+,^,-);
E_CAST(10,k,l,r,^,-,+);
E_CAST(11,k,r,l,-,+,^);
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(!key->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;
}
data[1]=l&0xffffffffL;
data[0]=r&0xffffffffL;
}
-void CAST_decrypt(data,key)
-CAST_LONG *data;
-CAST_KEY *key;
+void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key)
{
{
- register CAST_LONG l,r,*k,t;
+ register CAST_LONG l,r,t;
+ const register CAST_LONG *k;
k= &(key->data[0]);
l=data[0];
r=data[1];
k= &(key->data[0]);
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(!key->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,+,^,-);
E_CAST(11,k,l,r,-,+,^);
E_CAST(10,k,r,l,^,-,+);
E_CAST( 9,k,l,r,+,^,-);
@@
-121,20
+125,15
@@
CAST_KEY *key;
data[0]=r&0xffffffffL;
}
data[0]=r&0xffffffffL;
}
-void CAST_cbc_encrypt(in, out, length, ks, iv, encrypt)
-unsigned char *in;
-unsigned char *out;
-long length;
-CAST_KEY *ks;
-unsigned char *iv;
-int encrypt;
+void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
+ const CAST_KEY *ks, unsigned char *iv, int enc)
{
register CAST_LONG tin0,tin1;
register CAST_LONG tout0,tout1,xor0,xor1;
register long l=length;
CAST_LONG tin[2];
{
register CAST_LONG tin0,tin1;
register CAST_LONG tout0,tout1,xor0,xor1;
register long l=length;
CAST_LONG tin[2];
- if (enc
rypt
)
+ if (enc)
{
n2l(iv,tout0);
n2l(iv,tout1);
{
n2l(iv,tout0);
n2l(iv,tout1);
@@
-207,4
+206,3
@@
int encrypt;
tin0=tin1=tout0=tout1=xor0=xor1=0;
tin[0]=tin[1]=0;
}
tin0=tin1=tout0=tout1=xor0=xor1=0;
tin[0]=tin[1]=0;
}
-