@@ -62,7 +62,7 @@ typedef union {
62
62
* Hash a single 512-bit block. This is the core of the algorithm.
63
63
*/
64
64
static void
65
- SHA1Transform (uint32_t state [5 ], const unsigned char buffer [64 ])
65
+ SHA1Transform (uint32_t state [5 ], unsigned char buffer [64 ])
66
66
{
67
67
uint32_t a , b , c , d , e ;
68
68
CHAR64LONG16 * block ;
@@ -494,13 +494,13 @@ static void sha1_process_arm(uint32_t state[5], const uint8_t data[], uint32_t l
494
494
__attribute__((always_inline ))
495
495
static inline void
496
496
sha1_transform_generic (uint32_t state [5 ],
497
- const unsigned char * buffer ,
497
+ const unsigned char * data ,
498
498
size_t length )
499
499
{
500
500
assert (length % 64 == 0 );
501
501
502
502
#ifdef HAVE_SSE_SHA
503
- #if __GNUC__ >= 11
503
+ #if __GNUC__ >= 11 || __clang_major__ >= 19
504
504
const bool have_sha = __builtin_cpu_supports ("sha" );
505
505
#else
506
506
static int have_sha = -1 ;
@@ -514,18 +514,21 @@ sha1_transform_generic(uint32_t state[5],
514
514
#endif
515
515
516
516
if (have_sha ) {
517
- sha1_process_x86 (state , buffer , length );
517
+ sha1_process_x86 (state , data , length );
518
518
return ;
519
519
}
520
520
#endif
521
521
522
522
#ifdef HAVE_ARM_CRYPTO
523
- sha1_process_arm (state , buffer , length );
523
+ sha1_process_arm (state , data , length );
524
524
return ;
525
525
#endif
526
526
527
- for (int i = 0 ; i < length ; i += 64 )
528
- SHA1Transform (state , buffer + i );
527
+ unsigned char buffer [64 ];
528
+ for (int i = 0 ; i < length ; i += 64 ) {
529
+ memcpy (buffer , data + i , 64 );
530
+ SHA1Transform (state , buffer );
531
+ }
529
532
}
530
533
531
534
/*
0 commit comments