Skip to content

Set XEC secret buffer size explicitly on z/OS#1493

Merged
jasonkatonica merged 1 commit into
IBM:mainfrom
taoliult:main_dump
May 29, 2026
Merged

Set XEC secret buffer size explicitly on z/OS#1493
jasonkatonica merged 1 commit into
IBM:mainfrom
taoliult:main_dump

Conversation

@taoliult
Copy link
Copy Markdown
Collaborator

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.

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

Comment thread src/main/native/ock/ECKey.c Outdated
Comment thread src/main/native/ock/ECKey.c Outdated
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>
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

@jasonkatonica jasonkatonica merged commit 1df365e into IBM:main May 29, 2026
3 checks passed
Java_com_ibm_crypto_plus_provider_ock_NativeOCKImplementation_XECKEY_1computeECDHSecret(
JNIEnv *env, jclass thisObj, jlong ockContextId, jlong genCtx,
jlong pubXecKeyId, jlong privXecKeyId) {
jlong pubXecKeyId, jlong privXecKeyId, jint secretBufferSize) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Line 2225 should be updated to reflect the new signature.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I will open another PR to correct the signature.

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.

5 participants