Currently, it seems the library requires explicit RUSTFLAGS to use AES-NI. This is easy to get wrong. It would be much better to autodetect it. Crates like aes successfully use runtime detection of the aes-ni instruction set.
As a related question, the recommended flags are
RUSTFLAGS="-Ctarget-cpu=sandybridge -Ctarget-feature=+aes,+sse2,+sse4.1,+ssse3"
Shouldn't the aes,sse2,sse4.1,ssse3 flags be automatically set on CPUs that support it? Why do we need to specify them manually? If they're automatically set, shouldn't that already be enough to enable the AESNI instruction set without even requiring runtime detection?
Currently, it seems the library requires explicit
RUSTFLAGSto use AES-NI. This is easy to get wrong. It would be much better to autodetect it. Crates likeaessuccessfully use runtime detection of the aes-ni instruction set.As a related question, the recommended flags are
Shouldn't the
aes,sse2,sse4.1,ssse3flags be automatically set on CPUs that support it? Why do we need to specify them manually? If they're automatically set, shouldn't that already be enough to enable the AESNI instruction set without even requiring runtime detection?