]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Useless TLS context allocations in qc_do_rm_hp()
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 7 Mar 2023 09:28:16 +0000 (10:28 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 8 Mar 2023 07:50:54 +0000 (08:50 +0100)
These allocations are definitively useless.

Must be backported to 2.7.

src/quic_conn.c

index 91afd74a5ff3a22f67c004c0290acbfc32d9df9c..b6344db2b9a5e056c53fa2d69d7037ed4c88a0f1 100644 (file)
@@ -1449,7 +1449,6 @@ static int qc_do_rm_hp(struct quic_conn *qc,
        uint32_t truncated_pn = 0;
        unsigned char mask[5] = {0};
        unsigned char *sample;
-       EVP_CIPHER_CTX *cctx = NULL;
 
        TRACE_ENTER(QUIC_EV_CONN_RMHP, qc);
 
@@ -1461,12 +1460,6 @@ static int qc_do_rm_hp(struct quic_conn *qc,
                goto leave;
        }
 
-       cctx = EVP_CIPHER_CTX_new();
-       if (!cctx) {
-               TRACE_ERROR("memory allocation failed", QUIC_EV_CONN_RMHP, qc, pkt);
-               goto leave;
-       }
-
        sample = pn + QUIC_PACKET_PN_MAXLEN;
 
        if (!quic_tls_aes_decrypt(mask, sample, sizeof mask, tls_ctx->rx.hp_ctx)) {
@@ -1488,8 +1481,6 @@ static int qc_do_rm_hp(struct quic_conn *qc,
 
        ret = 1;
  leave:
-       if (cctx)
-               EVP_CIPHER_CTX_free(cctx);
        TRACE_LEAVE(QUIC_EV_CONN_RMHP, qc);
        return ret;
 }