aboutsummaryrefslogtreecommitdiff
path: root/libbb/hash_md5_sha.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-03-29 15:17:00 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-03-29 15:17:00 +0200
commitbd76b75f72f717150b909e8c64edfda725cabe11 (patch)
tree9192bd8526a07bd77e5700f4688ead9c65f22cc6 /libbb/hash_md5_sha.c
parent3253d7fe0097ff15797ee4918e927b0c9d6863a9 (diff)
downloadbusybox-w32-bd76b75f72f717150b909e8c64edfda725cabe11.tar.gz
busybox-w32-bd76b75f72f717150b909e8c64edfda725cabe11.tar.bz2
busybox-w32-bd76b75f72f717150b909e8c64edfda725cabe11.zip
libbb/sha: fix sha-NI instruction detection
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--libbb/hash_md5_sha.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
index 880ffab01..bbe58c77b 100644
--- a/libbb/hash_md5_sha.c
+++ b/libbb/hash_md5_sha.c
@@ -1178,7 +1178,7 @@ void FAST_FUNC sha1_begin(sha1_ctx_t *ctx)
1178 if (!shaNI) { 1178 if (!shaNI) {
1179 unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx; 1179 unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
1180 cpuid(&eax, &ebx, &ecx, &edx); 1180 cpuid(&eax, &ebx, &ecx, &edx);
1181 shaNI = ((ebx >> 29) << 1) - 1; 1181 shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
1182 } 1182 }
1183 if (shaNI > 0) 1183 if (shaNI > 0)
1184 ctx->process_block = sha1_process_block64_shaNI; 1184 ctx->process_block = sha1_process_block64_shaNI;
@@ -1232,7 +1232,7 @@ void FAST_FUNC sha256_begin(sha256_ctx_t *ctx)
1232 if (!shaNI) { 1232 if (!shaNI) {
1233 unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx; 1233 unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
1234 cpuid(&eax, &ebx, &ecx, &edx); 1234 cpuid(&eax, &ebx, &ecx, &edx);
1235 shaNI = ((ebx >> 29) << 1) - 1; 1235 shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
1236 } 1236 }
1237 if (shaNI > 0) 1237 if (shaNI > 0)
1238 ctx->process_block = sha256_process_block64_shaNI; 1238 ctx->process_block = sha256_process_block64_shaNI;