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 <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28627)

(cherry picked from commit 2edf021463)
This commit is contained in:
Tomas Mraz 2025-09-20 16:45:50 +02:00
parent 759dde226c
commit 390bb5a882
1 changed files with 6 additions and 3 deletions

View File

@ -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