RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

Anthony Scarpino ascarpino at openjdk.java.net
Wed May 11 22:52:50 UTC 2022


On Wed, 11 May 2022 05:52:38 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

>> Hi,
>> 
>> I need a review of this fix to allow a read-only 'src' buffer to be used with SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher operation when a read-only buffer is passed. If the 'src' is read-write, there is no effect on the current operation
>> 
>> The PR also includes a CSR for an API implementation note to the SSLEngine.unwrap. The 'src' buffer may be modified during the decryption operation. 'unwrap()' has had this behavior forever, so there is no compatibility issue with this note. Using the 'src' buffer for in-place decryption was a performance decision.
>> 
>> Tony
>
> src/java.base/share/classes/javax/net/ssl/SSLEngine.java line 677:
> 
>> 675:      * @see     #unwrap(ByteBuffer, ByteBuffer[], int, int)
>> 676:      *
>> 677:      * @implNote The data in {@code src} may be modified during the decryption
> 
> It looks like a note for the API users to me.  Is apiNote tag more appropriate here?

The CSR and this code is changing, the note I was adding was already documented, but its existing wording should be more clear.

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

PR: https://git.openjdk.java.net/jdk/pull/8462



More information about the security-dev mailing list