-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some hardware accelerated implementations (e.g. aegis256x4_avx2) make use of `vaes` instructions without being gated behind `HAVE_VAESINTRIN_H`. This breaks cross compilation using rust's cross [1] build tool, presumably because the MinGW GCC implementation it packages doesn't support `vaes`. The resulting output of `cross build --target=x86_64-pc-windows-gnu` complains about GCC not knowing `vaes` as an attribute and about the respective intrinsics being unknown: ``` cargo:warning=src/c/libaegis/src/aegis128x2/aegis128x2_avx2.c:16:17: error: attribute(target("vaes")) is unknown cargo:warning= # pragma GCC target("vaes,avx2") cargo:warning= ^~~ cargo:warning=src/c/libaegis/src/aegis128x2/aegis128x2_avx2.c: In function 'aegis128x2_update': cargo:warning=src/c/libaegis/src/aegis128x2/aegis128x2_avx2.c:32:39: warning: implicit declaration of function '_mm256_aesenc_epi128'; did you mean '_mm256_bsrli_epi128'? [-Wimplicit-function-declaration] cargo:warning= # define AES_ENC(A, B) _mm256_aesenc_epi128((A), (B)) cargo:warning= ^ cargo:warning=src/c/libaegis/src/aegis128x2/aegis128x2_avx2.c:40:16: note: in expansion of macro 'AES_ENC' cargo:warning= state[7] = AES_ENC(state[6], state[7]); cargo:warning= ^~~~~~~ cargo:warning=src/c/libaegis/src/aegis128x2/aegis128x2_avx2.c:40:14: error: incompatible types when assigning to type 'aes_block_t {aka __vector(4) long long int}' from type 'int' cargo:warning= state[7] = AES_ENC(state[6], state[7]); cargo:warning= ... ``` This change introduces compile-time checks for `HAVE_VAESINTRIN_H` where they aren't present yet and extends some existing checks in some implementation picking functions (which would produce missing linker targets otherwise). I also took the liberty to change the indentation for all nested pecompiler instructions where I added new #ifdef checks in the effort of keeping the overall code style in line with the other files; however, this makes the diff seem larger than it really is. [1]: https://github.com/cross-rs/cross
- Loading branch information
1 parent
3dac3ad
commit 3ce51b1
Showing
12 changed files
with
88 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters