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;