From d6d450fd9b938b95a397fa4a957b573c07e74af2 Mon Sep 17 00:00:00 2001 From: sainadh777 <31940823+sainadh777@users.noreply.github.com> Date: Sat, 5 Sep 2026 23:27:24 -0700 Subject: [PATCH] Add OpenSSL cipher operator tests --- TODO.md | 10 ----- .../TestOpenSSLCipherConfigurationParser.java | 37 ++++++++++++++++++- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/TODO.md b/TODO.md index c289a1048bc6..93ff13d71095 100644 --- a/TODO.md +++ b/TODO.md @@ -902,16 +902,6 @@ These are bugs, correctness issues, or missing functionality that may affect pro --- -### 81. OpenSSL Cipher Test Coverage (1 item) - -| # | File:Line | Description | Fix Idea | Effort | Difficulty | -|---|-----------|-------------|----------|--------|------------| -| 81.1 | `TestOpenSSLCipherConfigurationParser.java:497` | Individual operator tests missing | Add unit tests for each cipher string operator: `+`, `-`, `!`, `@`, colon separator, etc. | 1-2 days | Medium | - -**Total estimated effort: 1-2 days, Medium difficulty** - ---- - ### 82. OCSP Test Hardcoded Serials (1 item) | # | File:Line | Description | Fix Idea | Effort | Difficulty | diff --git a/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java b/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java index cd038cfe93ea..2f0be3e0fe27 100644 --- a/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java +++ b/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java @@ -440,7 +440,42 @@ public void testCBC() throws Exception { } - // TODO: Add tests for the individual operators + @Test + public void testOperatorExclude() throws Exception { + testSpecification("AES128:!SHA256:SHA256"); + } + + + @Test + public void testOperatorDelete() throws Exception { + testSpecification("AES128:-SHA256:SHA256"); + } + + + @Test + public void testOperatorMoveToEnd() throws Exception { + testSpecification("AES128:AES256:+AES128"); + } + + + @Test + public void testOperatorIntersection() throws Exception { + testSpecification("AES128+SHA256"); + } + + + @Test + public void testOperatorStrengthSort() throws Exception { + testSpecification("AES128:AES256:@STRENGTH"); + } + + + @Test + public void testSeparators() throws Exception { + testSpecification("AES128:AES256"); + testSpecification("AES128,AES256"); + testSpecification("AES128 AES256"); + } @Test public void testSpecification01() throws Exception {