aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/des
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>1999-04-17 21:25:43 +0000
committerBen Laurie <ben@openssl.org>1999-04-17 21:25:43 +0000
commite778802f53c8d47e96a6e4cbc776eb6e1d4c461a (patch)
tree719d4dd0fc69b355c6d8329af1f90b2c4f603548 /crypto/des
parentd77b3054cd87c2b13fa0169931f74b8e0dac5252 (diff)
downloadopenssl-e778802f53c8d47e96a6e4cbc776eb6e1d4c461a.tar.gz
Massive constification.
Diffstat (limited to 'crypto/des')
-rw-r--r--crypto/des/des.org2
-rw-r--r--crypto/des/des_enc.c17
-rw-r--r--crypto/des/des_locl.org48
-rw-r--r--crypto/des/ecb_enc.c8
-rw-r--r--crypto/des/fcrypt_b.c2
-rw-r--r--crypto/des/pcbc_enc.c9
-rw-r--r--crypto/des/qud_cksm.c4
-rw-r--r--crypto/des/set_key.c4
-rw-r--r--crypto/des/supp.c4
9 files changed, 50 insertions, 48 deletions
diff --git a/crypto/des/des.org b/crypto/des/des.org
index a66f2ce3dd..295fb75ad7 100644
--- a/crypto/des/des.org
+++ b/crypto/des/des.org
@@ -152,7 +152,7 @@ extern int des_set_weak_key_flag; /* set the weak key flag */
#undef NOPROTO
#endif
#ifndef NOPROTO
-char *des_options(void);
+const char *des_options(void);
void des_ecb3_encrypt(const unsigned char *input,unsigned char *output,
des_key_schedule ks1,des_key_schedule ks2,
des_key_schedule ks3, int enc);
diff --git a/crypto/des/des_enc.c b/crypto/des/des_enc.c
index 40df30261e..935e83ff8e 100644
--- a/crypto/des/des_enc.c
+++ b/crypto/des/des_enc.c
@@ -65,7 +65,7 @@ int enc;
{
register DES_LONG l,r,t,u;
#ifdef DES_PTR
- register unsigned char *des_SP=(unsigned char *)des_SPtrans;
+ register const unsigned char *des_SP=(const unsigned char *)des_SPtrans;
#endif
#ifndef DES_UNROLL
register int i;
@@ -166,7 +166,7 @@ int enc;
{
register DES_LONG l,r,t,u;
#ifdef DES_PTR
- register unsigned char *des_SP=(unsigned char *)des_SPtrans;
+ register const unsigned char *des_SP=(const unsigned char *)des_SPtrans;
#endif
#ifndef DES_UNROLL
register int i;
@@ -392,14 +392,15 @@ int enc;
{
register DES_LONG tin0,tin1;
register DES_LONG tout0,tout1,xor0,xor1;
- register unsigned char *in,*out;
+ register const unsigned char *in;
+ unsigned char *out;
register long l=length;
DES_LONG tin[2];
unsigned char *iv;
- in=(unsigned char *)input;
- out=(unsigned char *)output;
- iv=(unsigned char *)ivec;
+ in=input;
+ out=output;
+ iv=ivec;
if (enc)
{
@@ -436,7 +437,7 @@ int enc;
l2c(tout0,out);
l2c(tout1,out);
}
- iv=(unsigned char *)ivec;
+ iv=ivec;
l2c(tout0,iv);
l2c(tout1,iv);
}
@@ -488,7 +489,7 @@ int enc;
xor1=t1;
}
- iv=(unsigned char *)ivec;
+ iv=ivec;
l2c(xor0,iv);
l2c(xor1,iv);
}
diff --git a/crypto/des/des_locl.org b/crypto/des/des_locl.org
index 67ef3e7900..c9e8be3add 100644
--- a/crypto/des/des_locl.org
+++ b/crypto/des/des_locl.org
@@ -302,24 +302,24 @@ YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
u2&=0xfc; \
t=ROTATE(t,4); \
u>>=16L; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \
+ LL^= *(const DES_LONG *)(des_SP +u1); \
+ LL^= *(const DES_LONG *)(des_SP+0x200+u2); \
u3=(int)(u>>8L); \
u1=(int)u&0xfc; \
u3&=0xfc; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \
+ LL^= *(const DES_LONG *)(des_SP+0x400+u1); \
+ LL^= *(const DES_LONG *)(des_SP+0x600+u3); \
u2=(int)t>>8L; \
u1=(int)t&0xfc; \
u2&=0xfc; \
t>>=16L; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \
+ LL^= *(const DES_LONG *)(des_SP+0x100+u1); \
+ LL^= *(const DES_LONG *)(des_SP+0x300+u2); \
u3=(int)t>>8L; \
u1=(int)t&0xfc; \
u3&=0xfc; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); }
+ LL^= *(const DES_LONG *)(des_SP+0x500+u1); \
+ LL^= *(const DES_LONG *)(des_SP+0x700+u3); }
#endif
#ifdef DES_RISC2
#define D_ENCRYPT(LL,R,S) { \
@@ -329,39 +329,39 @@ YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
u1=(int)u&0xfc; \
u2&=0xfc; \
t=ROTATE(t,4); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \
+ LL^= *(const DES_LONG *)(des_SP +u1); \
+ LL^= *(const DES_LONG *)(des_SP+0x200+u2); \
s1=(int)(u>>16L); \
s2=(int)(u>>24L); \
s1&=0xfc; \
s2&=0xfc; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \
+ LL^= *(const DES_LONG *)(des_SP+0x400+s1); \
+ LL^= *(const DES_LONG *)(des_SP+0x600+s2); \
u2=(int)t>>8L; \
u1=(int)t&0xfc; \
u2&=0xfc; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \
+ LL^= *(const DES_LONG *)(des_SP+0x100+u1); \
+ LL^= *(const DES_LONG *)(des_SP+0x300+u2); \
s1=(int)(t>>16L); \
s2=(int)(t>>24L); \
s1&=0xfc; \
s2&=0xfc; \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \
- LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); }
+ LL^= *(const DES_LONG *)(des_SP+0x500+s1); \
+ LL^= *(const DES_LONG *)(des_SP+0x700+s2); }
#endif
#else
#define D_ENCRYPT(LL,R,S) { \
LOAD_DATA_tmp(R,S,u,t,E0,E1); \
t=ROTATE(t,4); \
LL^= \
- *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \
- *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); }
+ *(const DES_LONG *)(des_SP +((u )&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x200+((u>> 8L)&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x400+((u>>16L)&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x600+((u>>24L)&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x100+((t )&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x300+((t>> 8L)&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x500+((t>>16L)&0xfc))^ \
+ *(const DES_LONG *)(des_SP+0x700+((t>>24L)&0xfc)); }
#endif
#else /* original version */
diff --git a/crypto/des/ecb_enc.c b/crypto/des/ecb_enc.c
index c6cbea3f56..573a9f6bc9 100644
--- a/crypto/des/ecb_enc.c
+++ b/crypto/des/ecb_enc.c
@@ -60,17 +60,17 @@
#include "spr.h"
#include "opensslv.h"
-char *libdes_version="libdes v 3.24 - 20-Apr-1996 - eay";
-char *DES_version="DES" OPENSSL_VERSION_PTEXT;
+const char *libdes_version="libdes v 3.24 - 20-Apr-1996 - eay";
+const char *DES_version="DES" OPENSSL_VERSION_PTEXT;
-char *des_options()
+const char *des_options(void)
{
static int init=1;
static char buf[32];
if (init)
{
- char *ptr,*unroll,*risc,*size;
+ const char *ptr,*unroll,*risc,*size;
init=0;
#ifdef DES_PTR
diff --git a/crypto/des/fcrypt_b.c b/crypto/des/fcrypt_b.c
index 1544634bc1..2197b98bf1 100644
--- a/crypto/des/fcrypt_b.c
+++ b/crypto/des/fcrypt_b.c
@@ -85,7 +85,7 @@ DES_LONG Eswap1;
{
register DES_LONG l,r,t,u;
#ifdef DES_PTR
- register unsigned char *des_SP=(unsigned char *)des_SPtrans;
+ register const unsigned char *des_SP=(const unsigned char *)des_SPtrans;
#endif
register DES_LONG *s;
register int j;
diff --git a/crypto/des/pcbc_enc.c b/crypto/des/pcbc_enc.c
index 850717cc57..2d5bb40e5f 100644
--- a/crypto/des/pcbc_enc.c
+++ b/crypto/des/pcbc_enc.c
@@ -68,11 +68,12 @@ int enc;
{
register DES_LONG sin0,sin1,xor0,xor1,tout0,tout1;
DES_LONG tin[2];
- unsigned char *in,*out,*iv;
+ const unsigned char *in;
+ unsigned char *out,*iv;
- in=(unsigned char *)input;
- out=(unsigned char *)output;
- iv=(unsigned char *)ivec;
+ in=input;
+ out=output;
+ iv=ivec;
if (enc)
{
diff --git a/crypto/des/qud_cksm.c b/crypto/des/qud_cksm.c
index 93505354a6..d5e38c952f 100644
--- a/crypto/des/qud_cksm.c
+++ b/crypto/des/qud_cksm.c
@@ -83,7 +83,7 @@ des_cblock seed;
DES_LONG z0,z1,t0,t1;
int i;
long l;
- unsigned char *cp;
+ const unsigned char *cp;
unsigned char *lp;
if (out_count < 1) out_count=1;
@@ -94,7 +94,7 @@ des_cblock seed;
for (i=0; ((i<4)&&(i<out_count)); i++)
{
- cp=(unsigned char *)input;
+ cp=input;
l=length;
while (l > 0)
{
diff --git a/crypto/des/set_key.c b/crypto/des/set_key.c
index fef8d277fd..cdc3c19233 100644
--- a/crypto/des/set_key.c
+++ b/crypto/des/set_key.c
@@ -163,7 +163,7 @@ des_key_schedule schedule;
{
static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
register DES_LONG c,d,t,s,t2;
- register unsigned char *in;
+ register const unsigned char *in;
register DES_LONG *k;
register int i;
@@ -177,7 +177,7 @@ des_key_schedule schedule;
}
k=(DES_LONG *)schedule;
- in=(unsigned char *)key;
+ in=key;
c2l(in,c);
c2l(in,d);
diff --git a/crypto/des/supp.c b/crypto/des/supp.c
index ff13e073da..1d9effdd42 100644
--- a/crypto/des/supp.c
+++ b/crypto/des/supp.c
@@ -87,7 +87,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: supp.c,v 1.2 1999/02/13 18:52:21 ben Exp $
+ * $Id: supp.c,v 1.3 1999/04/17 21:25:00 ben Exp $
*/
#include <stdio.h>
@@ -98,7 +98,7 @@ void des_cblock_print_file(cb, fp)
FILE *fp;
{
int i;
- unsigned int *p = (unsigned int *)cb;
+ const unsigned int *p = (const unsigned int *)cb;
fprintf(fp, " 0x { ");
for (i = 0; i < 8; i++) {