RFR: 8302017: Allocate BadPaddingException only if it will be thrown
Valerie Peng
valeriep at openjdk.org
Wed Jul 12 18:55:25 UTC 2023
On Wed, 12 Jul 2023 16:46:08 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> This change refactors the RSAPadding class to return an output record containing the status instead of relying on exception object to indicate a failure.
>>
>> Thanks in advance for review~
>> Valerie
>
> src/java.base/share/classes/sun/security/rsa/RSAPadding.java line 372:
>
>> 370: return Output.FAIL;
>> 371: } else {
>> 372: return Output.pass(data);
>
> The Output.pass(byte[]) will create a new instance and thus make the behavior detectable. Maybe, the Output class is not necessary, 'null' value return could be used instead.
>
>
> - if (bp) {
> - return Output.FAIL;
> - } else {
> - return Output.pass(data);
> + return bp ? null : data;
Ok, I can change it back to byte[]
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14839#discussion_r1261602015
More information about the security-dev
mailing list