summaryrefslogtreecommitdiff
path: root/gcm.cpp
diff options
context:
space:
mode:
authorv1ne <v1ne2go+git@gmail.com>2022-07-29 10:24:02 +0200
committerGitHub <noreply@github.com>2022-07-29 04:24:02 -0400
commite59577b49e2b8221dc5b09bfbd210e83ae4d80c1 (patch)
treebf0a2327e26ad1a31f7617c3c130425973c54f0f /gcm.cpp
parent9ea66ce4d97d59d61e49c93f5af191107ebd1925 (diff)
downloadcryptopp-git-e59577b49e2b8221dc5b09bfbd210e83ae4d80c1.tar.gz
Mark clobbered registers as clobbered in GCM mode (GH #1133)
This resolves failing AES-GCM tests on amd64 with GCC 11 on Linux with SSE2 on and other CPU features off. While here, remove unused r11 and clobber ebx unconditionally. Co-authored-by: v1ne <v1ne2go@gmail.com>
Diffstat (limited to 'gcm.cpp')
-rw-r--r--gcm.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcm.cpp b/gcm.cpp
index 380dc780..5adccc8d 100644
--- a/gcm.cpp
+++ b/gcm.cpp
@@ -559,6 +559,9 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
#endif
#if CRYPTOPP_SSE2_ASM_AVAILABLE
+ #define PERCENT_REG_(x) "%" #x
+ #define PERCENT_REG(x) PERCENT_REG_(x)
+
case 1: // SSE2 and 2K tables
{
#ifdef __GNUC__
@@ -725,10 +728,8 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
ATT_PREFIX
:
: "c" (data), "d" (len/16), "S" (hashBuffer), "D" (s_reductionTable)
- : "memory", "cc", "%eax"
- #if CRYPTOPP_BOOL_X64
- , "%ebx", "%r11"
- #endif
+ : "memory", "cc", "%eax", "%ebx", PERCENT_REG(AS_REG_7), "%xmm0",
+ "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5"
);
#elif defined(CRYPTOPP_GENERATE_X64_MASM)
pop rbx
@@ -804,7 +805,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
ATT_PREFIX
:
: "c" (data), "d" (len/16), "S" (hashBuffer)
- : "memory", "cc", "%edi", "%eax"
+ : "memory", "cc", "%edi", "%eax", "%xmm0", "%xmm1"
);
#elif defined(CRYPTOPP_GENERATE_X64_MASM)
pop rdi