summaryrefslogtreecommitdiffstats
path: root/ssl/record
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2022-10-17 15:42:09 +0200
committerMatt Caswell <matt@openssl.org>2022-10-20 15:39:33 +0200
commit421386e392151c267ac7d3de6a2dd23c0ab62aed (patch)
treed02cfe210ce85760b9ea7c457aec2c984d095307 /ssl/record
parentRemove supurious set of the record type (diff)
downloadopenssl-421386e392151c267ac7d3de6a2dd23c0ab62aed.tar.xz
openssl-421386e392151c267ac7d3de6a2dd23c0ab62aed.zip
Move sequence increment to post encryption processing
This change make dtls_write_records virtuall the same as tls_write_records_default, which will enable us to merge them in a subsequent commit. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19424)
Diffstat (limited to 'ssl/record')
-rw-r--r--ssl/record/methods/dtls_meth.c20
-rw-r--r--ssl/record/methods/recmethod_local.h5
-rw-r--r--ssl/record/methods/tls1_meth.c2
-rw-r--r--ssl/record/methods/tlsany_meth.c2
4 files changed, 22 insertions, 7 deletions
diff --git a/ssl/record/methods/dtls_meth.c b/ssl/record/methods/dtls_meth.c
index d810ed7a28..9a24d5f8ad 100644
--- a/ssl/record/methods/dtls_meth.c
+++ b/ssl/record/methods/dtls_meth.c
@@ -720,6 +720,21 @@ int dtls_prepare_record_header(OSSL_RECORD_LAYER *rl,
return 1;
}
+int dtls_post_encryption_processing(OSSL_RECORD_LAYER *rl,
+ size_t mac_size,
+ OSSL_RECORD_TEMPLATE *thistempl,
+ WPACKET *thispkt,
+ SSL3_RECORD *thiswr)
+{
+ if (!tls_post_encryption_processing_default(rl, mac_size, thistempl,
+ thispkt, thiswr)) {
+ /* RLAYERfatal() already called */
+ return 0;
+ }
+
+ return tls_increment_sequence_ctr(rl);
+}
+
int dtls_write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates,
size_t numtempl)
{
@@ -810,11 +825,6 @@ int dtls_write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates,
goto err;
}
- if (!tls_increment_sequence_ctr(rl)) {
- /* RLAYERfatal() already called */
- goto err;
- }
-
/* now let's set up wb */
SSL3_BUFFER_set_left(wb, SSL3_RECORD_get_length(&wr));
diff --git a/ssl/record/methods/recmethod_local.h b/ssl/record/methods/recmethod_local.h
index e1267500cf..a25dd9d70f 100644
--- a/ssl/record/methods/recmethod_local.h
+++ b/ssl/record/methods/recmethod_local.h
@@ -356,6 +356,11 @@ int dtls_prepare_record_header(OSSL_RECORD_LAYER *rl,
OSSL_RECORD_TEMPLATE *templ,
unsigned int rectype,
unsigned char **recdata);
+int dtls_post_encryption_processing(OSSL_RECORD_LAYER *rl,
+ size_t mac_size,
+ OSSL_RECORD_TEMPLATE *thistempl,
+ WPACKET *thispkt,
+ SSL3_RECORD *thiswr);
int dtls_write_records(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates,
size_t numtempl);
diff --git a/ssl/record/methods/tls1_meth.c b/ssl/record/methods/tls1_meth.c
index 6917fd897b..232f055c52 100644
--- a/ssl/record/methods/tls1_meth.c
+++ b/ssl/record/methods/tls1_meth.c
@@ -682,6 +682,6 @@ struct record_functions_st dtls_1_funcs = {
dtls_prepare_record_header,
NULL,
tls_prepare_for_encryption_default,
- tls_post_encryption_processing_default,
+ dtls_post_encryption_processing,
NULL
};
diff --git a/ssl/record/methods/tlsany_meth.c b/ssl/record/methods/tlsany_meth.c
index ff08c11d0d..c2a1e0d090 100644
--- a/ssl/record/methods/tlsany_meth.c
+++ b/ssl/record/methods/tlsany_meth.c
@@ -190,6 +190,6 @@ struct record_functions_st dtls_any_funcs = {
dtls_prepare_record_header,
NULL,
tls_prepare_for_encryption_default,
- tls_post_encryption_processing_default,
+ dtls_post_encryption_processing,
NULL
};