]> granicus.if.org Git - php/commitdiff
MFB: constify
authorNuno Lopes <nlopess@php.net>
Mon, 8 Jan 2007 22:29:52 +0000 (22:29 +0000)
committerNuno Lopes <nlopess@php.net>
Mon, 8 Jan 2007 22:29:52 +0000 (22:29 +0000)
13 files changed:
ext/hash/hash.c
ext/hash/hash_adler32.c
ext/hash/hash_crc32.c
ext/hash/hash_gost.c
ext/hash/hash_haval.c
ext/hash/hash_md.c
ext/hash/hash_ripemd.c
ext/hash/hash_salsa.c
ext/hash/hash_sha.c
ext/hash/hash_snefru.c
ext/hash/hash_tiger.c
ext/hash/hash_whirlpool.c
ext/hash/php_hash.h

index 0493204e93f448957502e0332ca337adac6b1d20..52535fc59293f1dd2d1c3e2430d4a032f337578b 100644 (file)
@@ -37,7 +37,7 @@ HashTable php_hash_hashtable;
 
 /* Hash Registry Access */
 
-PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
 {
        php_hash_ops *ops;
        char *lower = estrndup(algo, algo_len);
@@ -51,13 +51,13 @@ PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
        return ops;
 }
 
-PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops)
+PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops)
 {
        int algo_len = strlen(algo);
        char *lower = estrndup(algo, algo_len);
        
        zend_str_tolower(lower, algo_len);
-       zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, ops, sizeof(php_hash_ops), NULL);
+       zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, (void*)ops, sizeof(php_hash_ops), NULL);
        efree(lower);
 }
 
@@ -69,7 +69,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
        int algo_len, data_len;
        zend_uchar data_type = IS_STRING;
        zend_bool raw_output = 0;
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        void *context;
        php_stream *stream = NULL;
 
@@ -180,7 +180,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
        int algo_len, data_len, key_len, i;
        zend_uchar data_type = IS_STRING, key_type = IS_STRING;
        zend_bool raw_output = 0;
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        void *context;
        php_stream *stream = NULL;
 
