From: Hugo Landau Date: Wed, 24 Jan 2024 11:00:53 +0000 (+0000) Subject: QLOG: Minor updates X-Git-Tag: openssl-3.3.0-alpha1~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba8b093be78a0822e0f55335b9c4fd31265b2f22;p=thirdparty%2Fopenssl.git QLOG: Minor updates Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/22037) --- diff --git a/ssl/quic/build.info b/ssl/quic/build.info index 231e6bc4e88..191342ea1b1 100644 --- a/ssl/quic/build.info +++ b/ssl/quic/build.info @@ -20,5 +20,5 @@ SOURCE[$LIBSSL]=quic_types.c SOURCE[$LIBSSL]=qlog_event_helpers.c IF[{- !$disabled{qlog} -}] SOURCE[$LIBSSL]=json_enc.c qlog.c - SHARED_SOURCE[$LIBSSL]=../../crypto/getenv.c + SHARED_SOURCE[$LIBSSL]=../../crypto/getenv.c ../../crypto/ctype.c ENDIF diff --git a/ssl/quic/qlog.c b/ssl/quic/qlog.c index b0cb68bdb03..e084d47ac7c 100644 --- a/ssl/quic/qlog.c +++ b/ssl/quic/qlog.c @@ -11,9 +11,10 @@ #include "internal/json_enc.h" #include "internal/common.h" #include "internal/cryptlib.h" +#include "crypto/ctype.h" -# define BITS_PER_WORD (sizeof(size_t) * 8) -# define NUM_ENABLED_W ((QLOG_EVENT_TYPE_NUM + BITS_PER_WORD - 1) / BITS_PER_WORD) +#define BITS_PER_WORD (sizeof(size_t) * 8) +#define NUM_ENABLED_W ((QLOG_EVENT_TYPE_NUM + BITS_PER_WORD - 1) / BITS_PER_WORD) static ossl_unused ossl_inline int bit_get(const size_t *p, uint32_t bit_no) { @@ -111,9 +112,9 @@ QLOG *ossl_qlog_new_from_env(const QLOG_TRACE_INFO *info) qlogdir_sep = ossl_determine_dirsep(qlogdir); - /* strlen("client" / "server"); strlen(".sqlog"); _; separator; _; NUL */ - strl = l + info->odcid.id_len * 2 + 6 + 7 + 2; - filename = OPENSSL_malloc(strl + 1); + /* dir; [sep]; ODCID; _; strlen("client" / "server"); strlen(".sqlog"); NUL */ + strl = l + 1 + info->odcid.id_len * 2 + 1 + 6 + 6 + 1; + filename = OPENSSL_malloc(strl); if (filename == NULL) return NULL; @@ -303,8 +304,10 @@ static void qlog_event_seq_header(QLOG *qlog) ossl_json_key(&qlog->json, "system_info"); ossl_json_object_begin(&qlog->json); { +#if defined(OPENSSL_SYS_UNIX) || defined(OPENSSL_SYS_WINDOWS) ossl_json_key(&qlog->json, "process_id"); ossl_json_u64(&qlog->json, (uint64_t)getpid()); +#endif } /* system_info */ ossl_json_object_end(&qlog->json); } /* common_fields */ @@ -315,7 +318,7 @@ static void qlog_event_seq_header(QLOG *qlog) { ossl_json_key(&qlog->json, "type"); ossl_json_str(&qlog->json, qlog->info.is_server - ? "server" : "client"); + ? "server" : "client"); } /* vantage_point */ ossl_json_object_end(&qlog->json); } /* trace */ @@ -491,9 +494,7 @@ static ossl_inline int is_term_sep_ws(char c) static ossl_inline int is_name_char(char c) { - return (c >= 'a' && c <= 'z') - || (c >= 'A' && c <= 'Z') - || c == '_' || c == '-'; + return ossl_isalpha(c) || ossl_isdigit(c) || c == '_' || c == '-'; } static int lex_init(struct lexer *lex, const char *in, size_t in_len) @@ -618,7 +619,8 @@ static void filter_apply(size_t *enabled, int add, static int lex_fail(struct lexer *lex, const char *msg) { /* - * TODO(QLOG): Determine how to print log messages about bad filter strings + * TODO(QLOG FUTURE): Determine how to print log messages about bad filter + * strings */ lex->p = lex->term_end = lex->end; return 0; diff --git a/ssl/quic/qlog_event_helpers.c b/ssl/quic/qlog_event_helpers.c index fd1d64af211..6a726029904 100644 --- a/ssl/quic/qlog_event_helpers.c +++ b/ssl/quic/qlog_event_helpers.c @@ -134,7 +134,7 @@ void ossl_qlog_event_connectivity_connection_closed(QLOG *qlog, (unsigned long long)tcause->error_code); m = ce; } - /* TODO(QLOG): Consider adding ERR information in the output. */ + /* TODO(QLOG FUTURE): Consider adding ERR information in the output. */ if (m != NULL) QLOG_STR("connection_code", m); @@ -497,7 +497,7 @@ unknown: /* * Can't continue scanning for frames in this case as the frame length - * is unknown. We log the entire body the rest of the packet payload + * is unknown. We log the entire body of the rest of the packet payload * as the raw data of the frame. */ QLOG_BEGIN("raw"); @@ -591,7 +591,7 @@ static void log_packet(QLOG *qlog_instance, QLOG_END() QLOG_END() } - /* TODO(QLOG): flags, length */ + /* TODO(QLOG FUTURE): flags, length */ QLOG_END() QLOG_U64("datagram_id", datagram_id);