Skip to content

[DO NOT MERGE] Re-enable test and collect CAPI2 logs #5042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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 .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -187,12 +187,12 @@ jobs:
if: matrix.vec.os == 'WinServerPrerelease'
shell: pwsh
timeout-minutes: 120
run: scripts/test.ps1 -Config ${{ matrix.vec.config }} -Arch ${{ matrix.vec.arch }} -Tls ${{ matrix.vec.tls }} -GHA -LogProfile ${{ !inputs.log_level && 'Full.Light' || inputs.log_level }} -GenerateXmlResults ${{ matrix.vec.xdp }} ${{ matrix.vec.qtip }} ${{ inputs.filter && '-Filter' }} ${{ inputs.filter || '' }}
run: scripts/test.ps1 -Config ${{ matrix.vec.config }} -Arch ${{ matrix.vec.arch }} -Tls ${{ matrix.vec.tls }} -GHA -LogProfile ${{ !inputs.log_level && 'Full.Verbose' || inputs.log_level }} -GenerateXmlResults ${{ matrix.vec.xdp }} ${{ matrix.vec.qtip }} ${{ inputs.filter && '-Filter' }} ${{ inputs.filter || '' }}
- name: Test
if: matrix.vec.os != 'WinServerPrerelease'
shell: pwsh
timeout-minutes: 120
run: scripts/test.ps1 -Config ${{ matrix.vec.config }} -Arch ${{ matrix.vec.arch }} -Tls ${{ matrix.vec.tls }} -OsRunner ${{ matrix.vec.os }} -GHA -LogProfile ${{ !inputs.log_level && 'Full.Light' || inputs.log_level }} -GenerateXmlResults ${{ matrix.vec.xdp }} ${{ matrix.vec.qtip }} ${{ inputs.filter && '-Filter' }} ${{ inputs.filter || '' }}
run: scripts/test.ps1 -Config ${{ matrix.vec.config }} -Arch ${{ matrix.vec.arch }} -Tls ${{ matrix.vec.tls }} -OsRunner ${{ matrix.vec.os }} -GHA -LogProfile ${{ !inputs.log_level && 'Full.Verbose' || inputs.log_level }} -GenerateXmlResults ${{ matrix.vec.xdp }} ${{ matrix.vec.qtip }} ${{ inputs.filter && '-Filter' }} ${{ inputs.filter || '' }}
- name: Fix log permissions for Linux XDP
if: failure() && matrix.vec.plat == 'linux' # (matrix.vec.plat == 'linux' && matrix.vec.xdp == '-UseXdp') doesn't work for some reason
run: |
15 changes: 14 additions & 1 deletion src/manifest/MsQuic.wprp
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@
</EventProvider>
<EventProvider Id="EP_NCryptWpp" Name="A74EFE00-14BE-4ef9-9DA9-1484D5473301" Level="5">
<Keywords>
<Keyword Value="0x7FFFFF"/>
<Keyword Value="0xFFFFFFFF"/>
</Keywords>
</EventProvider>
<EventProvider Id="EP_BCryptWpp" Name="A74EFE00-14BE-4ef9-9DA9-1484D5473302" Level="5">
@@ -116,6 +116,16 @@
</Keywords>
</EventProvider>
<EventProvider Id="EP_XdpEtwPerFrame" Name="Microsoft-XDP" Level="25" />
<EventProvider Id="EP_Capi2" Name="Microsoft-Windows-CAPI2" Level="4">
<Keywords>
<Keyword Value="0x7ff" />
</Keywords>
</EventProvider>
<EventProvider Id="EP_Capi2Wpp" Name="5bbca4a8-b209-48dc-a8c7-b23d3e5216fb" Level="5">
<Keywords>
<Keyword Value="0xFFFFFFFF"/>
</Keywords>
</EventProvider>

<Profile Id="Stacks.Light.File" Name="Stacks" Description="CPU Stacks" LoggingMode="File" DetailLevel="Light">
<Collectors>
@@ -279,6 +289,9 @@
<EventProviderId Value="EP_NCryptWpp" />
<EventProviderId Value="EP_XdpEtwPerFrame" />
<EventProviderId Value="EP_XdpWpp" />
<EventProviderId Value="EP_Capi2" />
<EventProviderId Value="EP_Capi2Wpp" />
<EventProviderId Value="EP_BCryptWpp" />
</EventProviders>
</EventCollectorId>
</Collectors>
4 changes: 2 additions & 2 deletions src/platform/certificates_capi.c
Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@

