diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-12-14 18:43:44 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-12-14 18:43:44 +0300 |
commit | 9e709e2fa02b85d0d10c864d6c996e3368e977ce (patch) | |
tree | 148bedd2674933ba40e59f15fcfa2981f7aead85 /ext/standard/crypt_freesec.c | |
parent | 71eaf0d97f173093253163db8c4720bd62387e34 (diff) | |
download | php-git-9e709e2fa02b85d0d10c864d6c996e3368e977ce.tar.gz |
Move constants into read-only data segment
Diffstat (limited to 'ext/standard/crypt_freesec.c')
-rw-r--r-- | ext/standard/crypt_freesec.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ext/standard/crypt_freesec.c b/ext/standard/crypt_freesec.c index ba11bf98e8..5e99e83bd4 100644 --- a/ext/standard/crypt_freesec.c +++ b/ext/standard/crypt_freesec.c @@ -73,25 +73,25 @@ #define _PASSWORD_EFMT1 '_' -static u_char IP[64] = { +static const u_char IP[64] = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 }; -static u_char key_perm[56] = { +static const u_char key_perm[56] = { 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 }; -static u_char key_shifts[16] = { +static const u_char key_shifts[16] = { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 }; -static u_char comp_perm[48] = { +static const u_char comp_perm[48] = { 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, @@ -102,7 +102,7 @@ static u_char comp_perm[48] = { * No E box is used, as it's replaced by some ANDs, shifts, and ORs. */ -static u_char sbox[8][64] = { +static const u_char sbox[8][64] = { { 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, @@ -153,12 +153,12 @@ static u_char sbox[8][64] = { } }; -static u_char pbox[32] = { +static const u_char pbox[32] = { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 }; -static uint32_t bits32[32] = +static const uint32_t bits32[32] = { 0x80000000, 0x40000000, 0x20000000, 0x10000000, 0x08000000, 0x04000000, 0x02000000, 0x01000000, @@ -170,9 +170,9 @@ static uint32_t bits32[32] = 0x00000008, 0x00000004, 0x00000002, 0x00000001 }; -static u_char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; +static const u_char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; -static unsigned char ascii64[] = +static const unsigned char ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /* 0000000000111111111122222222223333333333444444444455555555556666 */ /* 0123456789012345678901234567890123456789012345678901234567890123 */ @@ -216,7 +216,7 @@ _crypt_extended_init(void) { int i, j, b, k, inbit, obit; uint32_t *p, *il, *ir, *fl, *fr; - uint32_t *bits28, *bits24; + const uint32_t *bits28, *bits24; u_char inv_key_perm[64]; u_char inv_comp_perm[56]; u_char init_perm[64], final_perm[64]; @@ -741,9 +741,9 @@ _crypt_extended(const char *key, const char *setting) #define crypt _crypt_extended -static struct { - char *hash; - char *pw; +static const struct { + const char *hash; + const char *pw; } tests[] = { /* "new"-style */ {"_J9..CCCCXBrJUJV154M", "U*U*U*U*"}, |