@@ -151,11 +151,11 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
151
151
size_t n ;
152
152
153
153
while ((n = php_stream_read (stream , buf , sizeof (buf ))) > 0 ) {
154
- ops -> hash_update (context , (unsigned char * ) buf , n );
154
+ ops -> hash_update (context , (unsigned char * ) buf , ( unsigned int ) n );
155
155
}
156
156
php_stream_close (stream );
157
157
} else {
158
- ops -> hash_update (context , (unsigned char * ) data , data_len );
158
+ ops -> hash_update (context , (unsigned char * ) data , ( unsigned int ) data_len );
159
159
}
160
160
161
161
digest = zend_string_alloc (ops -> digest_size , 0 );
@@ -213,7 +213,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
213
213
if (key_len > (size_t )ops -> block_size ) {
214
214
/* Reduce the key first */
215
215
ops -> hash_init (context );
216
- ops -> hash_update (context , key , key_len );
216
+ ops -> hash_update (context , key , ( unsigned int ) key_len );
217
217
ops -> hash_final (K , context );
218
218
} else {
219
219
memcpy (K , key , key_len );
@@ -225,7 +225,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
225
225
static inline void php_hash_hmac_round (unsigned char * final , const php_hash_ops * ops , void * context , const unsigned char * key , const unsigned char * data , const zend_long data_size ) {
226
226
ops -> hash_init (context );
227
227
ops -> hash_update (context , key , ops -> block_size );
228
- ops -> hash_update (context , data , data_size );
228
+ ops -> hash_update (context , data , ( unsigned int ) data_size );
229
229
ops -> hash_final (final , context );
230
230
}
231
231
@@ -276,11 +276,11 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
276
276
277
277
if (isfilename ) {
278
278
char buf [1024 ];
279
- int n ;
279
+ size_t n ;
280
280
ops -> hash_init (context );
281
281
ops -> hash_update (context , K , ops -> block_size );
282
282
while ((n = php_stream_read (stream , buf , sizeof (buf ))) > 0 ) {
283
- ops -> hash_update (context , (unsigned char * ) buf , n );
283
+ ops -> hash_update (context , (unsigned char * ) buf , ( unsigned int ) n );
284
284
}
285
285
php_stream_close (stream );
286
286
ops -> hash_final ((unsigned char * ) ZSTR_VAL (digest ), context );
@@ -379,7 +379,7 @@ static void php_hashcontext_ctor(INTERNAL_FUNCTION_PARAMETERS, zval *objval) {
379
379
380
380
if (ZSTR_LEN (key ) > (size_t )ops -> block_size ) {
381
381
/* Reduce the key first */
382
- ops -> hash_update (context , (unsigned char * ) ZSTR_VAL (key ), ZSTR_LEN (key ));
382
+ ops -> hash_update (context , (unsigned char * ) ZSTR_VAL (key ), ( unsigned int ) ZSTR_LEN (key ));
383
383
ops -> hash_final ((unsigned char * ) K , context );
384
384
/* Make the context ready to start over */
385
385
ops -> hash_init (context );
@@ -427,7 +427,7 @@ PHP_FUNCTION(hash_update)
427
427
428
428
hash = php_hashcontext_from_object (Z_OBJ_P (zhash ));
429
429
PHP_HASHCONTEXT_VERIFY ("hash_update" , hash );
430
- hash -> ops -> hash_update (hash -> context , (unsigned char * ) ZSTR_VAL (data ), ZSTR_LEN (data ));
430
+ hash -> ops -> hash_update (hash -> context , (unsigned char * ) ZSTR_VAL (data ), ( unsigned int ) ZSTR_LEN (data ));
431
431
432
432
RETURN_TRUE ;
433
433
}
@@ -462,7 +462,7 @@ PHP_FUNCTION(hash_update_stream)
462
462
/* Nada mas */
463
463
RETURN_LONG (didread );
464
464
}
465
- hash -> ops -> hash_update (hash -> context , (unsigned char * ) buf , n );
465
+ hash -> ops -> hash_update (hash -> context , (unsigned char * ) buf , ( unsigned int ) n );
466
466
length -= n ;
467
467
didread += n ;
468
468
}
@@ -498,7 +498,7 @@ PHP_FUNCTION(hash_update_file)
498
498
}
499
499
500
500
while ((n = php_stream_read (stream , buf , sizeof (buf ))) > 0 ) {
501
- hash -> ops -> hash_update (hash -> context , (unsigned char * ) buf , n );
501
+ hash -> ops -> hash_update (hash -> context , (unsigned char * ) buf , ( unsigned int ) n );
502
502
}
503
503
php_stream_close (stream );
504
504
@@ -671,7 +671,7 @@ PHP_FUNCTION(hash_hkdf)
671
671
// Expand
672
672
returnval = zend_string_alloc (length , 0 );
673
673
digest = emalloc (ops -> digest_size );
674
- for (i = 1 , rounds = (length - 1 ) / ops -> digest_size + 1 ; i <= rounds ; i ++ ) {
674
+ for (i = 1 , rounds = (int )( length - 1 ) / ops -> digest_size + 1 ; i <= rounds ; i ++ ) {
675
675
// chr(i)
676
676
unsigned char c [1 ];
677
677
c [0 ] = (i & 0xFF );
@@ -685,7 +685,7 @@ PHP_FUNCTION(hash_hkdf)
685
685
}
686
686
687
687
if (info != NULL && ZSTR_LEN (info ) > 0 ) {
688
- ops -> hash_update (context , (unsigned char * ) ZSTR_VAL (info ), ZSTR_LEN (info ));
688
+ ops -> hash_update (context , (unsigned char * ) ZSTR_VAL (info ), ( unsigned int ) ZSTR_LEN (info ));
689
689
}
690
690
691
691
ops -> hash_update (context , c , 1 );
@@ -831,7 +831,7 @@ PHP_FUNCTION(hash_pbkdf2)
831
831
if (raw_output ) {
832
832
memcpy (ZSTR_VAL (returnval ), result , length );
833
833
} else {
834
- php_hash_bin2hex (ZSTR_VAL (returnval ), result , digest_length );
834
+ php_hash_bin2hex (ZSTR_VAL (returnval ), result , ( unsigned int ) digest_length );
835
835
}
836
836
ZSTR_VAL (returnval )[length ] = 0 ;
837
837
efree (result );
@@ -1083,8 +1083,8 @@ PHP_FUNCTION(mhash_keygen_s2k)
1083
1083
for (j = 0 ;j < i ;j ++ ) {
1084
1084
ops -> hash_update (context , & null , 1 );
1085
1085
}
1086
- ops -> hash_update (context , (unsigned char * )padded_salt , salt_len );
1087
- ops -> hash_update (context , (unsigned char * )password , password_len );
1086
+ ops -> hash_update (context , (unsigned char * )padded_salt , ( unsigned int ) salt_len );
1087
+ ops -> hash_update (context , (unsigned char * )password , ( unsigned int ) password_len );
1088
1088
ops -> hash_final ((unsigned char * )digest , context );
1089
1089
memcpy ( & key [i * block_size ], digest , block_size );
1090
1090
}
0 commit comments