#define CXPLAT_CERT_CREATION_EVENT_NAME L"MsQuicCertEvent"
#define CXPLAT_CERT_CREATION_EVENT_WAIT 10000
#define CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME L"MsQuicTestCert2"
#define CXPLAT_CERTIFICATE_TEST_CLIENT_FRIENDLY_NAME L"MsQuicTestClientCert"
#define CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME L"MsQuicTestSelfSignServer"
#define CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_FRIENDLY_NAME L"MsQuicTestSelfSignClient"
#define CXPLAT_KEY_CONTAINER_NAME L"MsQuicSelfSignKey2"
#define CXPLAT_KEY_SIZE 2048

54 changes: 33 additions & 21 deletions src/platform/selfsign_capi.c
Original file line number Diff line number Diff line change
@@ -24,21 +24,21 @@

#define CXPLAT_CERT_CREATION_EVENT_NAME L"MsQuicCertEvent"
#define CXPLAT_CERT_CREATION_EVENT_WAIT 10000
#define CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME L"MsQuicTestCert2"
#define CXPLAT_CERTIFICATE_TEST_CLIENT_FRIENDLY_NAME L"MsQuicTestClientCert"
#define CXPLAT_KEY_CONTAINER_NAME L"MsQuicSelfSignKey2"
#define CXPLAT_KEY_SIZE 2048

#define CXPLAT_TEST_CERT_VALID_SERVER_FRIENDLY_NAME L"MsQuicTestServer"
#define CXPLAT_TEST_CERT_VALID_CLIENT_FRIENDLY_NAME L"MsQuicTestClient"
#define CXPLAT_TEST_CERT_EXPIRED_SERVER_FRIENDLY_NAME L"MsQuicTestExpiredServer"
#define CXPLAT_TEST_CERT_EXPIRED_CLIENT_FRIENDLY_NAME L"MsQuicTestExpiredClient"
#define CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME L"MsQuicTestSelfSignServer"
#define CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_FRIENDLY_NAME L"MsQuicTestSelfSignClient"
#define CXPLAT_TEST_CERT_VALID_SERVER_SUBJECT_NAME "MsQuicTestServer"
#define CXPLAT_TEST_CERT_VALID_CLIENT_SUBJECT_NAME "MsQuicTestClient"
#define CXPLAT_TEST_CERT_EXPIRED_SERVER_SUBJECT_NAME "MsQuicTestExpiredServer"
#define CXPLAT_TEST_CERT_EXPIRED_CLIENT_SUBJECT_NAME "MsQuicTestExpiredClient"
#define CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_SUBJECT_NAME "MsQuicClient"
#define CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_SUBJECT_NAME "localhost"
#define CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_SUBJECT_NAME "MsQuicTestSelfSignClient"
#define CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_SUBJECT_NAME "MsQuicTestSelfSignServer"

