From d5ab205c28468fb99fc1f15fe8ca545d7deecc84 Mon Sep 17 00:00:00 2001 From: Yosuke Shimizu Date: Thu, 17 Sep 2026 13:37:13 +0900 Subject: [PATCH] scep: advertise cipher capabilities the server can actually honour - scep_server.c defines SCEP_SRV_CIPHER_CAP and SCEP_SRV_STD_CAP alongside SCEP_SRV_ENC_OID: AES plus SCEPStandard under WOLFSSL_AES_128 && HAVE_AES_CBC, and DES3 with no SCEPStandard on the 3DES branch. - handle_get_ca_caps() builds both GetCACaps bodies from those two macros in place of the literal AES and SCEPStandard lines. - test_scep_roundtrip reads the server's rendered capability list back, asserting caps.aes and caps.scep_standard against the same two macros and caps.renewal unconditionally. Issue: F-8023 --- src/scep/scep_server.c | 21 ++++++++++++--------- tests/integration/test_scep_roundtrip.c | 9 +++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/scep/scep_server.c b/src/scep/scep_server.c index 3458bf7..2a887bf 100644 --- a/src/scep/scep_server.c +++ b/src/scep/scep_server.c @@ -45,14 +45,16 @@ #include #include -/* Content-encryption cipher the CertRep EnvelopedData carries. Mirrors the - * client's AUTO choice: RFC 8894 section 3.5.2's "AES" capability names - * AES-128-CBC and nothing else, with the mandatory-to-implement triple DES-CBC - * as the fallback for a wolfSSL that cannot do AES-128. */ +/* Content-encryption cipher for the CertRep and its GetCACaps tokens. RFC 8894 + * section 3.5.2: "AES" names AES128-CBC, and "SCEPStandard" implies "AES". */ #if defined(WOLFSSL_AES_128) && defined(HAVE_AES_CBC) - #define SCEP_SRV_ENC_OID AES128CBCb + #define SCEP_SRV_ENC_OID AES128CBCb + #define SCEP_SRV_CIPHER_CAP "AES\r\n" + #define SCEP_SRV_STD_CAP "SCEPStandard\r\n" #elif !defined(NO_DES3) - #define SCEP_SRV_ENC_OID DES3b + #define SCEP_SRV_ENC_OID DES3b + #define SCEP_SRV_CIPHER_CAP "DES3\r\n" + #define SCEP_SRV_STD_CAP "" #else #error "wolfCert's SCEP test server needs AES-128-CBC or 3DES-CBC; rebuild wolfSSL with one of them, or configure without the test server" #endif @@ -304,12 +306,13 @@ static void handle_get_ca_caps(WolfCertServer* s, int fd) { if (s->cfg.scep_enable_next_ca) { send_text(s, fd, 200, "OK", "text/plain", - "POSTPKIOperation\r\nSHA-256\r\nAES\r\nRenewal\r\n" - "SCEPStandard\r\nGetNextCACert\r\n"); + "POSTPKIOperation\r\nSHA-256\r\n" SCEP_SRV_CIPHER_CAP + "Renewal\r\n" SCEP_SRV_STD_CAP "GetNextCACert\r\n"); } else { send_text(s, fd, 200, "OK", "text/plain", - "POSTPKIOperation\r\nSHA-256\r\nAES\r\nRenewal\r\nSCEPStandard\r\n"); + "POSTPKIOperation\r\nSHA-256\r\n" SCEP_SRV_CIPHER_CAP + "Renewal\r\n" SCEP_SRV_STD_CAP); } } diff --git a/tests/integration/test_scep_roundtrip.c b/tests/integration/test_scep_roundtrip.c index a31a933..177bc0f 100644 --- a/tests/integration/test_scep_roundtrip.c +++ b/tests/integration/test_scep_roundtrip.c @@ -1135,6 +1135,15 @@ int main(void) REQUIRE(caps.post_pki_operation); REQUIRE(caps.sha256); +#if defined(WOLFSSL_AES_128) && defined(HAVE_AES_CBC) + REQUIRE(caps.aes == 1); + REQUIRE(caps.scep_standard == 1); +#else + REQUIRE(caps.aes == 0); + REQUIRE(caps.scep_standard == 0); +#endif + REQUIRE(caps.renewal); + WolfCertBuffer ca_pem = { 0 }; REQUIRE(wolfcert_scep_get_ca_cert(&cli, &ca_pem) == WOLFCERT_OK); DerBuffer* ca_der = NULL;