The DiffieHellman KeyAgreement supports 2 key algorithms: TlsPremasterSecret and Generic. The Generic algorithm is supposed to generate keys of a constant length, keeping leading zeroes as appropriate.
This PR changes the SunPKCS11 implementation to pass a CKA_VALUE_LEN attribute when a fixed length is needed; when the attribute is absent, the PKCS11 provider strips the leading zeroes. Added a check to the existing test cases to verify the fix. The check passes with the fix, fails without it. Other tier1-3 tests continue to pass. ------------- Commit messages: - Fix leading zero handling - Add tests for leading zero handling Changes: https://git.openjdk.org/jdk/pull/27494/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27494&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8368694 Stats: 71 lines in 3 files changed: 50 ins; 13 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/27494.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27494/head:pull/27494 PR: https://git.openjdk.org/jdk/pull/27494
