@@ -403,18 +403,19 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
403
403
404
404
salt_len = MIN (strcspn (salt , "$" ), SALT_LEN_MAX );
405
405
key_len = strlen (key );
406
- ALLOCA_FLAG (use_heap );
407
406
char * tmp_key = NULL ;
407
+ ALLOCA_FLAG (use_heap_key );
408
408
char * tmp_salt = NULL ;
409
+ ALLOCA_FLAG (use_heap_salt );
409
410
410
411
if ((key - (char * ) 0 ) % __alignof__ (uint64_t ) != 0 ) {
411
- tmp_key = (char * ) do_alloca (key_len + __alignof__ (uint64_t ), use_heap );
412
+ tmp_key = (char * ) do_alloca (key_len + __alignof__ (uint64_t ), use_heap_key );
412
413
key = copied_key =
413
414
memcpy (tmp_key + __alignof__(uint64_t ) - (tmp_key - (char * ) 0 ) % __alignof__(uint64_t ), key , key_len );
414
415
}
415
416
416
417
if ((salt - (char * ) 0 ) % __alignof__ (uint64_t ) != 0 ) {
417
- tmp_salt = (char * ) do_alloca (salt_len + 1 + __alignof__(uint64_t ), use_heap );
418
+ tmp_salt = (char * ) do_alloca (salt_len + 1 + __alignof__(uint64_t ), use_heap_salt );
418
419
salt = copied_salt = memcpy (tmp_salt + __alignof__(uint64_t ) - (tmp_salt - (char * ) 0 ) % __alignof__(uint64_t ), salt , salt_len );
419
420
copied_salt [salt_len ] = 0 ;
420
421
}
@@ -479,7 +480,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
479
480
sha512_finish_ctx (& alt_ctx , temp_result );
480
481
481
482
/* Create byte sequence P. */
482
- cp = p_bytes = do_alloca (key_len , use_heap );
483
+ cp = p_bytes = do_alloca (key_len , use_heap_key );
483
484
for (cnt = key_len ; cnt >= 64 ; cnt -= 64 ) {
484
485
cp = __php_mempcpy ((void * ) cp , (const void * )temp_result , 64 );
485
486
}
@@ -498,7 +499,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
498
499
sha512_finish_ctx (& alt_ctx , temp_result );
499
500
500
501
/* Create byte sequence S. */
501
- cp = s_bytes = do_alloca (salt_len , use_heap );
502
+ cp = s_bytes = do_alloca (salt_len , use_heap_salt );
502
503
for (cnt = salt_len ; cnt >= 64 ; cnt -= 64 ) {
503
504
cp = __php_mempcpy (cp , temp_result , 64 );
504
505
}
@@ -621,13 +622,13 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
621
622
ZEND_SECURE_ZERO (copied_salt , salt_len );
622
623
}
623
624
if (tmp_key != NULL ) {
624
- free_alloca (tmp_key , use_heap );
625
+ free_alloca (tmp_key , use_heap_key );
625
626
}
626
627
if (tmp_salt != NULL ) {
627
- free_alloca (tmp_salt , use_heap );
628
+ free_alloca (tmp_salt , use_heap_salt );
628
629
}
629
- free_alloca (p_bytes , use_heap );
630
- free_alloca (s_bytes , use_heap );
630
+ free_alloca (p_bytes , use_heap_key );
631
+ free_alloca (s_bytes , use_heap_salt );
631
632
632
633
return buffer ;
633
634
}
0 commit comments