Skip to content

Commit a2a3c5b

Browse files
authored
hash: Consistently check for PHP_HASH_INTRIN_SHA_* to guard compilation of SHA256_Transform_shani (#15404)
This fixes the build for amd64 platforms that do not have `HAVE_FUNC_ATTRIBUTE_TARGET`, specifically Alpine/Musl as of now. Closes GH-15384. Related to GH-15312.
1 parent 74bf894 commit a2a3c5b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
As such, passing invalid types to exit/die may now result in a TypeError
1212
being thrown. (Girgias)
1313

14+
- Hash:
15+
. Fix GH-15384 (Build fails on Alpine / Musl for amd64). (timwolla)
16+
1417
- Standard:
1518
. php_uname() now throws ValueErrors on invalid inputs. (Girgias)
1619

ext/hash/hash_sha_ni.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "php_hash.h"
2828
#include "php_hash_sha.h"
2929

30-
#if (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)
30+
#if defined(PHP_HASH_INTRIN_SHA_NATIVE) || defined(PHP_HASH_INTRIN_SHA_RESOLVER)
3131

3232
# include <immintrin.h>
3333

ext/hash/php_hash_sha.h

+2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t
6262
# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET)
6363
# define PHP_HASH_INTRIN_SHA_RESOLVER 1
6464
# endif
65+
#endif
6566

67+
#if defined(PHP_HASH_INTRIN_SHA_NATIVE) || defined(PHP_HASH_INTRIN_SHA_RESOLVER)
6668
void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]);
6769
#endif
6870

0 commit comments

Comments
 (0)