Stop using conf->meth_data and make CONF_type_default const
authortb <tb@openbsd.org>
Sat, 31 Aug 2024 09:36:38 +0000 (09:36 +0000)
committertb <tb@openbsd.org>
Sat, 31 Aug 2024 09:36:38 +0000 (09:36 +0000)
Now that we no longer need to hang a poor man's ctype substitute off
the conf structure, we can get rid of the otherwise unused meth_data
member. This allows us to const correct CONF_type_default. Hopefully
we can remove it soon.

ok beck jsing

lib/libcrypto/conf/conf.h
lib/libcrypto/conf/conf_def.c
lib/libcrypto/conf/conf_def.h

index 59222e8..f5c449e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.20 2024/08/31 09:34:05 tb Exp $ */
+/* $OpenBSD: conf.h,v 1.21 2024/08/31 09:36:38 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -127,7 +127,6 @@ void OPENSSL_no_config(void);
 
 struct conf_st {
        CONF_METHOD *meth;
-       void *meth_data;
        LHASH_OF(CONF_VALUE) *data;
 };
 
index f0baee5..5698bfd 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf_def.c,v 1.40 2024/08/31 09:34:05 tb Exp $ */
+/* $OpenBSD: conf_def.c,v 1.41 2024/08/31 09:36:38 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -101,7 +101,6 @@ def_init_default(CONF *conf)
                return 0;
 
        conf->meth = NCONF_default();
-       conf->meth_data = CONF_type_default;
        conf->data = NULL;
 
        return 1;
index 07b0adf..36a8aac 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf_def.h,v 1.7 2024/08/31 09:34:05 tb Exp $ */
+/* $OpenBSD: conf_def.h,v 1.8 2024/08/31 09:36:38 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -79,7 +79,9 @@ __BEGIN_HIDDEN_DECLS
 #define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \
                                        CONF_PUNCTUATION)
 
-#define KEYTYPES(c)            ((unsigned short *)((c)->meth_data))
+static const unsigned short    CONF_type_default[256];
+
+#define KEYTYPES(c)            (CONF_type_default)
 #define IS_COMMENT(c,a)                (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
 #define IS_FCOMMENT(c,a)       (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
 #define IS_EOF(c,a)            (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
@@ -93,7 +95,7 @@ __BEGIN_HIDDEN_DECLS
 #define IS_DQUOTE(c,a)         (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
 #define IS_HIGHBIT(c,a)                (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
 
-static unsigned short CONF_type_default[256] = {
+static const unsigned short CONF_type_default[256] = {
        0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
        0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
        0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,