diff --git a/fizz/CMakeLists.txt b/fizz/CMakeLists.txt index 5c8a575bf05..21179a35898 100644 --- a/fizz/CMakeLists.txt +++ b/fizz/CMakeLists.txt @@ -218,6 +218,7 @@ set(FIZZ_SOURCES client/EarlyDataRejectionPolicy.cpp tool/FizzCommandCommon.cpp util/FizzUtil.cpp + util/Tracing.cpp ) add_library(fizz diff --git a/fizz/client/AsyncFizzClient-inl.h b/fizz/client/AsyncFizzClient-inl.h index d1dc6d803fc..75301a22432 100644 --- a/fizz/client/AsyncFizzClient-inl.h +++ b/fizz/client/AsyncFizzClient-inl.h @@ -608,16 +608,14 @@ void AsyncFizzClientT::ActionMoveVisitor::operator()( template void AsyncFizzClientT::ActionMoveVisitor::operator()( SecretAvailable& secret) { - client_.secretAvailable(secret.secret); -#if 0 - FOLLY_SDT( - fizz, - fizz_secret_available, + fizz_probe_secret_available( secret.secret.secret.size(), secret.secret.secret.data(), - secret.secret.type, + KeyLogWriter::secretToNSSLabel(secret.secret.type) + .value_or(std::numeric_limits::max()), client_.getClientRandom()->data()); -#endif + + client_.secretAvailable(secret.secret); } template diff --git a/fizz/client/AsyncFizzClient.h b/fizz/client/AsyncFizzClient.h index fae048c9c61..f113a40576a 100644 --- a/fizz/client/AsyncFizzClient.h +++ b/fizz/client/AsyncFizzClient.h @@ -15,8 +15,8 @@ #include #include #include +#include #include -#include namespace fizz { namespace client { diff --git a/fizz/server/AsyncFizzServer-inl.h b/fizz/server/AsyncFizzServer-inl.h index d3f3d13b1a5..86666e6c4dc 100644 --- a/fizz/server/AsyncFizzServer-inl.h +++ b/fizz/server/AsyncFizzServer-inl.h @@ -343,16 +343,13 @@ void AsyncFizzServerT::ActionMoveVisitor::operator()( template void AsyncFizzServerT::ActionMoveVisitor::operator()( SecretAvailable& secret) { -#if 0 - FOLLY_SDT( - fizz, - fizz_secret_available, + fizz_probe_secret_available( secret.secret.secret.size(), secret.secret.secret.data(), KeyLogWriter::secretToNSSLabel(secret.secret.type) .value_or(std::numeric_limits::max()), server_.getClientRandom()->data()); -#endif + server_.secretAvailable(secret.secret); } diff --git a/fizz/server/AsyncFizzServer.h b/fizz/server/AsyncFizzServer.h index a63426ba6a9..0ea9b57f0b5 100644 --- a/fizz/server/AsyncFizzServer.h +++ b/fizz/server/AsyncFizzServer.h @@ -13,8 +13,7 @@ #include #include #include -#include -#include +#include namespace fizz { namespace server { diff --git a/fizz/util/Tracing.cpp b/fizz/util/Tracing.cpp new file mode 100644 index 00000000000..fd22535d6fa --- /dev/null +++ b/fizz/util/Tracing.cpp @@ -0,0 +1,21 @@ +#include +#include + +namespace fizz { +extern "C" { +void fizz_probe_secret_available( + long unsigned int secretSize, + unsigned char* secretData, + fizz::KeyLogWriter::Label nssLabel, + unsigned char* clientRandom) { + FOLLY_SDT( + fizz, + fizz_secret_available, + secretSize, + secretData, + nssLabel, + clientRandom); +} +} + +} // namespace fizz diff --git a/fizz/util/Tracing.h b/fizz/util/Tracing.h new file mode 100644 index 00000000000..2275a4cde0b --- /dev/null +++ b/fizz/util/Tracing.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once +#include + +namespace fizz { + +extern "C" { +void fizz_probe_secret_available( + long unsigned int secretSize, + unsigned char* secretData, + fizz::KeyLogWriter::Label nssLabel, + unsigned char* clientRandom); +} + +} // namespace fizz