From 3b1851a8ea0b7a3d507b2742aad2c158baba773b Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Sat, 20 Sep 2025 16:45:50 +0200 Subject: [PATCH] tls_common.c: Handle inner content type properly on Big Endian When passing the inner content type to msg_callback, the lowest byte of rec->type needs to be passed instead of directly passing the rec->type otherwise the value is incorrect on Big Endian platforms. Reviewed-by: Paul Dale Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/28627) (cherry picked from commit 2edf021463518d9af905b1b03f952ea643b3fb9b) --- ssl/record/methods/tls_common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index 80d4477bd0c..317d81c6d85 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -1093,9 +1093,12 @@ int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec) return 0; } - if (rl->msg_callback != NULL) - rl->msg_callback(0, rl->version, SSL3_RT_INNER_CONTENT_TYPE, &rec->type, - 1, rl->cbarg); + if (rl->msg_callback != NULL) { + unsigned char ctype = (unsigned char)rec->type; + + rl->msg_callback(0, rl->version, SSL3_RT_INNER_CONTENT_TYPE, &ctype, + 1, rl->cbarg); + } /* * TLSv1.3 alert and handshake records are required to be non-zero in -- 2.47.3