diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-12-13 16:14:05 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-12-13 16:14:05 +0200 |
commit | 04615cc6803cdede25fa92e3ff697e252a23cd7a (patch) | |
tree | 854c4e4e71836322ad8d0f7ec29571b7e23c486b /cipher | |
parent | 764643a3d5634bcbc47790bd8505f6a1a5280d9c (diff) | |
download | libgcrypt-04615cc6803cdede25fa92e3ff697e252a23cd7a.tar.gz |
Add missing register clearing in to SHA-256 and SHA-512 assembly
* cipher/sha256-ssse3-amd64.S: Clear used XMM/YMM registers at return.
* cipher/sha512-avx-amd64.S: Ditto.
* cipher/sha512-avx2-bmi2-amd64.S: Ditto.
* cipher/sha512-ssse3-amd64.S: Ditto.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/sha256-ssse3-amd64.S | 14 | ||||
-rw-r--r-- | cipher/sha512-avx-amd64.S | 14 | ||||
-rw-r--r-- | cipher/sha512-avx2-bmi2-amd64.S | 14 | ||||
-rw-r--r-- | cipher/sha512-ssse3-amd64.S | 7 |
4 files changed, 49 insertions, 0 deletions
diff --git a/cipher/sha256-ssse3-amd64.S b/cipher/sha256-ssse3-amd64.S index 06070d10..bcf0e194 100644 --- a/cipher/sha256-ssse3-amd64.S +++ b/cipher/sha256-ssse3-amd64.S @@ -481,6 +481,20 @@ _gcry_sha256_transform_amd64_ssse3: cmp INP, [rsp + _INP_END] jne .Loop0 + pxor xmm0, xmm0 + pxor xmm1, xmm1 + pxor xmm2, xmm2 + pxor xmm3, xmm3 + pxor xmm4, xmm4 + pxor xmm5, xmm5 + pxor xmm6, xmm6 + pxor xmm7, xmm7 + pxor xmm8, xmm8 + pxor xmm9, xmm9 + pxor xmm10, xmm10 + pxor xmm11, xmm11 + pxor xmm12, xmm12 + .Ldone_hash: add rsp, STACK_SIZE diff --git a/cipher/sha512-avx-amd64.S b/cipher/sha512-avx-amd64.S index 691d771f..900936ee 100644 --- a/cipher/sha512-avx-amd64.S +++ b/cipher/sha512-avx-amd64.S @@ -267,6 +267,8 @@ _gcry_sha512_transform_amd64_avx: cmp msglen, 0 je .Lnowork + vzeroupper + /* Allocate Stack Space */ sub rsp, frame_size @@ -346,6 +348,18 @@ _gcry_sha512_transform_amd64_avx: /* Restore Stack Pointer */ add rsp, frame_size + vzeroupper + pxor xmm0, xmm0 + pxor xmm1, xmm1 + pxor xmm2, xmm2 + pxor xmm3, xmm3 + pxor xmm4, xmm4 + pxor xmm5, xmm5 + pxor xmm6, xmm6 + pxor xmm7, xmm7 + pxor xmm8, xmm8 + pxor xmm9, xmm9 + /* Return stack burn depth */ mov rax, frame_size diff --git a/cipher/sha512-avx2-bmi2-amd64.S b/cipher/sha512-avx2-bmi2-amd64.S index 878c41b5..9ece4fda 100644 --- a/cipher/sha512-avx2-bmi2-amd64.S +++ b/cipher/sha512-avx2-bmi2-amd64.S @@ -604,6 +604,8 @@ _gcry_sha512_transform_amd64_avx2: cmp rdx, 0 je .Lnowork + vzeroupper + /* Allocate Stack Space */ mov rax, rsp sub rsp, frame_size @@ -717,6 +719,18 @@ _gcry_sha512_transform_amd64_avx2: /* Restore Stack Pointer */ mov rsp, [rsp + frame_RSPSAVE] + vzeroupper + pxor xmm0, xmm0 + pxor xmm1, xmm1 + pxor xmm2, xmm2 + pxor xmm3, xmm3 + pxor xmm4, xmm4 + pxor xmm5, xmm5 + pxor xmm6, xmm6 + pxor xmm7, xmm7 + pxor xmm8, xmm8 + pxor xmm9, xmm9 + mov rax, frame_size .Lnowork: ret diff --git a/cipher/sha512-ssse3-amd64.S b/cipher/sha512-ssse3-amd64.S index 2a719e5d..4c80baa3 100644 --- a/cipher/sha512-ssse3-amd64.S +++ b/cipher/sha512-ssse3-amd64.S @@ -348,6 +348,13 @@ _gcry_sha512_transform_amd64_ssse3: /* Restore Stack Pointer */ add rsp, frame_size + pxor xmm0, xmm0 + pxor xmm1, xmm1 + pxor xmm2, xmm2 + pxor xmm3, xmm3 + pxor xmm4, xmm4 + pxor xmm5, xmm5 + /* Return stack burn depth */ mov rax, frame_size |