Disable instrumentation on mixed Intel SSE C/assembly implementations
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Tue, 14 May 2019 20:14:48 +0000 (23:14 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Wed, 15 May 2019 17:57:59 +0000 (20:57 +0300)
commitd24dae4538dbbda9e6c72a34fae69682cfb2fef0
treee6159441bfad6c5bb479e62d12d5f1f038f9a122
parent3c7ff6bd1c40d5216d6c12b6b28f77fd1a57baa7
Disable instrumentation on mixed Intel SSE C/assembly implementations

* cipher/Makefile.am: Make 'tiger.o' and 'tiger.lo' depend on Makefile;
Add instrumentation option munging.
* cipher/cipher-gcm-intel-pcmul.c (ALWAYS_INLINE)
(NO_INSTRUMENT_FUNCTION, ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE): New.
(reduction, gfmul_pclmul, gfmul_pclmul_aggr4, gfmul_pclmul_aggr8)
(gcm_lsh): Define with 'ASM_FUNC_ATTR_INLINE' instead of 'inline'.
(_gcry_ghash_setup_intel_pclmul, _gcry_ghash_intel_pclmul): Define with
'ASM_FUNC_ATTR'.
* cipher/crc-intel-pcmul.c (ALWAYS_INLINE, NO_INSTRUMENT_FUNCTION)
(ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE): New.
(crc32_reflected_bulk, crc32_reflected_less_than_16, crc32_bulk)
(crc32_less_than_16): Define with 'ASM_FUNC_ATTR_INLINE' instead of
'inline'.
(_gcry_crc32_intel_pclmul, _gcry_crc24rfc2440_intel_pclmul): Define
with 'ASM_FUNC_ATTR'.
* cipher/rijndael-aesni.c (NO_INSTRUMENT_FUNCTION, ASM_FUNC_ATTR)
(ASM_FUNC_ATTR_INLINE, ASM_FUNC_ATTR_NOINLINE): New.
(aes_ocb_get_l, do_aesni_prepare_decryption, do_aesni_enc)
(do_aesni_dec, do_aesni_enc_vec4, do_aesni_dec_vec4, do_aesni_enc_vec8)
(do_aesni_dec_vec8, aesni_ocb_checksum): Define with
'ASM_FUNC_ATTR_INLINE' instead of 'inline'.
(do_aesni_ctr, do_aesni_ctr_4, do_aesni_ctr_8): Define wtih
'ASM_FUNC_ATTR_INLINE'.
(aesni_ocb_enc, aesni_ocb_dec): Define with 'ASM_FUNC_ATTR_NOINLINE'
instead of 'NO_INLINE'.
(_gcry_aes_aesni_do_setkey, _gcry_aes_aesni_prepare_decryption)
(_gcry_aes_aesni_encrypt, _gcry_aes_aesni_cfg_enc)
(_gcry_aes_aesni_cbc_enc, _gcry_aes_aesni_ctr_enc)
(_gcry_aes_aesni_decrypt, _gcry_aes_aesni_cfb_dec)
(_gcry_aes_aesni_cbc_dec, _gcry_aes_aesni_ocb_crypt)
(_gcry_aes_aesni_ocb_auth, _gcry_aes_aesni_xts_enc)
(_gcry_aes_aesni_xts_dec, _gcry_aes_aesni_xts_crypt): Define with
'ASM_FUNC_ATTR'.
* cipher/rijndael-ssse3-amd64.c (ALWAYS_INLINE, NO_INSTRUMENT_FUNCTION)
(ASM_FUNC_ATTR, ASM_FUNC_ATTR_INLINE): New.
(aes_ocb_get_l, do_ssse3_prepare_decryption, do_vpaes_ssse3_enc)
(do_vpaes_ssse3_dec): Define with 'ASM_FUNC_ATTR_INLINE' instead of
'inline'.
(_gcry_aes_ssse3_do_setkey, _gcry_aes_ssse3_prepare_decryption)
(_gcry_aes_ssse3_encrypt, _gcry_aes_ssse3_cfb_enc)
(_gcry_aes_ssse3_cbc_enc, _gcry_aes_ssse3_ctr_enc)
(_gcry_aes_ssse3_decrypt, _gcry_aes_ssse3_cfb_dec)
(_gcry_aes_ssse3_cbc_dec, ssse3_ocb_enc, ssse3_ocb_dec)
(_gcry_aes_ssse3_ocb_crypt, _gcry_aes_ssse3_ocb_auth): Define with
'ASM_FUNC_ATTR'.
* cipher/sha1-intel-shaext.c (NO_INSTRUMENT_FUNCTION)
(ASM_FUNC_ATTR): New.
(_gcry_sha1_transform_intel_shaext): Define with 'ASM_FUNC_ATTR'.
* cipher/sha256-intel-shaext.c (NO_INSTRUMENT_FUNCTION)
(ASM_FUNC_ATTR): New.
(_gcry_sha256_transform_intel_shaext): Define with 'ASM_FUNC_ATTR'.
* configure.ac (ENABLE_INSTRUMENTATION_MUNGING): New.
--

This commit disables instrumentation for mixed C/assembly implementations
for i386 and amd64 that make use of XMM registers. These implementations
use cc as thin assembly front-end and do not tolerate instrumentation
function calls inserted by compiler as those functions may clobber the
XMM registers.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/Makefile.am
cipher/cipher-gcm-intel-pclmul.c
cipher/crc-intel-pclmul.c
cipher/rijndael-aesni.c
cipher/rijndael-ssse3-amd64.c
cipher/sha1-intel-shaext.c
cipher/sha256-intel-shaext.c
configure.ac