void
CleanTestCertificatesFromStore(BOOLEAN UserStore)
@@ -73,12 +73,12 @@ CleanTestCertificatesFromStore(BOOLEAN UserStore)
&FriendlyNamePropId,
Cert))) {

BYTE FriendlyName[sizeof(CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME)+sizeof(WCHAR)];
BYTE FriendlyName[sizeof(CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME)+sizeof(WCHAR)];
DWORD NameSize = sizeof(FriendlyName);

#pragma prefast(suppress:6054, "SAL doesn't track null terminator correctly")
if (!CertGetCertificateContextProperty(Cert, CERT_FRIENDLY_NAME_PROP_ID, FriendlyName, &NameSize) ||
wcscmp((wchar_t*)FriendlyName, CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME) != 0) {
wcscmp((wchar_t*)FriendlyName, CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME) != 0) {
++Found;
continue;
}
@@ -257,11 +257,15 @@ CreateSubjAltNameExtension(
_Out_ PCERT_EXTENSION CertExtension
)
{
CERT_ALT_NAME_ENTRY AltName = { CERT_ALT_NAME_DNS_NAME };
AltName.pwszDNSName = L"localhost";
LPWSTR AltNameStrings[] = { L"localhost", L"127.0.0.1", L"::1", L"192.168.1.11", L"192.168.1.12", L"fc00::1:11", L"fc00::1:12" };
CERT_ALT_NAME_ENTRY AltNames[ARRAYSIZE(AltNameStrings)];
for (uint32_t i = 0; i < ARRAYSIZE(AltNameStrings); i++) {
AltNames[i].dwAltNameChoice = CERT_ALT_NAME_DNS_NAME;
AltNames[i].pwszDNSName = AltNameStrings[i];
}
CERT_ALT_NAME_INFO NameInfo;
NameInfo.cAltEntry = 1;
NameInfo.rgAltEntry = &AltName;
NameInfo.cAltEntry = ARRAYSIZE(AltNames);
NameInfo.rgAltEntry = AltNames;

ZeroMemory(CertExtension, sizeof(*CertExtension));
CertExtension->fCritical = FALSE;
@@ -746,11 +750,11 @@ CreateSelfSignedCertificate(

CRYPT_DATA_BLOB FriendlyNameBlob;
if (IsClient) {
FriendlyNameBlob.cbData = sizeof(CXPLAT_CERTIFICATE_TEST_CLIENT_FRIENDLY_NAME);
FriendlyNameBlob.pbData = (BYTE*) CXPLAT_CERTIFICATE_TEST_CLIENT_FRIENDLY_NAME;
FriendlyNameBlob.cbData = sizeof(CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_FRIENDLY_NAME);
FriendlyNameBlob.pbData = (BYTE*) CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_FRIENDLY_NAME;
} else {
FriendlyNameBlob.cbData = sizeof(CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME);
FriendlyNameBlob.pbData = (BYTE*) CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME;
FriendlyNameBlob.cbData = sizeof(CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME);
FriendlyNameBlob.pbData = (BYTE*) CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME;
}

if (!CertSetCertificateContextProperty(
@@ -792,7 +796,11 @@ CreateClientCertificate(
)
{
PCCERT_CONTEXT CertContext;
if (FAILED(CreateSelfSignedCertificate(L"CN=MsQuicClient", TRUE, &CertContext))) {
if (FAILED(
CreateSelfSignedCertificate(
L"CN=" CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_SUBJECT_NAME,
TRUE,
&CertContext))) {
return NULL;
}

@@ -804,7 +812,11 @@ CreateServerCertificate(
)
{
PCCERT_CONTEXT CertContext;
if (FAILED(CreateSelfSignedCertificate(L"CN=localhost", FALSE, &CertContext))) {
if (FAILED(
CreateSelfSignedCertificate(
L"CN=" CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_SUBJECT_NAME,
FALSE,
&CertContext))) {
return NULL;
}

@@ -867,7 +879,7 @@ FindCertificate(
&FriendlyNamePropId,
Cert))) {

BYTE FriendlyName[200];
BYTE FriendlyName[200] = { 0 };
DWORD NameSize = sizeof(FriendlyName);

#pragma prefast(suppress:6054, "SAL doesn't track null terminator correctly")
@@ -984,8 +996,8 @@ FindOrCreateCertificate(
CertStore,
FALSE,
IsClient ?
CXPLAT_CERTIFICATE_TEST_CLIENT_FRIENDLY_NAME :
CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME,
CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_FRIENDLY_NAME :
CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME,
CertHash);

if (Cert != NULL) {
@@ -1139,11 +1151,11 @@ CxPlatGetTestCertificate(
SubjectName = CXPLAT_TEST_CERT_EXPIRED_CLIENT_SUBJECT_NAME;
break;
case CXPLAT_TEST_CERT_SELF_SIGNED_SERVER:
FriendlyName = CXPLAT_CERTIFICATE_TEST_FRIENDLY_NAME;
FriendlyName = CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_FRIENDLY_NAME;
SubjectName = CXPLAT_TEST_CERT_SELF_SIGNED_SERVER_SUBJECT_NAME;
break;
case CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT:
FriendlyName = CXPLAT_CERTIFICATE_TEST_CLIENT_FRIENDLY_NAME;
FriendlyName = CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_FRIENDLY_NAME;
SubjectName = CXPLAT_TEST_CERT_SELF_SIGNED_CLIENT_SUBJECT_NAME;
break;
default:
2 changes: 1 addition & 1 deletion src/test/bin/quic_gtest.cpp
Original file line number Diff line number Diff line change
@@ -1398,7 +1398,7 @@ TEST(CredValidation, ConnectExpiredClientCertificate) {

TEST(CredValidation, ConnectValidClientCertificate) {
#ifdef QUIC_TEST_SCHANNEL_FLAGS
if (IsWindows2022() || IsWindows2025()) GTEST_SKIP(); // Not supported with Schannel on WS2022
if (IsWindows2022()) GTEST_SKIP(); // Not supported with Schannel on WS2022
#endif
QUIC_RUN_CRED_VALIDATION Params;
for (auto CredType : { QUIC_CREDENTIAL_TYPE_CERTIFICATE_HASH, QUIC_CREDENTIAL_TYPE_CERTIFICATE_HASH_STORE }) {
Loading
Oops, something went wrong.