From: Yedaya Katsman Date: Mon, 21 Oct 2024 20:26:08 +0000 (+0300) Subject: keylog: move some constants to header file X-Git-Tag: curl-8_13_0~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ad2d8c557a40af782a6b4d98d1630e99c471060;p=thirdparty%2Fcurl.git keylog: move some constants to header file This allows TLS implementations to use the constants for defining sizes and verification. --- 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.