Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/generated/backends-aes_block.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ The backends of `+ciphers::aes128+`, `+aes192+`, `+aes256+`, from the test progr
|OpenSSL
|`+/webcpp/crypto//openssl+`
|`+<webcpp/crypto/backends/openssl.hpp>+`
|native, wasip2, wasip3 (tested by `+aes_openssl+`, `+agreement_aes+`); not on emscripten: `+/webcpp/crypto//openssl+` stops the build there
|native, wasip2, wasip3 (tested by `+aes_openssl+`, `+agreement_aes+`, `+quic_rfc9001_openssl+`); not on emscripten: `+/webcpp/crypto//openssl+` stops the build there

|ctaes
|`+/third_party//ctaes+`
|`+<webcpp/crypto/backends/ctaes.hpp>+`
|native, wasip2, wasip3, emscripten (tested by `+aes_ctaes+`, `+agreement_aes+`)
|native, wasip2, wasip3, emscripten (tested by `+aes_ctaes+`, `+agreement_aes+`, `+quic_rfc9001_bearssl+`)
|===

`+aes128<>+`, `+aes192<>+` and `+aes256<>+` name the default backend; `+gcm<aes256<>>+` names AES-GCM's. The default per target, whatever the program links, as <<crypto-backends-defaults>> gives it with its reasons and tests:
Expand Down
4 changes: 2 additions & 2 deletions doc/generated/backends-gcm.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ The backends of `+ciphers::gcm+`, `+aes128_gcm+`, `+aes256_gcm+`, from the test
|BearSSL
|`+/third_party//bearssl+`
|`+<webcpp/crypto/backends/bearssl.hpp>+`
|native, wasip2, wasip3, emscripten (tested by `+gcm_bearssl+`, `+gcm_wycheproof_bearssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`)
|native, wasip2, wasip3, emscripten (tested by `+gcm_bearssl+`, `+gcm_wycheproof_bearssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`, `+quic_rfc9001_bearssl+`)

|OpenSSL
|`+/webcpp/crypto//openssl+`
|`+<webcpp/crypto/backends/openssl.hpp>+`
|native, wasip2, wasip3 (tested by `+gcm_openssl+`, `+gcm_wycheproof_openssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`); not on emscripten: `+/webcpp/crypto//openssl+` stops the build there
|native, wasip2, wasip3 (tested by `+gcm_openssl+`, `+gcm_wycheproof_openssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`, `+quic_rfc9001_openssl+`); not on emscripten: `+/webcpp/crypto//openssl+` stops the build there

|ctaes
|`+/third_party//ctaes+`
Expand Down
8 changes: 4 additions & 4 deletions doc/generated/matrix.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@
|`+ciphers::aes128+`, `+aes192+`, `+aes256+`
|OpenSSL
|native, wasip2, wasip3; not on emscripten: `+/webcpp/crypto//openssl+` stops the build there
|`+aes_openssl+`, `+agreement_aes+`
|`+aes_openssl+`, `+agreement_aes+`, `+quic_rfc9001_openssl+`

|`+ciphers::aes128+`, `+aes192+`, `+aes256+`
|ctaes
|native, wasip2, wasip3, emscripten
|`+aes_ctaes+`, `+agreement_aes+`
|`+aes_ctaes+`, `+agreement_aes+`, `+quic_rfc9001_bearssl+`

|`+ciphers::gcm+`, `+aes128_gcm+`, `+aes256_gcm+`
|BearSSL
|native, wasip2, wasip3, emscripten
|`+gcm_bearssl+`, `+gcm_wycheproof_bearssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`
|`+gcm_bearssl+`, `+gcm_wycheproof_bearssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`, `+quic_rfc9001_bearssl+`

|`+ciphers::gcm+`, `+aes128_gcm+`, `+aes256_gcm+`
|OpenSSL
|native, wasip2, wasip3; not on emscripten: `+/webcpp/crypto//openssl+` stops the build there
|`+gcm_openssl+`, `+gcm_wycheproof_openssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`
|`+gcm_openssl+`, `+gcm_wycheproof_openssl+`, `+agreement_gcm+`, `+agreement_gcm_portable+`, `+quic_rfc9001_openssl+`

|`+ciphers::gcm+`, `+aes128_gcm+`, `+aes256_gcm+`
|ctaes
Expand Down
8 changes: 4 additions & 4 deletions doc/tables/crypto.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@
"section": "crypto-block",
"default": "`aes128<>`, `aes192<>` and `aes256<>` name the default backend; `gcm<aes256<>>` names AES-GCM's.",
"backends": {
"openssl": {"tests": ["aes_openssl", "agreement_aes"]},
"ctaes": {"tests": ["aes_ctaes", "agreement_aes"]},
"openssl": {"tests": ["aes_openssl", "agreement_aes", "quic_rfc9001_openssl"]},
"ctaes": {"tests": ["aes_ctaes", "agreement_aes", "quic_rfc9001_bearssl"]},
"bearssl": {"refused": "aes_on_bearssl"}
}
},
Expand All @@ -343,9 +343,9 @@
"default": "`aes128_gcm` and `aes256_gcm` name the default backend.",
"backends": {
"bearssl": {"tests": ["gcm_bearssl", "gcm_wycheproof_bearssl", "agreement_gcm",
"agreement_gcm_portable"]},
"agreement_gcm_portable", "quic_rfc9001_bearssl"]},
"openssl": {"tests": ["gcm_openssl", "gcm_wycheproof_openssl", "agreement_gcm",
"agreement_gcm_portable"]},
"agreement_gcm_portable", "quic_rfc9001_openssl"]},
"ctaes": {"refused": "gcm_on_ctaes"}
}
},
Expand Down
13 changes: 13 additions & 0 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,19 @@ crypto-run agreement_chacha_portable_emscripten : agreement_chacha_portable_test
<define>WEBCPP_CRYPTO_DETAIL_BEARSSL_PORTABLE
: emscripten ;

