Pass the dtls record version to the record layer msg_callback function.
authorFrederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Mon, 2 Oct 2023 09:11:29 +0000 (11:11 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 4 Oct 2023 10:56:53 +0000 (12:56 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22241)

ssl/record/methods/dtls_meth.c

index e71730eba65d9d0af8fd140c03fb0e0aef76a4f3..258dbd3b14a0b2dc76fb902a1a1256c0ebf7bba0 100644 (file)
@@ -429,10 +429,6 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
 
         p = rl->packet;
 
-        if (rl->msg_callback != NULL)
-            rl->msg_callback(0, 0, SSL3_RT_HEADER, p, DTLS1_RT_HEADER_LENGTH,
-                            rl->cbarg);
-
         /* Pull apart the header into the DTLS1_RECORD */
         rr->type = *(p++);
         ssl_major = *(p++);
@@ -447,6 +443,10 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
 
         n2s(p, rr->length);
 
+        if (rl->msg_callback != NULL)
+            rl->msg_callback(0, rr->rec_version, SSL3_RT_HEADER, rl->packet, DTLS1_RT_HEADER_LENGTH,
+                             rl->cbarg);
+
         /*
          * Lets check the version. We tolerate alerts that don't have the exact
          * version number (e.g. because of protocol version errors)