From d7d75e0646eddd3e339307a245c0b7a1f29d6c87 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Wed, 6 Aug 2003 08:44:22 +0000 Subject: [PATCH] make the read-only arrays const --- lib/libcrypt/crypt.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index 03ed9c18adfb..d41bdc172dc2 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: crypt.c,v 1.19 2002/05/24 04:02:49 itojun Exp $ */ +/* $NetBSD: crypt.c,v 1.20 2003/08/06 08:44:22 jdolecek Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93"; #else -__RCSID("$NetBSD: crypt.c,v 1.19 2002/05/24 04:02:49 itojun Exp $"); +__RCSID("$NetBSD: crypt.c,v 1.20 2003/08/06 08:44:22 jdolecek Exp $"); #endif #endif /* not lint */ @@ -321,7 +321,7 @@ permute(cp, out, p, chars_in) /* ===== (mostly) Standard DES Tables ==================== */ -static unsigned char IP[] = { /* initial permutation */ +static const unsigned char IP[] = { /* initial permutation */ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, @@ -334,7 +334,7 @@ static unsigned char IP[] = { /* initial permutation */ /* The final permutation is the inverse of IP - no table is necessary */ -static unsigned char ExpandTr[] = { /* expansion operation */ +static const unsigned char ExpandTr[] = { /* expansion operation */ 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, @@ -345,7 +345,7 @@ static unsigned char ExpandTr[] = { /* expansion operation */ 28, 29, 30, 31, 32, 1, }; -static unsigned char PC1[] = { /* permuted choice table 1 */ +static const unsigned char PC1[] = { /* permuted choice table 1 */ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, @@ -357,12 +357,12 @@ static unsigned char PC1[] = { /* permuted choice table 1 */ 21, 13, 5, 28, 20, 12, 4, }; -static unsigned char Rotates[] = { /* PC1 rotation schedule */ +static const unsigned char Rotates[] = {/* PC1 rotation schedule */ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, }; /* note: each "row" of PC2 is left-padded with bits that make it invertible */ -static unsigned char PC2[] = { /* permuted choice table 2 */ +static const unsigned char PC2[] = { /* permuted choice table 2 */ 9, 18, 14, 17, 11, 24, 1, 5, 22, 25, 3, 28, 15, 6, 21, 10, 35, 38, 23, 19, 12, 4, 26, 8, @@ -374,7 +374,7 @@ static unsigned char PC2[] = { /* permuted choice table 2 */ 0, 0, 46, 42, 50, 36, 29, 32, }; -static unsigned char S[8][64] = { /* 48->32 bit substitution tables */ +static const unsigned char S[8][64] = { /* 48->32 bit substitution tables */ /* S[1] */ { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, @@ -417,7 +417,7 @@ static unsigned char S[8][64] = { /* 48->32 bit substitution tables */ 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 } }; -static unsigned char P32Tr[] = { /* 32-bit permutation function */ +static const unsigned char P32Tr[] = { /* 32-bit permutation function */ 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, @@ -428,7 +428,7 @@ static unsigned char P32Tr[] = { /* 32-bit permutation function */ 22, 11, 4, 25, }; -static unsigned char CIFP[] = { /* compressed/interleaved permutation */ +static const unsigned char CIFP[] = { /* compressed/interleaved permutation */ 1, 2, 3, 4, 17, 18, 19, 20, 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 25, 26, 27, 28, @@ -440,7 +440,7 @@ static unsigned char CIFP[] = { /* compressed/interleaved permutation */ 45, 46, 47, 48, 61, 62, 63, 64, }; -static unsigned char itoa64[] = /* 0..63 => ascii-64 */ +static const unsigned char itoa64[] = /* 0..63 => ascii-64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";