[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox-cvs
Subject: [git commit branch/1_36_stable] libbb/sha: fix sha-NI instruction detection
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2023-03-29 13:50:40
Message-ID: 20230329135046.4921E8369B () busybox ! osuosl ! org
[Download RAW message or body]
commit: https://git.busybox.net/busybox/commit/?id=8d198665a0d09c3f22f3a12234809f46b1c2b04a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_36_stable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
libbb/hash_md5_sha.c | 4 ++--
1 file 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)
if (!shaNI) {
unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 29) << 1) - 1;
+ shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
}
if (shaNI > 0)
ctx->process_block = sha1_process_block64_shaNI;
@@ -1232,7 +1232,7 @@ void FAST_FUNC sha256_begin(sha256_ctx_t *ctx)
if (!shaNI) {
unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 29) << 1) - 1;
+ shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
}
if (shaNI > 0)
ctx->process_block = sha256_process_block64_shaNI;
_______________________________________________
busybox-cvs mailing list
busybox-cvs@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic