|
1 | 1 | package tlsprofiles |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "crypto/tls" |
4 | 5 | "testing" |
5 | 6 |
|
6 | 7 | "github.com/stretchr/testify/require" |
@@ -114,13 +115,15 @@ func TestSetCustomCurves(t *testing.T) { |
114 | 115 | name string |
115 | 116 | result bool |
116 | 117 | }{ |
| 118 | + {"X25519MLKEM768", true}, |
117 | 119 | {"X25519", true}, |
118 | 120 | {"prime256v1", true}, |
119 | 121 | {"secp384r1", true}, |
120 | 122 | {"secp521r1", true}, |
121 | 123 | {"unknown-cuve", false}, |
122 | | - {"X448", false}, // Valid OpenSSL curve, not implemented |
123 | | - {"X25519,prime256v1", true}, // Multiple |
| 124 | + {"X448", false}, // Valid OpenSSL curve, not implemented |
| 125 | + {"X25519,prime256v1", true}, // Multiple |
| 126 | + {"X25519MLKEM768,X25519,prime256v1", true}, // Multiple with new curve |
124 | 127 | } |
125 | 128 |
|
126 | 129 | for _, test := range tests { |
@@ -158,3 +161,34 @@ func TestSetCustomVersion(t *testing.T) { |
158 | 161 | } |
159 | 162 | } |
160 | 163 | } |
| 164 | + |
| 165 | +func TestModernProfileContents(t *testing.T) { |
| 166 | + // Verify modern profile contains X25519MLKEM768 (new in Mozilla v6.0) |
| 167 | + require.Contains(t, modernTLSProfile.curves.curveNums, X25519MLKEM768, "modern profile should include X25519MLKEM768 curve") |
| 168 | + require.Contains(t, modernTLSProfile.curves.curveNums, X25519, "modern profile should include X25519 curve") |
| 169 | + |
| 170 | + // Verify modern profile ciphers |
| 171 | + require.NotEmpty(t, modernTLSProfile.ciphers.cipherNums, "modern profile should have ciphers") |
| 172 | + require.Contains(t, modernTLSProfile.ciphers.cipherNums, tls.TLS_AES_128_GCM_SHA256, "modern profile should include TLS_AES_128_GCM_SHA256") |
| 173 | + require.Contains(t, modernTLSProfile.ciphers.cipherNums, tls.TLS_CHACHA20_POLY1305_SHA256, "modern profile should include TLS_CHACHA20_POLY1305_SHA256") |
| 174 | +} |
| 175 | + |
| 176 | +func TestIntermediateProfileContents(t *testing.T) { |
| 177 | + // Verify intermediate profile contains X25519MLKEM768 (new in Mozilla v6.0) |
| 178 | + require.Contains(t, intermediateTLSProfile.curves.curveNums, X25519MLKEM768, "intermediate profile should include X25519MLKEM768 curve") |
| 179 | + require.Contains(t, intermediateTLSProfile.curves.curveNums, X25519, "intermediate profile should include X25519 curve") |
| 180 | + |
| 181 | + // Verify intermediate profile has TLS 1.2 ciphers |
| 182 | + require.NotEmpty(t, intermediateTLSProfile.ciphers.cipherNums, "intermediate profile should have ciphers") |
| 183 | + require.Greater(t, len(intermediateTLSProfile.ciphers.cipherNums), len(modernTLSProfile.ciphers.cipherNums), "intermediate profile should have more ciphers than modern") |
| 184 | +} |
| 185 | + |
| 186 | +func TestOldProfileContents(t *testing.T) { |
| 187 | + // Verify old profile is preserved from Mozilla v5.8 |
| 188 | + require.Contains(t, oldTLSProfile.curves.curveNums, X25519MLKEM768, "old profile should include X25519MLKEM768 (from v5.8)") |
| 189 | + require.Contains(t, oldTLSProfile.curves.curveNums, X25519, "old profile should include X25519 curve") |
| 190 | + |
| 191 | + // Verify old profile has legacy ciphers |
| 192 | + require.NotEmpty(t, oldTLSProfile.ciphers.cipherNums, "old profile should have ciphers") |
| 193 | + require.Greater(t, len(oldTLSProfile.ciphers.cipherNums), len(intermediateTLSProfile.ciphers.cipherNums), "old profile should have more ciphers than intermediate") |
| 194 | +} |
0 commit comments