@@ -344,7 +344,7 @@ PHP_FUNCTION(hash_init)
        zend_uchar key_type;
        long options = 0;
        void *context;
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        php_hash_data *hash;
 
        if (zend_parse_parameters(argc TSRMLS_CC, "s|lt", &algo, &algo_len, &options, &key, &key_len, &key_type) == FAILURE) {
index 1394f29c518dd395a8ac3d49c1696646f7cde3b2..b06d6271a1214529fef7538b30f466f306ea7eaf 100644 (file)
@@ -49,7 +49,7 @@ PHP_HASH_API void PHP_ADLER32Final(unsigned char digest[4], PHP_ADLER32_CTX *con
        context->state = 0;
 }
 
-php_hash_ops php_hash_adler32_ops = {
+const php_hash_ops php_hash_adler32_ops = {
        (php_hash_init_func_t) PHP_ADLER32Init,
        (php_hash_update_func_t) PHP_ADLER32Update,
        (php_hash_final_func_t) PHP_ADLER32Final,
index 1d76e234ff77b7ecb8a50bcdb2e86fc3903d30eb..a78e51eb863c3ca4d5ba2877e853289763c83334 100644 (file)
@@ -56,7 +56,7 @@ PHP_HASH_API void PHP_CRC32Final(unsigned char digest[4], PHP_CRC32_CTX *context
        context->state = 0;
 }
 
-php_hash_ops php_hash_crc32_ops = {
+const php_hash_ops php_hash_crc32_ops = {
        (php_hash_init_func_t) PHP_CRC32Init,
        (php_hash_update_func_t) PHP_CRC32Update,
        (php_hash_final_func_t) PHP_CRC32Final,
@@ -65,7 +65,7 @@ php_hash_ops php_hash_crc32_ops = {
        sizeof(PHP_CRC32_CTX)
 };
 
-php_hash_ops php_hash_crc32b_ops = {
+const php_hash_ops php_hash_crc32b_ops = {
        (php_hash_init_func_t) PHP_CRC32Init,
        (php_hash_update_func_t) PHP_CRC32BUpdate,
        (php_hash_final_func_t) PHP_CRC32Final,
index 7036337076bc8ac644c9596adcff11dbe96615fa..95d0182fd54fb865fefb6d66647603fe6c63e452 100644 (file)
@@ -302,7 +302,7 @@ PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], PHP_GOST_CTX *context)
        memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_gost_ops = {
+const php_hash_ops php_hash_gost_ops = {
        (php_hash_init_func_t) PHP_GOSTInit,
        (php_hash_update_func_t) PHP_GOSTUpdate,
        (php_hash_final_func_t) PHP_GOSTFinal,
index cd944ab1e86f759c28d7e81d11483a1b64020418..c96279c139e1d17aaffe9e324a3c12dd3602818e 100644 (file)
@@ -21,7 +21,7 @@
 #include "php_hash.h"
 #include "php_hash_haval.h"
 
-static unsigned char PADDING[128] ={
+static const unsigned char PADDING[128] ={
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -31,67 +31,67 @@ static unsigned char PADDING[128] ={
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
-static php_hash_uint32 D0[8] = {
+static const php_hash_uint32 D0[8] = {
        0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89 };
 
-static php_hash_uint32 K2[32] = {
+static const php_hash_uint32 K2[32] = {
        0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
        0x9216D5D9, 0x8979FB1B, 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 0xB8E1AFED, 0x6A267E96,
        0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 0x636920D8, 0x71574E69,
        0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 0x7B54A41D, 0xC25A59B5 };
 
-static php_hash_uint32 K3[32] = {
+static const php_hash_uint32 K3[32] = {
        0x9C30D539, 0x2AF26013, 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 0x8E79DCB0, 0x603A180E,
        0x6C9E0E8B, 0xB01E8A3E, 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 0xE65525F3, 0xAA55AB94,
        0x57489862, 0x63E81440, 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 0xA15486AF, 0x7C72E993,
        0xB3EE1411, 0x636FBC2A, 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 0xAFD6BA33, 0x6C24CF5C };
 
-static php_hash_uint32 K4[32] = {
+static const php_hash_uint32 K4[32] = {
        0x7A325381, 0x28958677, 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 0x61D809CC, 0xFB21A991,
        0x487CAC60, 0x5DEC8032, 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 0x23893E81, 0xD396ACC5,
        0x0F6D6FF3, 0x83F44239, 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 0x21C66842, 0xF6E96C9A,
        0x670C9C61, 0xABD388F0, 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 0x6EEF0B6C, 0x137A3BE4 };
 
-static php_hash_uint32 K5[32] = {
+static const php_hash_uint32 K5[32] = {
        0xBA3BF050, 0x7EFB2A98, 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 0x8CEE8619, 0x456F9FB4,
        0x7D84A5C3, 0x3B8B5EBE, 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 0x4ED3AA62, 0x363F7706,
        0x1BFEDF72, 0x429B023D, 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 0x075372C9, 0x80991B7B,
        0x25D479D8, 0xF6E8DEF7, 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 0xC1A94FB6, 0x409F60C4 };
 
-static short I2[32] = {         5, 14, 26, 18, 11, 28,  7, 16,  0, 23, 20, 22,  1, 10,  4,  8,
+static const short I2[32] = {   5, 14, 26, 18, 11, 28,  7, 16,  0, 23, 20, 22,  1, 10,  4,  8,
                                                30,  3, 21,  9, 17, 24, 29,  6, 19, 12, 15, 13,  2, 25, 31, 27 };
 
-static short I3[32] = {        19,  9,  4, 20, 28, 17,  8, 22, 29, 14, 25, 12, 24, 30, 16, 26,
+static const short I3[32] = {  19,  9,  4, 20, 28, 17,  8, 22, 29, 14, 25, 12, 24, 30, 16, 26,
                                                31, 15,  7,  3,  1,  0, 18, 27, 13,  6, 21, 10, 23, 11,  5,  2 };
 
-static short I4[32] = {        24,  4,  0, 14,  2,  7, 28, 23, 26,  6, 30, 20, 18, 25, 19,  3,
+static const short I4[32] = {  24,  4,  0, 14,  2,  7, 28, 23, 26,  6, 30, 20, 18, 25, 19,  3,
                                                22, 11, 31, 21,  8, 27, 12,  9,  1, 29,  5, 15, 17, 10, 16, 13 };
 
-static short I5[32] = {        27,  3, 21, 26, 17, 11, 20, 29, 19,  0, 12,  7, 13,  8, 31, 10,
+static const short I5[32] = {  27,  3, 21, 26, 17, 11, 20, 29, 19,  0, 12,  7, 13,  8, 31, 10,
                                                 5,  9, 14, 30, 18,  6, 28, 24,  2, 23, 16, 22,  4,  1, 25, 15 };
 
-static short M0[32] = {        0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1,
+static const short M0[32] = {  0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1,
                                                0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1 };
 
-static short M1[32] = {        1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2,
+static const short M1[32] = {  1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2,
                                                1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2 };
 
-static short M2[32] = {        2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3,
+static const short M2[32] = {  2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3,
                                                2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3 };
 
-static short M3[32] = {        3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4,
+static const short M3[32] = {  3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4,
                                                3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4 };
 
-static short M4[32] = {        4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5,
+static const short M4[32] = {  4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5,
                                                4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5 };
 
-static short M5[32] = {        5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6,
+static const short M5[32] = {  5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6,
                                                5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6 };
 
-static short M6[32] = {        6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7,
+static const short M6[32] = {  6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7,
                                                6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7 };
 
-static short M7[32] = {        7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0,
+static const short M7[32] = {  7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0,
                                                7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0 };
 
 /* {{{ Encode
@@ -250,7 +250,7 @@ static void PHP_5HAVALTransform(php_hash_uint32 state[8], const unsigned char bl
 /* }}} */
 
 #define PHP_HASH_HAVAL_INIT(p,b) \
-php_hash_ops php_hash_##p##haval##b##_ops = { \
+const php_hash_ops php_hash_##p##haval##b##_ops = { \
        (php_hash_init_func_t) PHP_##p##HAVAL##b##Init, \
        (php_hash_update_func_t) PHP_HAVALUpdate, \
        (php_hash_final_func_t) PHP_HAVAL##b##Final, \
index f152810e6a1d7de44d5b4766c6577174a69ea9ca..69b1c6a29833b75723143ae854d8478c3718c47e 100644 (file)
@@ -21,7 +21,7 @@
 #include "php_hash.h"
 #include "php_hash_md.h"
 
-php_hash_ops php_hash_md5_ops = {
+const php_hash_ops php_hash_md5_ops = {
        (php_hash_init_func_t) PHP_MD5Init,
        (php_hash_update_func_t) PHP_MD5Update,
        (php_hash_final_func_t) PHP_MD5Final,
@@ -30,7 +30,7 @@ php_hash_ops php_hash_md5_ops = {
        sizeof(PHP_MD5_CTX)
 };
 
-php_hash_ops php_hash_md4_ops = {
+const php_hash_ops php_hash_md4_ops = {
        (php_hash_init_func_t) PHP_MD4Init,
        (php_hash_update_func_t) PHP_MD4Update,
        (php_hash_final_func_t) PHP_MD4Final,
@@ -39,7 +39,7 @@ php_hash_ops php_hash_md4_ops = {
        sizeof(PHP_MD4_CTX)
 };
 
-php_hash_ops php_hash_md2_ops = {
+const php_hash_ops php_hash_md2_ops = {
        (php_hash_init_func_t) PHP_MD2Init,
        (php_hash_update_func_t) PHP_MD2Update,
        (php_hash_final_func_t) PHP_MD2Final,
@@ -50,7 +50,7 @@ php_hash_ops php_hash_md2_ops = {
 
 /* MD common stuff */
 
-static unsigned char PADDING[64] =
+static const unsigned char PADDING[64] =
 {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -238,7 +238,7 @@ PHP_HASH_API void PHP_MD4Final(unsigned char digest[16], PHP_MD4_CTX * context)
 
 /* MD2 */
 
-static unsigned char MD2_S[256] = {
+static const unsigned char MD2_S[256] = {
         41,  46,  67, 201, 162, 216, 124,   1,  61,  54,  84, 161, 236, 240,   6,  19,
         98, 167,   5, 243, 192, 199, 115, 140, 152, 147,  43, 217, 188,  76, 130, 202,
         30, 155,  87,  60, 253, 212, 224,  22, 103,  66, 111,  24, 138,  23, 229,  18,
index f0f0d349bd5958d4a88d6cc96081c0edfded1368..a3aee42c807503921f2dd1ae316800890825d649 100644 (file)
@@ -25,7 +25,7 @@
 #include "php_hash.h"
 #include "php_hash_ripemd.h"
 
-php_hash_ops php_hash_ripemd128_ops = {
+const php_hash_ops php_hash_ripemd128_ops = {
        (php_hash_init_func_t) PHP_RIPEMD128Init,
        (php_hash_update_func_t) PHP_RIPEMD128Update,
        (php_hash_final_func_t) PHP_RIPEMD128Final,
@@ -34,7 +34,7 @@ php_hash_ops php_hash_ripemd128_ops = {
        sizeof(PHP_RIPEMD128_CTX)
 };
 
-php_hash_ops php_hash_ripemd160_ops = {
+const php_hash_ops php_hash_ripemd160_ops = {
        (php_hash_init_func_t) PHP_RIPEMD160Init,
        (php_hash_update_func_t) PHP_RIPEMD160Update,
        (php_hash_final_func_t) PHP_RIPEMD160Final,
@@ -43,7 +43,7 @@ php_hash_ops php_hash_ripemd160_ops = {
        sizeof(PHP_RIPEMD160_CTX)
 };
 
-php_hash_ops php_hash_ripemd256_ops = {
+const php_hash_ops php_hash_ripemd256_ops = {
        (php_hash_init_func_t) PHP_RIPEMD256Init,
        (php_hash_update_func_t) PHP_RIPEMD256Update,
        (php_hash_final_func_t) PHP_RIPEMD256Final,
@@ -52,7 +52,7 @@ php_hash_ops php_hash_ripemd256_ops = {
        sizeof(PHP_RIPEMD256_CTX)
 };
 
-php_hash_ops php_hash_ripemd320_ops = {
+const php_hash_ops php_hash_ripemd320_ops = {
        (php_hash_init_func_t) PHP_RIPEMD320Init,
        (php_hash_update_func_t) PHP_RIPEMD320Update,
        (php_hash_final_func_t) PHP_RIPEMD320Final,
@@ -139,36 +139,36 @@ PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX * context)
 #define F3(x,y,z)              (((x) & (z)) | ((y) & (~(z))))
 #define F4(x,y,z)              ((x) ^ ((y) | (~(z))))
 
-static php_hash_uint32 K_values[5]  = { 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E };    /* 128, 256, 160, 320 */
-static php_hash_uint32 KK_values[4] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x00000000 };                /* 128 & 256 */
-static php_hash_uint32 KK160_values[5] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000 }; /* 160 & 320 */
+static const php_hash_uint32 K_values[5]  = { 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E };    /* 128, 256, 160, 320 */
+static const php_hash_uint32 KK_values[4] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x00000000 };                /* 128 & 256 */
+static const php_hash_uint32 KK160_values[5] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000 }; /* 160 & 320 */
 
 #define K(n)  K_values[ (n) >> 4]
 #define KK(n) KK_values[(n) >> 4]
 #define KK160(n) KK160_values[(n) >> 4]
 
-static unsigned char R[80] = {
+static const unsigned char R[80] = {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
         7,  4, 13,  1, 10,  6, 15,  3, 12,  0,  9,  5,  2, 14, 11,  8,
         3, 10, 14,  4,  9, 15,  8,  1,  2,  7,  0,  6, 13, 11,  5, 12,
         1,  9, 11, 10,  0,  8, 12,  4, 13,  3,  7, 15, 14,  5,  6,  2,
         4,  0,  5,  9,  7, 12,  2, 10, 14,  1,  3,  8, 11,  6, 15, 13 };
 
-static unsigned char RR[80] = {
+static const unsigned char RR[80] = {
         5, 14,  7,  0,  9,  2, 11,  4, 13,  6, 15,  8,  1, 10,  3, 12,
         6, 11,  3,  7,  0, 13,  5, 10, 14, 15,  8, 12,  4,  9,  1,  2,
        15,  5,  1,  3,  7, 14,  6,  9, 11,  8, 12,  2, 10,  0,  4, 13,
         8,  6,  4,  1,  3, 11, 15,  0,  5, 12,  2, 13,  9,  7, 10, 14,
        12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11 };
 
-static unsigned char S[80] = {
+static const unsigned char S[80] = {
        11, 14, 15, 12,  5,  8,  7,  9, 11, 13, 14, 15,  6,  7,  9,  8,
         7,  6,  8, 13, 11,  9,  7, 15,  7, 12, 15,  9, 11,  7, 13, 12,
        11, 13,  6,  7, 14,  9, 13, 15, 14,  8, 13,  6,  5, 12,  7,  5,
        11, 12, 14, 15, 14, 15,  9,  8,  9, 14,  5,  6,  8,  6,  5, 12,
         9, 15,  5, 11,  6,  8, 13, 12,  5, 12, 13, 14, 11,  8,  5,  6 };
 
-static unsigned char SS[80] = {
+static const unsigned char SS[80] = {
         8,  9,  9, 11, 13, 15, 15,  5,  7,  7,  8, 11, 14, 14, 12,  6,
         9, 13, 15,  7, 12,  8,  9, 11,  7,  7, 12,  7,  6, 15, 13, 11,
         9,  7, 15, 11,  8,  6,  6, 14, 12, 13,  5, 14, 13, 13,  7,  5,
@@ -589,7 +589,7 @@ PHP_HASH_API void PHP_RIPEMD320Update(PHP_RIPEMD320_CTX * context, const unsigne
 }
 /* }}} */
 
-static unsigned char PADDING[64] =
+static const unsigned char PADDING[64] =
 {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
index 82496d58f874e7dd02371218524eea5444cb8a23..ea477106d2a85c59abb6b8bf73b039e32ce36af2 100644 (file)
@@ -194,7 +194,7 @@ PHP_HASH_API void PHP_SALSAFinal(unsigned char digest[64], PHP_SALSA_CTX *contex
        memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_salsa10_ops = {
+const php_hash_ops php_hash_salsa10_ops = {
        (php_hash_init_func_t) PHP_SALSA10Init,
        (php_hash_update_func_t) PHP_SALSAUpdate,
        (php_hash_final_func_t) PHP_SALSAFinal,
@@ -203,7 +203,7 @@ php_hash_ops php_hash_salsa10_ops = {
        sizeof(PHP_SALSA_CTX)
 };
 
-php_hash_ops php_hash_salsa20_ops = {
+const php_hash_ops php_hash_salsa20_ops = {
        (php_hash_init_func_t) PHP_SALSA20Init,
        (php_hash_update_func_t) PHP_SALSAUpdate,
        (php_hash_final_func_t) PHP_SALSAFinal,
index 438939f5b2ddf35d42bffe0bf359c3ecaea89cd8..f2345bd51ee44eab08d06eae84b91fe28eba65a4 100644 (file)
@@ -22,7 +22,7 @@
 #include "php_hash.h"
 #include "php_hash_sha.h"
 
-static unsigned char PADDING[128] =
+static const unsigned char PADDING[128] =
 {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -66,7 +66,7 @@ static void SHADecode32(php_hash_uint32 *output, const unsigned char *input, uns
 }
 /* }}} */
 
-php_hash_ops php_hash_sha1_ops = {
+const php_hash_ops php_hash_sha1_ops = {
        (php_hash_init_func_t) PHP_SHA1Init,
        (php_hash_update_func_t) PHP_SHA1Update,
        (php_hash_final_func_t) PHP_SHA1Final,
@@ -77,7 +77,7 @@ php_hash_ops php_hash_sha1_ops = {
 
 /* sha256 */
 
-php_hash_ops php_hash_sha256_ops = {
+const php_hash_ops php_hash_sha256_ops = {
        (php_hash_init_func_t) PHP_SHA256Init,
        (php_hash_update_func_t) PHP_SHA256Update,
        (php_hash_final_func_t) PHP_SHA256Final,
@@ -103,7 +103,7 @@ php_hash_ops php_hash_sha256_ops = {
 /* OM1 */
 #define SHA256_F5(x)           (ROTR32(17,(x)) ^ ROTR32(19,(x)) ^ SHR(10,(x)))
 
-static php_hash_uint32 SHA256_K[64] = {
+static const php_hash_uint32 SHA256_K[64] = {
        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
@@ -265,7 +265,7 @@ PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX * con
 /* OM1 */
 #define SHA512_F5(x)                   (ROTR64(19, x) ^ ROTR64(61, x) ^ SHR(6, x))
 
-static php_hash_uint64 SHA512_K[128] = {
+static const php_hash_uint64 SHA512_K[128] = {
        L64(0x428a2f98d728ae22), L64(0x7137449123ef65cd), L64(0xb5c0fbcfec4d3b2f), L64(0xe9b5dba58189dbbc),
        L64(0x3956c25bf348b538), L64(0x59f111f1b605d019), L64(0x923f82a4af194f9b), L64(0xab1c5ed5da6d8118),
        L64(0xd807aa98a3030242), L64(0x12835b0145706fbe), L64(0x243185be4ee4b28c), L64(0x550c7dc3d5ffb4e2),
@@ -472,7 +472,7 @@ PHP_HASH_API void PHP_SHA384Final(unsigned char digest[48], PHP_SHA384_CTX * con
 }
 /* }}} */
 
-php_hash_ops php_hash_sha384_ops = {
+const php_hash_ops php_hash_sha384_ops = {
        (php_hash_init_func_t) PHP_SHA384Init,
        (php_hash_update_func_t) PHP_SHA384Update,
        (php_hash_final_func_t) PHP_SHA384Final,
@@ -585,7 +585,7 @@ PHP_HASH_API void PHP_SHA512Final(unsigned char digest[48], PHP_SHA512_CTX * con
 }
 /* }}} */
 
-php_hash_ops php_hash_sha512_ops = {
+const php_hash_ops php_hash_sha512_ops = {
        (php_hash_init_func_t) PHP_SHA512Init,
        (php_hash_update_func_t) PHP_SHA512Update,
        (php_hash_final_func_t) PHP_SHA512Final,
index b5f7b9f797ed802e5698873d2c568b746852c4ab..6e57b3400f97c9ea72d600b29ab273e9582e4fe1 100644 (file)
@@ -193,7 +193,7 @@ PHP_HASH_API void PHP_SNEFRUFinal(unsigned char digest[32], PHP_SNEFRU_CTX *cont
        memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_snefru_ops = {
+const php_hash_ops php_hash_snefru_ops = {
        (php_hash_init_func_t) PHP_SNEFRUInit,
        (php_hash_update_func_t) PHP_SNEFRUUpdate,
        (php_hash_final_func_t) PHP_SNEFRUFinal,
index a800c1c268a3e609fa93fdc0ef9ebc273f0f3ea2..6e3e7dc2b720dd833c58f76e7c0cb6194c58267a 100644 (file)
@@ -288,7 +288,7 @@ PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *con
 }
 
 #define PHP_HASH_TIGER_OPS(p, b) \
-       php_hash_ops php_hash_##p##tiger##b##_ops = { \
+       const php_hash_ops php_hash_##p##tiger##b##_ops = { \
                (php_hash_init_func_t) PHP_##p##TIGERInit, \
                (php_hash_update_func_t) PHP_TIGERUpdate, \
                (php_hash_final_func_t) PHP_TIGER##b##Final, \
index c9f8caa2adacfeb94bca49745dac46a87dfae56e..47f105b38ebada4659c92bc85a3806b0d36a8cc6 100644 (file)
@@ -433,7 +433,7 @@ PHP_HASH_API void PHP_WHIRLPOOLFinal(unsigned char digest[64], PHP_WHIRLPOOL_CTX
     memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_whirlpool_ops = {
+const php_hash_ops php_hash_whirlpool_ops = {
        (php_hash_init_func_t) PHP_WHIRLPOOLInit,
        (php_hash_update_func_t) PHP_WHIRLPOOLUpdate,
        (php_hash_final_func_t) PHP_WHIRLPOOLFinal,
index 19ae33eacaa46824c814ed5bcb5f61962446b99e..16d4046af9168162bbb2e9a0594c933c586fd08d 100644 (file)
@@ -45,38 +45,38 @@ typedef struct _php_hash_ops {
 } php_hash_ops;
 
 typedef struct _php_hash_data {
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        void *context;
 
        long options;
        unsigned char *key;
 } php_hash_data;
 
-extern php_hash_ops php_hash_md2_ops;
-extern php_hash_ops php_hash_md4_ops;
-extern php_hash_ops php_hash_md5_ops;
-extern php_hash_ops php_hash_sha1_ops;
-extern php_hash_ops php_hash_sha256_ops;
-extern php_hash_ops php_hash_sha384_ops;
-extern php_hash_ops php_hash_sha512_ops;
-extern php_hash_ops php_hash_ripemd128_ops;
-extern php_hash_ops php_hash_ripemd160_ops;
-extern php_hash_ops php_hash_ripemd256_ops;
-extern php_hash_ops php_hash_ripemd320_ops;
-extern php_hash_ops php_hash_whirlpool_ops;
-extern php_hash_ops php_hash_3tiger128_ops;
-extern php_hash_ops php_hash_3tiger160_ops;
-extern php_hash_ops php_hash_3tiger192_ops;
-extern php_hash_ops php_hash_4tiger128_ops;
-extern php_hash_ops php_hash_4tiger160_ops;
-extern php_hash_ops php_hash_4tiger192_ops;
-extern php_hash_ops php_hash_snefru_ops;
-extern php_hash_ops php_hash_gost_ops;
-extern php_hash_ops php_hash_adler32_ops;
-extern php_hash_ops php_hash_crc32_ops;
-extern php_hash_ops php_hash_crc32b_ops;
-
-#define PHP_HASH_HAVAL_OPS(p,b)        extern php_hash_ops php_hash_##p##haval##b##_ops;
+extern const php_hash_ops php_hash_md2_ops;
+extern const php_hash_ops php_hash_md4_ops;
+extern const php_hash_ops php_hash_md5_ops;
+extern const php_hash_ops php_hash_sha1_ops;
+extern const php_hash_ops php_hash_sha256_ops;
+extern const php_hash_ops php_hash_sha384_ops;
+extern const php_hash_ops php_hash_sha512_ops;
+extern const php_hash_ops php_hash_ripemd128_ops;
+extern const php_hash_ops php_hash_ripemd160_ops;
+extern const php_hash_ops php_hash_ripemd256_ops;
+extern const php_hash_ops php_hash_ripemd320_ops;
+extern const php_hash_ops php_hash_whirlpool_ops;
+extern const php_hash_ops php_hash_3tiger128_ops;
+extern const php_hash_ops php_hash_3tiger160_ops;
+extern const php_hash_ops php_hash_3tiger192_ops;
+extern const php_hash_ops php_hash_4tiger128_ops;
+extern const php_hash_ops php_hash_4tiger160_ops;
+extern const php_hash_ops php_hash_4tiger192_ops;
+extern const php_hash_ops php_hash_snefru_ops;
+extern const php_hash_ops php_hash_gost_ops;
+extern const php_hash_ops php_hash_adler32_ops;
+extern const php_hash_ops php_hash_crc32_ops;
+extern const php_hash_ops php_hash_crc32b_ops;
+
+#define PHP_HASH_HAVAL_OPS(p,b)        extern const php_hash_ops php_hash_##p##haval##b##_ops;
 
 PHP_HASH_HAVAL_OPS(3,128)
 PHP_HASH_HAVAL_OPS(3,160)
@@ -120,8 +120,8 @@ PHP_FUNCTION(hash_update_file);
 PHP_FUNCTION(hash_final);
 PHP_FUNCTION(hash_algos);
 
-PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len);
-PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops);
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len);
+PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops);
 
 static inline void php_hash_bin2hex(char *out, const unsigned char *in, int in_len)
 {