From: Matt Caswell Date: Mon, 12 Sep 2022 14:02:14 +0000 (+0100) Subject: Remove some outstanding TODOs X-Git-Tag: openssl-3.2.0-alpha1~2020 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fed6ee1ce4a3374d7223654db13132144275c05;p=thirdparty%2Fopenssl.git Remove some outstanding TODOs Reviewed-by: Hugo Landau Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/19198) --- diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index 021ee062d02..95083532f4a 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -1696,15 +1696,10 @@ static int tls_write_records_standard(OSSL_RECORD_LAYER *rl, wpinited = 1; wb = &rl->wbuf[0]; - /* TODO(RECLAYER): This alignment calculation no longer seems right */ -#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 - /* - * extra fragment would be couple of cipher blocks, which would be - * multiple of SSL3_ALIGN_PAYLOAD, so if we want to align the real - * payload, then we can just pretend we simply have two headers. - */ - align = (size_t)SSL3_BUFFER_get_buf(wb) + 2 * SSL3_RT_HEADER_LENGTH; - align = SSL3_ALIGN_PAYLOAD - 1 - ((align - 1) % SSL3_ALIGN_PAYLOAD); +#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD != 0 + align = (size_t)SSL3_BUFFER_get_buf(wb) + SSL3_RT_HEADER_LENGTH; + align = SSL3_ALIGN_PAYLOAD - 1 + - ((align - 1) % SSL3_ALIGN_PAYLOAD); #endif SSL3_BUFFER_set_offset(wb, align); if (!WPACKET_init_static_len(&pkt[0], SSL3_BUFFER_get_buf(wb), @@ -1737,7 +1732,6 @@ static int tls_write_records_standard(OSSL_RECORD_LAYER *rl, align = SSL3_ALIGN_PAYLOAD - 1 - ((align - 1) % SSL3_ALIGN_PAYLOAD); #endif - /* TODO(RECLAYER): Is this alignment actually used somewhere? */ SSL3_BUFFER_set_offset(wb, align); if (!WPACKET_init_static_len(thispkt, SSL3_BUFFER_get_buf(wb), SSL3_BUFFER_get_len(wb), 0) @@ -1823,10 +1817,7 @@ static int tls_write_records_standard(OSSL_RECORD_LAYER *rl, /* lets setup the record stuff. */ SSL3_RECORD_set_data(thiswr, compressdata); SSL3_RECORD_set_length(thiswr, thistempl->buflen); - /* - * TODO(RECLAYER): Cast away the const. Should be safe - by why is this - * necessary? - */ + SSL3_RECORD_set_input(thiswr, (unsigned char *)thistempl->buf); totlen += thistempl->buflen;