summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorsashan <anedvedicky@gmail.com>2024-05-16 06:33:55 +0200
committerTomas Mraz <tomas@openssl.org>2024-05-28 08:56:13 +0200
commitda9342ed5edabfbbd658e35f6bad1831682cc7e7 (patch)
tree00cf057471eefa0ba61357afc1206e3d19e36ec6 /include
parent184d29dbabbb6c7a5cc829d3ac4b966f781d2b2e (diff)
Move stack of compression methods from libssl to OSSL_LIB_CTX
The compression methods are now a global variable in libssl. This change moves it into OSSL library context. It is necessary to eliminate atexit call from libssl. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24414)
Diffstat (limited to 'include')
-rw-r--r--include/internal/comp.h10
-rw-r--r--include/internal/cryptlib.h7
-rw-r--r--include/openssl/comp.h.in (renamed from include/openssl/comp.h)28
-rw-r--r--include/openssl/crypto.h.in3
-rw-r--r--include/openssl/ssl.h.in5
5 files changed, 39 insertions, 14 deletions
diff --git a/include/internal/comp.h b/include/internal/comp.h
index c48c29d562..cb1032f216 100644
--- a/include/internal/comp.h
+++ b/include/internal/comp.h
@@ -6,9 +6,19 @@
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
+#ifndef _INTERNAL_COMP_H
+#define _INTERNAL_COMP_H
#include <openssl/comp.h>
void ossl_comp_zlib_cleanup(void);
void ossl_comp_brotli_cleanup(void);
void ossl_comp_zstd_cleanup(void);
+
+struct ssl_comp_st {
+ int id;
+ const char *name;
+ COMP_METHOD *method;
+};
+
+#endif
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index 6c2ac47275..1635830500 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -86,7 +86,6 @@ typedef struct ossl_ex_data_global_st {
EX_CALLBACKS ex_data[CRYPTO_EX_INDEX__COUNT];
} OSSL_EX_DATA_GLOBAL;
-
/* OSSL_LIB_CTX */
# define OSSL_LIB_CTX_PROVIDER_STORE_RUN_ONCE_INDEX 0
@@ -117,7 +116,8 @@ typedef struct ossl_ex_data_global_st {
# define OSSL_LIB_CTX_CHILD_PROVIDER_INDEX 18
# define OSSL_LIB_CTX_THREAD_INDEX 19
# define OSSL_LIB_CTX_DECODER_CACHE_INDEX 20
-# define OSSL_LIB_CTX_MAX_INDEXES 20
+# define OSSL_LIB_CTX_COMP_METHODS 21
+# define OSSL_LIB_CTX_MAX_INDEXES 21
OSSL_LIB_CTX *ossl_lib_ctx_get_concrete(OSSL_LIB_CTX *ctx);
int ossl_lib_ctx_is_default(OSSL_LIB_CTX *ctx);
@@ -161,4 +161,7 @@ char *ossl_buf2hexstr_sep(const unsigned char *buf, long buflen, char sep);
unsigned char *ossl_hexstr2buf_sep(const char *str, long *buflen,
const char sep);
+STACK_OF(SSL_COMP) *ossl_load_builtin_compressions(void);
+void ossl_free_compression_methods_int(STACK_OF(SSL_COMP) *methods);
+
#endif
diff --git a/include/openssl/comp.h b/include/openssl/comp.h.in
index f81ba0f39c..bd1efdc568 100644
--- a/include/openssl/comp.h
+++ b/include/openssl/comp.h.in
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -7,6 +7,10 @@
* https://www.openssl.org/source/license.html
*/
+{-
+use OpenSSL::stackhash qw(generate_stack_macros);
+-}
+
#ifndef OPENSSL_COMP_H
# define OPENSSL_COMP_H
# pragma once
@@ -18,7 +22,6 @@
# include <openssl/opensslconf.h>
-# ifndef OPENSSL_NO_COMP
# include <openssl/crypto.h>
# include <openssl/comperr.h>
# ifdef __cplusplus
@@ -27,6 +30,8 @@ extern "C" {
+# ifndef OPENSSL_NO_COMP
+
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
int COMP_CTX_get_type(const COMP_CTX* comp);
@@ -46,19 +51,26 @@ COMP_METHOD *COMP_brotli_oneshot(void);
COMP_METHOD *COMP_zstd(void);
COMP_METHOD *COMP_zstd_oneshot(void);
-#ifndef OPENSSL_NO_DEPRECATED_1_1_0
-# define COMP_zlib_cleanup() while(0) continue
-#endif
+# ifndef OPENSSL_NO_DEPRECATED_1_1_0
+# define COMP_zlib_cleanup() while(0) continue
+# endif
-# ifdef OPENSSL_BIO_H
+# ifdef OPENSSL_BIO_H
const BIO_METHOD *BIO_f_zlib(void);
const BIO_METHOD *BIO_f_brotli(void);
const BIO_METHOD *BIO_f_zstd(void);
+# endif
+
# endif
+typedef struct ssl_comp_st SSL_COMP;
+
+{-
+ generate_stack_macros("SSL_COMP");
+-}
-# ifdef __cplusplus
+
+# ifdef __cplusplus
}
-# endif
# endif
#endif
diff --git a/include/openssl/crypto.h.in b/include/openssl/crypto.h.in
index 034f150cb6..ef87f9754d 100644
--- a/include/openssl/crypto.h.in
+++ b/include/openssl/crypto.h.in
@@ -541,6 +541,9 @@ void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, int value);
void OSSL_sleep(uint64_t millis);
+
+void *OSSL_LIB_CTX_get_data(OSSL_LIB_CTX *ctx, int index);
+
# ifdef __cplusplus
}
# endif
diff --git a/include/openssl/ssl.h.in b/include/openssl/ssl.h.in
index 442d5cbc3c..7ffce7fdd3 100644
--- a/include/openssl/ssl.h.in
+++ b/include/openssl/ssl.h.in
@@ -236,10 +236,8 @@ typedef struct ssl_cipher_st SSL_CIPHER;
typedef struct ssl_session_st SSL_SESSION;
typedef struct tls_sigalgs_st TLS_SIGALGS;
typedef struct ssl_conf_ctx_st SSL_CONF_CTX;
-typedef struct ssl_comp_st SSL_COMP;
STACK_OF(SSL_CIPHER);
-STACK_OF(SSL_COMP);
/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
typedef struct srtp_protection_profile_st {
@@ -975,8 +973,7 @@ extern "C" {
* in VisualStudio 2015
*/
{-
- generate_const_stack_macros("SSL_CIPHER")
- .generate_stack_macros("SSL_COMP");
+ generate_const_stack_macros("SSL_CIPHER");
-}
/* compatibility */