Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Java use AES-NI when available? [duplicate]

I just heard of the instruction set extension AES-NI. Does Java's JIT compiler compile the application to use AES-NI if it is available to enhance performance?

And if yes, does it also do so if it is not sure that AES will be used (like when using TLS)?

like image 320
MinecraftShamrock Avatar asked Dec 03 '25 17:12

MinecraftShamrock


1 Answers

Java 8 and 7u40 and later include support for x86 AES intrinsics for the built-in SunJCE provider, but the feature is not enabled by default (it is).

Search globals.hpp for "AES":

product(bool, UseAES, false,                                              \
        "Control whether AES instructions can be used on x86/x64")        \
...
product(bool, UseAESIntrinsics, false,                                    \
        "Use intrinsics for AES versions of crypto")                      \

You can enable the feature by passing the -XX:+UseAES -XX:+UseAESIntrinsics options to the virtual machine.

like image 121
ntoskrnl Avatar answered Dec 05 '25 06:12

ntoskrnl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!