RFR: 8302017: Allocate BadPaddingException only if it will be thrown

Aleksey Shipilev shade at openjdk.org
Mon Mar 27 08:47:34 UTC 2023


On Thu, 23 Feb 2023 18:15:35 GMT, Ahmed Muhsin <duke at openjdk.org> wrote:

> This change will move the instantiation of BadPaddingException into the branch of the if statement where it is thrown. This will decrease the overhead of calling `unpadV15` and `unpadOAEP`.  Please see the associated work item for past discussions regarding this change.
> 
> The build and tier1 tests pass locally on mac-aarch64.

Drive-by comment: If the exception creation is the problem, maybe we should turn it stackless (overriding the `fillInStackTrace` in the subclass of `BadPaddingException`), assuming this exception does not leak out of the method to the users and/or users do not require the stack trace. This would not put us into security-related discussion whether moving the exception on conditional path improves the fidelity of timing.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/12732#issuecomment-1484745045



More information about the security-dev mailing list