Commit eba80400a2 for openssl.org
commit eba80400a25ef3bad9cfd11c1783784ebb9d8f21
Author: Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Date: Thu Jun 25 11:00:52 2026 +0200
Removes unused member variable 'alloced' from SSL_MAC_BUF struct.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Merge-date: Fri Oct 2 07:20:57 2026
Merged-from: https://github.com/openssl/openssl/pull/31721
diff --git a/ssl/record/methods/dtls_meth.c b/ssl/record/methods/dtls_meth.c
index 8286b4e5a9..f4dce6427e 100644
--- a/ssl/record/methods/dtls_meth.c
+++ b/ssl/record/methods/dtls_meth.c
@@ -140,7 +140,7 @@ static int dtls_process_record(OSSL_RECORD_LAYER *rl, DTLS_BITMAP *bitmap)
size_t mac_size = 0;
size_t rechdrsize = dtls_get_rec_header_size(rl->packet[0]);
unsigned char md[EVP_MAX_MD_SIZE];
- SSL_MAC_BUF macbuf = { NULL, 0 };
+ SSL_MAC_BUF macbuf = { NULL };
int ret = 0;
rr = &rl->rrec[0];
@@ -302,8 +302,6 @@ static int dtls_process_record(OSSL_RECORD_LAYER *rl, DTLS_BITMAP *bitmap)
ret = 1;
end:
- if (macbuf.alloced)
- OPENSSL_free(macbuf.mac);
return ret;
}
diff --git a/ssl/record/methods/recmethod_local.h b/ssl/record/methods/recmethod_local.h
index 6efb4424e1..b324ff762d 100644
--- a/ssl/record/methods/recmethod_local.h
+++ b/ssl/record/methods/recmethod_local.h
@@ -25,7 +25,6 @@ typedef struct dtls_bitmap_st {
typedef struct ssl_mac_buf_st {
unsigned char *mac;
- int alloced;
} SSL_MAC_BUF;
typedef struct tls_buffer_st {
diff --git a/ssl/record/methods/tls1_meth.c b/ssl/record/methods/tls1_meth.c
index 6c98e73783..06c80e2c3d 100644
--- a/ssl/record/methods/tls1_meth.c
+++ b/ssl/record/methods/tls1_meth.c
@@ -411,8 +411,6 @@ static int tls1_cipher(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *recs,
OSSL_PARAM params[2], *p = params;
/* Get the MAC */
- macs[0].alloced = 0;
-
*p++ = OSSL_PARAM_construct_octet_ptr(OSSL_CIPHER_PARAM_TLS_MAC,
(void **)&macs[0].mac,
macsize);
diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c
index 5541b49feb..bda1a17b9d 100644
--- a/ssl/record/methods/tls_common.c
+++ b/ssl/record/methods/tls_common.c
@@ -946,13 +946,9 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
rl->num_released = 0;
ret = OSSL_RECORD_RETURN_SUCCESS;
end:
- if (macbufs != NULL) {
- for (j = 0; j < num_recs; j++) {
- if (macbufs[j].alloced)
- OPENSSL_free(macbufs[j].mac);
- }
+ if (macbufs != NULL)
OPENSSL_free(macbufs);
- }
+
return ret;
}