* 64bit block we have used is contained in *num;
*/
-void CAST_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
- CAST_KEY *schedule, unsigned char *ivec, int *num, int encrypt)
+void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+ long length, CAST_KEY *schedule, unsigned char *ivec,
+ int *num, int _encrypt)
{
register CAST_LONG v0,v1,t;
register int n= *num;
CAST_LONG ti[2];
unsigned char *iv,c,cc;
- iv=(unsigned char *)ivec;
- if (encrypt)
+ iv=ivec;
+ if (_encrypt)
{
while (l--)
{
n2l(iv,v0); ti[0]=v0;
n2l(iv,v1); ti[1]=v1;
CAST_encrypt((CAST_LONG *)ti,schedule);
- iv=(unsigned char *)ivec;
+ iv=ivec;
t=ti[0]; l2n(t,iv);
t=ti[1]; l2n(t,iv);
- iv=(unsigned char *)ivec;
+ iv=ivec;
}
c= *(in++)^iv[n];
*(out++)=c;
n2l(iv,v0); ti[0]=v0;
n2l(iv,v1); ti[1]=v1;
CAST_encrypt((CAST_LONG *)ti,schedule);
- iv=(unsigned char *)ivec;
+ iv=ivec;
t=ti[0]; l2n(t,iv);
t=ti[1]; l2n(t,iv);
- iv=(unsigned char *)ivec;
+ iv=ivec;
}
cc= *(in++);
c=iv[n];
char *CAST_version="CAST" OPENSSL_VERSION_PTEXT;
-void CAST_ecb_encrypt(unsigned char *in, unsigned char *out, CAST_KEY *ks,
- int encrypt)
+void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
+ CAST_KEY *ks, int _encrypt)
{
CAST_LONG l,d[2];
n2l(in,l); d[0]=l;
n2l(in,l); d[1]=l;
- if (encrypt)
+ if (_encrypt)
CAST_encrypt(d,ks);
else
CAST_decrypt(d,ks);
data[0]=r&0xffffffffL;
}
-void CAST_cbc_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,
+ CAST_KEY *ks, unsigned char *iv, int _encrypt)
{
register CAST_LONG tin0,tin1;
register CAST_LONG tout0,tout1,xor0,xor1;
register long l=length;
CAST_LONG tin[2];
- if (encrypt)
+ if (_encrypt)
{
n2l(iv,tout0);
n2l(iv,tout1);
* used. The extra state information to record how much of the
* 64bit block we have used is contained in *num;
*/
-void CAST_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
- CAST_KEY *schedule, unsigned char *ivec, int *num)
+void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+ long length, CAST_KEY *schedule, unsigned char *ivec,
+ int *num)
{
register CAST_LONG v0,v1,t;
register int n= *num;
unsigned char *iv;
int save=0;
- iv=(unsigned char *)ivec;
+ iv=ivec;
n2l(iv,v0);
n2l(iv,v1);
ti[0]=v0;
{
v0=ti[0];
v1=ti[1];
- iv=(unsigned char *)ivec;
+ iv=ivec;
l2n(v0,iv);
l2n(v1,iv);
}
void CAST_set_key(CAST_KEY *key, int len, unsigned char *data);
-void CAST_ecb_encrypt(unsigned char *in,unsigned char *out,CAST_KEY *key,
- int enc);
+void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key,
+ int enc);
void CAST_encrypt(CAST_LONG *data,CAST_KEY *key);
void CAST_decrypt(CAST_LONG *data,CAST_KEY *key);
-void CAST_cbc_encrypt(unsigned char *in, unsigned char *out, long length,
- CAST_KEY *ks, unsigned char *iv, int enc);
-void CAST_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
- CAST_KEY *schedule, unsigned char *ivec, int *num, int enc);
-void CAST_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
- CAST_KEY *schedule, unsigned char *ivec, int *num);
+void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
+ CAST_KEY *ks, unsigned char *iv, int enc);
+void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
+ long length, CAST_KEY *schedule, unsigned char *ivec,
+ int *num, int enc);
+void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+ long length, CAST_KEY *schedule, unsigned char *ivec,
+ int *num);
#ifdef __cplusplus
}