Deprecate the public definition of ERR_STATE
authorRichard Levitte <levitte@openssl.org>
Thu, 25 Jul 2019 19:57:48 +0000 (21:57 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 12 Sep 2019 16:33:15 +0000 (18:33 +0200)
The intention is to make it opaque later on.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9462)

crypto/err/err.c
crypto/err/err_blocks.c
crypto/err/err_prn.c
include/openssl/err.h
include/openssl/ossl_typ.h

index deaa579090bf5cc02db7ac032454ce628961fc3b..25426be730911b22b23ca7e0cfe9aea5cb057ff5 100644 (file)
@@ -7,6 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
+/* TODO: When ERR_STATE becomes opaque, this musts be removed */
+#define OSSL_FORCE_ERR_STATE
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -24,6 +27,9 @@
 #include "e_os.h"
 #include "err_locl.h"
 
+/* Forward declaration in case it's not published because of configuration */
+ERR_STATE *ERR_get_state(void);
+
 static int err_load_strings(const ERR_STRING_DATA *str);
 
 static void ERR_STATE_free(ERR_STATE *s);
index cf1bb9708aba10cd0c2791411b5d23994c9a9ec2..c2ff7c08237762a8139a3e4301c581aa6b47ded1 100644 (file)
@@ -7,6 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
+/* TODO: When ERR_STATE becomes opaque, this musts be removed */
+#define OSSL_FORCE_ERR_STATE
+
 #include <string.h>
 #include <openssl/err.h>
 #include "err_locl.h"
index 9ea3eb3deea0d797cc56a64e0407fe60349b12c2..1e1531b91d52146605cc57116544bdb6218a88ac 100644 (file)
@@ -7,6 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
+/* TODO: When ERR_STATE becomes opaque, this musts be removed */
+#define OSSL_FORCE_ERR_STATE
+
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/crypto.h>
index 2b4a71a9a4595ee58e1e505e588c92f3ece069e0..fc7326b7c9aa017d4d00e5caadc50a7a21fcc2cb 100644 (file)
@@ -38,11 +38,12 @@ extern "C" {
 # define ERR_TXT_MALLOCED        0x01
 # define ERR_TXT_STRING          0x02
 
-# define ERR_FLAG_MARK           0x01
-# define ERR_FLAG_CLEAR          0x02
+# if !OPENSSL_API_3 || defined(OSSL_FORCE_ERR_STATE)
+#  define ERR_FLAG_MARK           0x01
+#  define ERR_FLAG_CLEAR          0x02
 
-# define ERR_NUM_ERRORS  16
-typedef struct err_state_st {
+#  define ERR_NUM_ERRORS  16
+struct err_state_st {
     int err_flags[ERR_NUM_ERRORS];
     unsigned long err_buffer[ERR_NUM_ERRORS];
     char *err_data[ERR_NUM_ERRORS];
@@ -52,7 +53,8 @@ typedef struct err_state_st {
     int err_line[ERR_NUM_ERRORS];
     const char *err_func[ERR_NUM_ERRORS];
     int top, bottom;
-} ERR_STATE;
+};
+# endif
 
 /* library */
 # define ERR_LIB_NONE            1
index 530de2d20cb097fa8f5e40a35dae7c0ad9b64f8c..70d9144ba1aab5ca7e99a7f40a77a961fde0be7a 100644 (file)
@@ -88,6 +88,8 @@ typedef struct bn_gencb_st BN_GENCB;
 
 typedef struct buf_mem_st BUF_MEM;
 
+typedef struct err_state_st ERR_STATE;
+
 typedef struct evp_cipher_st EVP_CIPHER;
 typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
 typedef struct evp_md_st EVP_MD;