Rename some functions to be more consistent
authorMatt Caswell <matt@openssl.org>
Wed, 27 Jul 2022 13:50:16 +0000 (14:50 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 18 Aug 2022 15:38:14 +0000 (16:38 +0100)
Some functions in the record layer were called rlayer_*, but most were
called tls_*. We standardise on the latter.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18132)

ssl/record/methods/dtls_meth.c
ssl/record/methods/recmethod_local.h
ssl/record/methods/tls_common.c

index d5dae75c4ff4e56e73da8a1fc34b5c54a86749cd..eebea6289d75ce03958a663a9d202f9d05364d89 100644 (file)
@@ -313,9 +313,8 @@ static int dtls_rlayer_buffer_record(OSSL_RECORD_LAYER *rl, record_pqueue *queue
     memset(&rl->rbuf, 0, sizeof(SSL3_BUFFER));
     memset(&rl->rrec[0], 0, sizeof(rl->rrec[0]));
 
-
-    if (!rlayer_setup_read_buffer(rl)) {
-        /* SSLfatal() already called */
+    if (!tls_setup_read_buffer(rl)) {
+        /* RLAYERfatal() already called */
         OPENSSL_free(rdata->rbuf.buf);
         OPENSSL_free(rdata);
         pitem_free(item);
@@ -397,7 +396,7 @@ int dtls_get_more_records(OSSL_RECORD_LAYER *rl)
     rr = rl->rrec;
 
     if (rl->rbuf.buf == NULL) {
-        if (!rlayer_setup_read_buffer(rl)) {
+        if (!tls_setup_read_buffer(rl)) {
             /* RLAYERfatal() already called */
             return OSSL_RECORD_RETURN_FATAL;
         }
index d85e377b68b5e38a9ec3443b595524ec1486d399..95ba642b9138f0a5e6e3b3385a9f6b8481436341 100644 (file)
@@ -293,4 +293,4 @@ void tls_set_max_pipelines(OSSL_RECORD_LAYER *rl, size_t max_pipelines);
 void tls_get_state(OSSL_RECORD_LAYER *rl, const char **shortstr,
                    const char **longstr);
 int tls_set_options(OSSL_RECORD_LAYER *rl, const OSSL_PARAM *options);
-int rlayer_setup_read_buffer(OSSL_RECORD_LAYER *rl);
+int tls_setup_read_buffer(OSSL_RECORD_LAYER *rl);
index 00454b43c82dad765a20cd17d60267e5cc7f310e..d98badffe470204933d4ab89adc8c35e1ed12beb 100644 (file)
@@ -86,7 +86,7 @@ char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx)
 }
 
 #ifndef OPENSSL_NO_COMP
-static int rlayer_allow_compression(OSSL_RECORD_LAYER *rl)
+static int tls_allow_compression(OSSL_RECORD_LAYER *rl)
 {
     if (rl->options & SSL_OP_NO_COMPRESSION)
         return 0;
@@ -95,7 +95,7 @@ static int rlayer_allow_compression(OSSL_RECORD_LAYER *rl)
 }
 #endif
 
-int rlayer_setup_read_buffer(OSSL_RECORD_LAYER *rl)
+int tls_setup_read_buffer(OSSL_RECORD_LAYER *rl)
 {
     unsigned char *p;
     size_t len, align = 0, headerlen;
@@ -116,7 +116,7 @@ int rlayer_setup_read_buffer(OSSL_RECORD_LAYER *rl)
         len = SSL3_RT_MAX_PLAIN_LENGTH
             + SSL3_RT_MAX_ENCRYPTED_OVERHEAD + headerlen + align;
 #ifndef OPENSSL_NO_COMP
-        if (rlayer_allow_compression(rl))
+        if (tls_allow_compression(rl))
             len += SSL3_RT_MAX_COMPRESSED_OVERHEAD;
 #endif
         if (b->default_len > len)
@@ -137,7 +137,7 @@ int rlayer_setup_read_buffer(OSSL_RECORD_LAYER *rl)
     return 1;
 }
 
-static int rlayer_release_read_buffer(OSSL_RECORD_LAYER *rl)
+static int tls_release_read_buffer(OSSL_RECORD_LAYER *rl)
 {
     SSL3_BUFFER *b;
 
@@ -300,7 +300,7 @@ int tls_default_read_n(OSSL_RECORD_LAYER *rl, size_t n, size_t max, int extend,
             rb->left = left;
             if ((rl->mode & SSL_MODE_RELEASE_BUFFERS) != 0 && !rl->isdtls)
                 if (len + left == 0)
-                    rlayer_release_read_buffer(rl);
+                    tls_release_read_buffer(rl);
             return ret;
         }
         left += bioread;
@@ -428,7 +428,7 @@ int tls_get_more_records(OSSL_RECORD_LAYER *rl)
     rr = rl->rrec;
     rbuf = &rl->rbuf;
     if (rbuf->buf == NULL) {
-        if (!rlayer_setup_read_buffer(rl)) {
+        if (!tls_setup_read_buffer(rl)) {
             /* RLAYERfatal() already called */
             return OSSL_RECORD_RETURN_FATAL;
         }
@@ -988,7 +988,7 @@ int tls_release_record(OSSL_RECORD_LAYER *rl, void *rechandle)
     if (rl->curr_rec == rl->num_released
             && (rl->mode & SSL_MODE_RELEASE_BUFFERS) != 0
             && SSL3_BUFFER_get_left(&rl->rbuf) == 0)
-        rlayer_release_read_buffer(rl);
+        tls_release_read_buffer(rl);
 
     return OSSL_RECORD_RETURN_SUCCESS;
 }