From 9ad2d8c557a40af782a6b4d98d1630e99c471060 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Mon, 21 Oct 2024 23:26:08 +0300 Subject: [PATCH] keylog: move some constants to header file This allows TLS implementations to use the constants for defining sizes and verification. --- lib/vtls/keylog.c | 12 ------------ lib/vtls/keylog.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/vtls/keylog.c b/lib/vtls/keylog.c index ca86c15608..32ccd38cc7 100644 --- a/lib/vtls/keylog.c +++ b/lib/vtls/keylog.c @@ -36,18 +36,6 @@ #include "curl_memory.h" #include "memdebug.h" -#define KEYLOG_LABEL_MAXLEN (sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET") - 1) - -#define CLIENT_RANDOM_SIZE 32 - -/* - * The master secret in TLS 1.2 and before is always 48 bytes. In TLS 1.3, the - * secret size depends on the cipher suite's hash function which is 32 bytes - * for SHA-256 and 48 bytes for SHA-384. - */ -#define SECRET_MAXLEN 48 - - /* The fp for the open SSLKEYLOGFILE, or NULL if not open */ static FILE *keylog_file_fp; diff --git a/lib/vtls/keylog.h b/lib/vtls/keylog.h index eff5bf38f3..c87e549279 100644 --- a/lib/vtls/keylog.h +++ b/lib/vtls/keylog.h @@ -25,6 +25,17 @@ ***************************************************************************/ #include "curl_setup.h" +#define KEYLOG_LABEL_MAXLEN (sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET") - 1) + +#define CLIENT_RANDOM_SIZE 32 + +/* + * The master secret in TLS 1.2 and before is always 48 bytes. In TLS 1.3, the + * secret size depends on the cipher suite's hash function which is 32 bytes + * for SHA-256 and 48 bytes for SHA-384. + */ +#define SECRET_MAXLEN 48 + /* * Opens the TLS key log file if requested by the user. The SSLKEYLOGFILE * environment variable specifies the output file.