From: Tomas Mraz Date: Sat, 20 Sep 2025 14:45:50 +0000 (+0200) Subject: tls_common.c: Handle inner content type properly on Big Endian X-Git-Tag: openssl-3.4.3~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b1851a8ea0b7a3d507b2742aad2c158baba773b;p=thirdparty%2Fopenssl.git 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) --- 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