Fix other read call too.
[openssl.git] / crypto / des / set_key.c
index 683916e71b010de076820c7bec701ce3a3e52893..3004cc3ab3cf3eb602a9da69b7966b68563b0786 100644 (file)
@@ -65,7 +65,7 @@
  */
 #include "des_locl.h"
 
-OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key);   /* defaults to false */
+OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0)  /* defaults to false */
 
 static const unsigned char odd_parity[256]={
   1,  1,  2,  2,  4,  4,  7,  7,  8,  8, 11, 11, 13, 13, 14, 14,
@@ -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++)
                {
@@ -115,7 +115,7 @@ int DES_check_key_parity(const_DES_cblock *key)
  * (and actual cblock values).
  */
 #define NUM_WEAK_KEY   16
-static DES_cblock weak_keys[NUM_WEAK_KEY]={
+static const DES_cblock weak_keys[NUM_WEAK_KEY]={
        /* weak keys */
        {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
        {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE},
@@ -336,13 +336,13 @@ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule)
 
 void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule)
        {
-       static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
+       static const 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 const unsigned char *in;
        register DES_LONG *k;
        register int i;
 
-#if OPENBSD_DEV_CRYPTO
+#ifdef OPENBSD_DEV_CRYPTO
        memcpy(schedule->key,key,sizeof schedule->key);
        schedule->session=NULL;
 #endif