Skip to content

Validate XDH native secret derivation#1480

Open
taoliult wants to merge 2 commits into
IBM:java25from
taoliult:java25_dump
Open

Validate XDH native secret derivation#1480
taoliult wants to merge 2 commits into
IBM:java25from
taoliult:java25_dump

Conversation

@taoliult
Copy link
Copy Markdown
Collaborator

Add return-code checks for the native XDH secret derivation path, including ICC_EVP_PKEY_derive_init, ICC_EVP_PKEY_derive_set_peer, and the ICC_EVP_PKEY_derive call used to query the secret length.

This is a back port PR from PR: #1411

Add return-code checks for the native XDH secret derivation path,
including ICC_EVP_PKEY_derive_init, ICC_EVP_PKEY_derive_set_peer,
and the ICC_EVP_PKEY_derive call used to query the secret length.

Also validate the derived secret length against the allocated Java
byte array length before returning the result.

Signed-off-by: Tao Liu <tao.liu@ibm.com>
Copy link
Copy Markdown
Member

@jasonkatonica jasonkatonica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@KostasTsiounis KostasTsiounis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taoliult taoliult force-pushed the java25_dump branch 2 times, most recently from 22a164c to 93c9356 Compare May 23, 2026 12:52
Set the expected XEC secret buffer size explicitly on z/OS before
calling the native ECDH secret computation.

On other platforms, the native layer can query the required secret
size by calling ICC_EVP_PKEY_derive. However, this size query does
not work on z/OS.

To handle this platform difference, determine the curve name from
the public key parameters on z/OS and pass the expected secret buffer
size to the native layer.

Other platforms continue to use the ICC_EVP_PKEY_derive size query.

Signed-off-by: Tao Liu <tao.liu@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants