Skip to content

Commit

Permalink
ocsp: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rizlik committed Jan 31, 2025
1 parent f400102 commit 8439e4c
Show file tree
Hide file tree
Showing 10 changed files with 1,715 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2493,6 +2493,7 @@ if(WOLFSSL_EXAMPLES)
tests/srp.c
tests/suites.c
tests/w64wrapper.c
tests/ocsp.c
tests/unit.c
tests/quic.c
examples/server/server.c
Expand Down
3 changes: 2 additions & 1 deletion certs/ocsp/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ EXTRA_DIST += \
certs/ocsp/test-response.der \
certs/ocsp/test-response-rsapss.der \
certs/ocsp/test-response-nointern.der \
certs/ocsp/test-multi-response.der
certs/ocsp/test-multi-response.der \
certs/ocsp/test-leaf-response.der
8 changes: 8 additions & 0 deletions certs/ocsp/renewcerts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ openssl ocsp -issuer ./root-ca-cert.pem -cert ./intermediate1-ca-cert.pem -cert
kill $PID
wait $PID

# Create a reponse DER buffer for testing leaf certificate

Check failure on line 103 in certs/ocsp/renewcerts.sh

View workflow job for this annotation

GitHub Actions / codespell

reponse ==> response
openssl ocsp -port 22221 -ndays 1000 -index ./index-intermediate1-ca-issued-certs.txt -rsigner ocsp-responder-cert.pem -rkey ocsp-responder-key.pem -CA intermediate1-ca-cert.pem -partial_chain &
PID=$!
sleep 1 # Make sure server is ready

openssl ocsp -issuer ./intermediate1-ca-cert.pem -cert ./server1-cert.pem -url http://localhost:22221/ -respout test-leaf-response.der -noverify
kill $PID
wait $PID

# now start up a responder that signs using rsa-pss
openssl ocsp -port 22221 -ndays 1000 -index index-ca-and-intermediate-cas.txt -rsigner ocsp-responder-cert.pem -rkey ocsp-responder-key.pem -CA root-ca-cert.pem -rsigopt rsa_padding_mode:pss &
Expand Down
Binary file added certs/ocsp/test-leaf-response.der
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@

/* Gather test declarations to include them in the testCases array */
#include <tests/api/ascon.h>
#include <tests/api/ocsp.h>

#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_TLS) && \
!defined(NO_RSA) && !defined(SINGLE_THREADED) && \
Expand Down Expand Up @@ -102779,6 +102780,9 @@ TEST_CASE testCases[] = {
TEST_DECL(test_wolfSSL_SSLDisableRead),
TEST_DECL(test_wolfSSL_inject),
TEST_DECL(test_wolfSSL_dtls_cid_parse),
TEST_DECL(test_ocsp_status_callback),
TEST_DECL(test_ocsp_basic_verify),
TEST_DECL(test_ocsp_response_parsing),
/* This test needs to stay at the end to clean up any caches allocated. */
TEST_DECL(test_wolfSSL_Cleanup)
};
Expand Down
Loading

0 comments on commit 8439e4c

Please sign in to comment.