# RFC 9001 Appendix A.1 to A.4, QUIC version 1's packet protection
# (support/quic_rfc9001.hpp; the change rfc9001-tests): the Initial keys
# through webcpp::hash's HKDF, both Initial packets protected and unprotected,
# a tampered one refused, the Retry integrity tag. On OpenSSL for AES-128-GCM
# and the header protection's block; on BearSSL, which has no block cipher,
# with ctaes for it; and on the defaults, aes128_gcm and aes128<>.
crypto-run quic_rfc9001_openssl : quic_rfc9001_openssl_test.cpp
: <library>/webcpp/crypto//openssl : native wasip2 wasip3 ;
crypto-run quic_rfc9001_bearssl : quic_rfc9001_bearssl_test.cpp
: <library>/third_party//bearssl <library>/third_party//ctaes ;
crypto-run quic_rfc9001_default : quic_rfc9001_default_test.cpp
: <library>/webcpp/crypto//gcm-default <library>/webcpp/crypto//aes_block-default ;

# <windows.h> before and after every public header (spec sections 2.2 and 8.6),
# with every backend linked: on MSVC (the CI's msvc lanes) the headers beside a
# bare <windows.h>; elsewhere the headers alone.
Expand Down
28 changes: 28 additions & 0 deletions test/quic_rfc9001_bearssl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2026 WebCpp.org
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)

// RFC 9001 Appendix A.1 to A.4 (QUIC version 1 packet protection) on BearSSL: AES-128-GCM on
// backends::bearssl, which has no block cipher, and the header protection's AES-128 block on
// backends::ctaes, the pair the defaults make on WebAssembly (support/quic_rfc9001.hpp).

#include <webcpp/crypto/backends/bearssl.hpp>
#include <webcpp/crypto/backends/ctaes.hpp>
#include <webcpp/crypto/ciphers/aes.hpp>
#include <webcpp/crypto/ciphers/gcm.hpp>
#include <webcpp/test/exit_status.hpp>

#include "support/quic_rfc9001.hpp"

#include <boost/core/lightweight_test.hpp>

int main() {
namespace ciphers = webcpp::crypto::ciphers;
using webcpp::crypto::backends::bearssl;
using webcpp::crypto::backends::ctaes;
webcpp::test::quic_rfc9001::check_appendix_a<ciphers::gcm<ciphers::aes128<bearssl>>,
ciphers::aes128<ctaes>>();
return webcpp::test::exit_status(boost::report_errors());
}
23 changes: 23 additions & 0 deletions test/quic_rfc9001_default_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2026 WebCpp.org
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)

// RFC 9001 Appendix A.1 to A.4 (QUIC version 1 packet protection) on the defaults a program
// writes, aes128_gcm and aes128<>: natively OpenSSL for both, on wasip2, wasip3 and Emscripten
// BearSSL and ctaes (support/quic_rfc9001.hpp).

#include <webcpp/crypto/ciphers/aes256_gcm.hpp>
#include <webcpp/crypto/ciphers/aes_block.hpp>
#include <webcpp/test/exit_status.hpp>

#include "support/quic_rfc9001.hpp"

#include <boost/core/lightweight_test.hpp>

int main() {
namespace ciphers = webcpp::crypto::ciphers;
webcpp::test::quic_rfc9001::check_appendix_a<ciphers::aes128_gcm, ciphers::aes128<>>();
return webcpp::test::exit_status(boost::report_errors());
}
25 changes: 25 additions & 0 deletions test/quic_rfc9001_openssl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2026 WebCpp.org
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)

// RFC 9001 Appendix A.1 to A.4 (QUIC version 1 packet protection) on OpenSSL: AES-128-GCM and
// the header protection's AES-128 block both on backends::openssl (support/quic_rfc9001.hpp).

#include <webcpp/crypto/backends/openssl.hpp>
#include <webcpp/crypto/ciphers/aes.hpp>
#include <webcpp/crypto/ciphers/gcm.hpp>
#include <webcpp/test/exit_status.hpp>

#include "support/quic_rfc9001.hpp"

#include <boost/core/lightweight_test.hpp>

int main() {
namespace ciphers = webcpp::crypto::ciphers;
using webcpp::crypto::backends::openssl;
webcpp::test::quic_rfc9001::check_appendix_a<ciphers::gcm<ciphers::aes128<openssl>>,
ciphers::aes128<openssl>>();
return webcpp::test::exit_status(boost::report_errors());
}
Loading
Loading