summaryrefslogtreecommitdiffstats
path: root/crypto/des
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-10-29 20:24:15 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-10-29 20:24:15 +0000
commit27545970134d703ed96027aac9b67eced124eec3 (patch)
tree2f878acf303cc26e3b6db6a0ec25c10c91e3d32d /crypto/des
parent2ce90b9b7481381dff584726d84345a0260ca4d1 (diff)
A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.
I have tried to convert 'len' type variable declarations to unsigned as a means to address these warnings when appropriate, but when in doubt I have used casts in the comparisons instead. The better solution (that would get us all lynched by API users) would be to go through and convert all the function prototypes and structure definitions to use unsigned variables except when signed is necessary. The proliferation of (signed) "int" for strictly non-negative uses is unfortunate.
Diffstat (limited to 'crypto/des')
-rw-r--r--crypto/des/destest.c9
-rw-r--r--crypto/des/set_key.c4
2 files changed, 7 insertions, 6 deletions
diff --git a/crypto/des/destest.c b/crypto/des/destest.c
index 3983ac8e5f..788f552c88 100644
--- a/crypto/des/destest.c
+++ b/crypto/des/destest.c
@@ -333,7 +333,8 @@ static int cfb64_test(unsigned char *cfb_cipher);
static int ede_cfb64_test(unsigned char *cfb_cipher);
int main(int argc, char *argv[])
{
- int i,j,err=0;
+ int j,err=0;
+ unsigned int i;
des_cblock in,out,outin,iv3,iv2;
des_key_schedule ks,ks2,ks3;
unsigned char cbc_in[40];
@@ -391,7 +392,7 @@ int main(int argc, char *argv[])
DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
{
- int n;
+ unsigned int n;
printf("des_ede3_cbcm_encrypt decrypt error\n");
for(n=0 ; n < i ; ++n)
@@ -540,7 +541,7 @@ int main(int argc, char *argv[])
if (memcmp(cbc_out,cbc3_ok,
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
{
- int n;
+ unsigned int n;
printf("des_ede3_cbc_encrypt encrypt error\n");
for(n=0 ; n < i ; ++n)
@@ -556,7 +557,7 @@ int main(int argc, char *argv[])
des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
{
- int n;
+ unsigned int n;
printf("des_ede3_cbc_encrypt decrypt error\n");
for(n=0 ; n < i ; ++n)
diff --git a/crypto/des/set_key.c b/crypto/des/set_key.c
index 143008ed9c..55efe03f42 100644
--- a/crypto/des/set_key.c
+++ b/crypto/des/set_key.c
@@ -87,7 +87,7 @@ static const unsigned char odd_parity[256]={
void DES_set_odd_parity(DES_cblock *key)
{
- int i;
+ unsigned int i;
for (i=0; i<DES_KEY_SZ; i++)
(*key)[i]=odd_parity[(*key)[i]];
@@ -95,7 +95,7 @@ void DES_set_odd_parity(DES_cblock *key)
int DES_check_key_parity(const_DES_cblock *key)
{
- int i;
+ unsigned int i;
for (i=0; i<DES_KEY_SZ; i++)
{