Skip to content

Commit

Permalink
Algorithms renamed for alignment with SunJCE.
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Balao Alonso <[email protected]>
Co-authored-by: Francisco Ferrari Bihurriet <[email protected]>
  • Loading branch information
martinuy and franferrax committed Nov 18, 2024
1 parent e87ec99 commit 0c13f2c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ static final class P12MacPBEKeyInfo extends PBEKeyInfo {
putKeyInfo(new HMACKeyInfo("SslMacMD5", CKM_SSL3_MD5_MAC, 128));
putKeyInfo(new HMACKeyInfo("SslMacSHA1", CKM_SSL3_SHA1_MAC, 160));

putKeyInfo(new HKDFKeyInfo("HKDFWithHmacSHA1", hmacSHA1));
putKeyInfo(new HKDFKeyInfo("HKDFWithHmacSHA224", hmacSHA224));
putKeyInfo(new HKDFKeyInfo("HKDFWithHmacSHA256", hmacSHA256));
putKeyInfo(new HKDFKeyInfo("HKDFWithHmacSHA384", hmacSHA384));
putKeyInfo(new HKDFKeyInfo("HKDFWithHmacSHA512", hmacSHA512));
putKeyInfo(new HKDFKeyInfo("HKDF-SHA1", hmacSHA1));
putKeyInfo(new HKDFKeyInfo("HKDF-SHA224", hmacSHA224));
putKeyInfo(new HKDFKeyInfo("HKDF-SHA256", hmacSHA256));
putKeyInfo(new HKDFKeyInfo("HKDF-SHA384", hmacSHA384));
putKeyInfo(new HKDFKeyInfo("HKDF-SHA512", hmacSHA512));

putKeyInfo(new AESPBEKeyInfo("PBEWithHmacSHA1AndAES_128",
CKP_PKCS5_PBKD2_HMAC_SHA1, 128));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,15 +1080,15 @@ private static void register(Descriptor d) {
d(KG, "SunTls12Prf", "sun.security.pkcs11.P11TlsPrfGenerator",
m(CKM_TLS_MAC));

d(KDF, "HKDFWithHmacSHA1", P11KDF, m(CKM_SHA_1_HMAC),
d(KDF, "HKDF-SHA1", P11KDF, m(CKM_SHA_1_HMAC),
m(CKM_HKDF_DERIVE, CKM_HKDF_DATA));
d(KDF, "HKDFWithHmacSHA224", P11KDF, m(CKM_SHA224_HMAC),
d(KDF, "HKDF-SHA224", P11KDF, m(CKM_SHA224_HMAC),
m(CKM_HKDF_DERIVE, CKM_HKDF_DATA));
d(KDF, "HKDFWithHmacSHA256", P11KDF, m(CKM_SHA256_HMAC),
d(KDF, "HKDF-SHA256", P11KDF, m(CKM_SHA256_HMAC),
m(CKM_HKDF_DERIVE, CKM_HKDF_DATA));
d(KDF, "HKDFWithHmacSHA384", P11KDF, m(CKM_SHA384_HMAC),
d(KDF, "HKDF-SHA384", P11KDF, m(CKM_SHA384_HMAC),
m(CKM_HKDF_DERIVE, CKM_HKDF_DATA));
d(KDF, "HKDFWithHmacSHA512", P11KDF, m(CKM_SHA512_HMAC),
d(KDF, "HKDF-SHA512", P11KDF, m(CKM_SHA512_HMAC),
m(CKM_HKDF_DERIVE, CKM_HKDF_DATA));
}

Expand Down
42 changes: 21 additions & 21 deletions test/jdk/sun/security/pkcs11/KDF/TestHKDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ private static SecretKey getTlsPremasterSecretWithECDHExchange(String s,

private static void test_RFC_5869_case_1() {
executeTest("RFC 5869 - Test Case 1",
"HKDFWithHmacSHA256",
"HKDF-SHA256",
"Generic",
"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"000102030405060708090a0b0c",
Expand All @@ -439,7 +439,7 @@ private static void test_RFC_5869_case_1() {

private static void test_RFC_5869_case_2() {
executeTest("RFC 5869 - Test Case 2",
"HKDFWithHmacSHA256",
"HKDF-SHA256",
"Generic",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d" +
"1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b" +
Expand All @@ -461,7 +461,7 @@ private static void test_RFC_5869_case_2() {

private static void test_RFC_5869_case_3() {
executeTest("RFC 5869 - Test Case 3",
"HKDFWithHmacSHA256",
"HKDF-SHA256",
"Generic",
"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
null,
Expand All @@ -476,7 +476,7 @@ private static void test_RFC_5869_case_3() {

private static void test_RFC_5869_case_4() {
executeTest("RFC 5869 - Test Case 4",
"HKDFWithHmacSHA1",
"HKDF-SHA1",
"Generic",
"0b0b0b0b0b0b0b0b0b0b0b",
"000102030405060708090a0b0c",
Expand All @@ -490,7 +490,7 @@ private static void test_RFC_5869_case_4() {

private static void test_RFC_5869_case_5() {
executeTest("RFC 5869 - Test Case 5",
"HKDFWithHmacSHA1",
"HKDF-SHA1",
"Generic",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d" +
"1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b" +
Expand All @@ -511,7 +511,7 @@ private static void test_RFC_5869_case_5() {

private static void test_RFC_5869_case_6() {
executeTest("RFC 5869 - Test Case 6",
"HKDFWithHmacSHA1",
"HKDF-SHA1",
"Generic",
"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
null,
Expand All @@ -525,7 +525,7 @@ private static void test_RFC_5869_case_6() {

private static void test_RFC_5869_case_7() {
executeTest("RFC 5869 - Test Case 7",
"HKDFWithHmacSHA1",
"HKDF-SHA1",
"Generic",
"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
"0000000000000000000000000000000000000000",
Expand All @@ -538,8 +538,8 @@ private static void test_RFC_5869_case_7() {
}

private static void test_AES_HKDFWithHmacSHA1() {
executeTest("AES - HKDFWithHmacSHA1",
"HKDFWithHmacSHA1",
executeTest("AES - HKDF-SHA1",
"HKDF-SHA1",
"AES",
"000102030405060708090a0b0c0d0e0f",
"101112131415161718191a1b1c1d1e1f",
Expand All @@ -552,8 +552,8 @@ private static void test_AES_HKDFWithHmacSHA1() {
}

private static void test_AES_HKDFWithHmacSHA224() {
executeTest("AES - HKDFWithHmacSHA224",
"HKDFWithHmacSHA224",
executeTest("AES - HKDF-SHA224",
"HKDF-SHA224",
"AES",
"000102030405060708090a0b0c0d0e0f",
"101112131415161718191a1b1c1d1e1f",
Expand All @@ -566,8 +566,8 @@ private static void test_AES_HKDFWithHmacSHA224() {
}

private static void test_AES_HKDFWithHmacSHA256() {
executeTest("AES - HKDFWithHmacSHA256",
"HKDFWithHmacSHA256",
executeTest("AES - HKDF-SHA256",
"HKDF-SHA256",
"AES",
"000102030405060708090a0b0c0d0e0f",
"101112131415161718191a1b1c1d1e1f",
Expand All @@ -581,8 +581,8 @@ private static void test_AES_HKDFWithHmacSHA256() {
}

private static void test_AES_HKDFWithHmacSHA384() {
executeTest("AES - HKDFWithHmacSHA384",
"HKDFWithHmacSHA384",
executeTest("AES - HKDF-SHA384",
"HKDF-SHA384",
"AES",
"000102030405060708090a0b0c0d0e0f",
"101112131415161718191a1b1c1d1e1f",
Expand All @@ -596,8 +596,8 @@ private static void test_AES_HKDFWithHmacSHA384() {
}

private static void test_AES_HKDFWithHmacSHA512() {
executeTest("AES - HKDFWithHmacSHA512",
"HKDFWithHmacSHA512",
executeTest("AES - HKDF-SHA512",
"HKDF-SHA512",
"AES",
"000102030405060708090a0b0c0d0e0f",
"101112131415161718191a1b1c1d1e1f",
Expand Down Expand Up @@ -634,8 +634,8 @@ private static void test_HKDF_after_DH_HkdfSHA256() throws Exception {
"1015728e5a8aacaa68ffffffffffffffff",
"02"
);
executeTest("Test HKDFWithHmacSHA256 after DH exchange (TLS)",
"HKDFWithHmacSHA256",
executeTest("Test HKDF-SHA256 after DH exchange (TLS)",
"HKDF-SHA256",
"Generic",
tlsPremasterSecret,
null,
Expand All @@ -656,8 +656,8 @@ private static void test_HKDF_after_ECDH_HkdfSHA256() throws Exception {
"34333070929362623",
"531080873930420952237875954830357399317339863932672261700603" +
"26242234504331049");
executeTest("Test HKDFWithHmacSHA256 after ECDH exchange (TLS)",
"HKDFWithHmacSHA256",
executeTest("Test HKDF-SHA256 after ECDH exchange (TLS)",
"HKDF-SHA256",
"Generic",
tlsPremasterSecret,
null,
Expand Down

0 comments on commit 0c13f2c

Please sign in to comment.