[openssl] master update
Matt Caswell
matt at openssl.org
Fri Sep 18 12:41:47 UTC 2020
The branch master has been updated
via 282de1cc2d71a95482ce431b9ed620f85eb6acbd (commit)
via 028b31b32da97ada44140120297511eae518ed42 (commit)
via efffd8a6e452102dbf25b1f801c9312211c5fe4a (commit)
via 2ca697ce0006efa0a7b3662a1360eea10a56d2ab (commit)
via 726b3293399cee7b1eedcfb3a524b91537bd5118 (commit)
from ecf15b16ee8223a9a383b97ee41126fbedf89bb5 (commit)
- Log -----------------------------------------------------------------
commit 282de1cc2d71a95482ce431b9ed620f85eb6acbd
Author: Matt Caswell <matt at openssl.org>
Date: Tue Sep 15 14:00:37 2020 +0100
Fix some doc-nits and make update errors
The new lhash changes have confused some of the perl scripts so we add
some fixes.
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12860)
commit 028b31b32da97ada44140120297511eae518ed42
Author: Matt Caswell <matt at openssl.org>
Date: Fri Sep 11 14:04:51 2020 +0100
Remove some unneeded code from lhash.h
lhash.h had some workaround code for the issue where static inline
functions contained references to libcrypto symbols in public header
files. Since this issue no longer exists this workaround code can be
removed.
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12860)
commit efffd8a6e452102dbf25b1f801c9312211c5fe4a
Author: Matt Caswell <matt at openssl.org>
Date: Fri Sep 11 13:51:58 2020 +0100
Update err.h to use the new lhash generation code
Generate the lhash macros for the ERR_STRING_DATA type
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12860)
commit 2ca697ce0006efa0a7b3662a1360eea10a56d2ab
Author: Matt Caswell <matt at openssl.org>
Date: Fri Sep 11 13:48:31 2020 +0100
Update conf.h.in to use the new lhash generation code
Generate the lhash macros for the CONF_VALUE type
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12860)
commit 726b3293399cee7b1eedcfb3a524b91537bd5118
Author: Matt Caswell <matt at openssl.org>
Date: Fri Sep 11 13:22:40 2020 +0100
Provide basis for fixing lhash code
Following on from the earlier safestack work we provide the basis for
fixing the lhash code such that unused static inline functions do not
cause linker errors for applications including those headers.
This brings the lhash code into line with the safestack code.
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12860)
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
build.info | 2 ++
include/openssl/conf.h.in | 7 ++---
include/openssl/{err.h => err.h.in} | 8 ++++-
include/openssl/lhash.h | 62 +++++++++++++++++++++----------------
util/find-doc-nits | 2 ++
util/perl/OpenSSL/ParseC.pm | 2 +-
util/perl/OpenSSL/stackhash.pm | 27 +++++++++++++++-
8 files changed, 78 insertions(+), 33 deletions(-)
rename include/openssl/{err.h => err.h.in} (99%)
diff --git a/.gitignore b/.gitignore
index 8f4bc6af85..a463fc3c96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@
/include/openssl/crmf.h
/include/openssl/crypto.h
/include/openssl/ct.h
+/include/openssl/err.h
/include/openssl/ess.h
/include/openssl/fipskey.h
/include/openssl/ocsp.h
diff --git a/build.info b/build.info
index 8aa668e913..dc239a706d 100644
--- a/build.info
+++ b/build.info
@@ -23,6 +23,7 @@ DEPEND[]=include/openssl/asn1.h \
include/openssl/crmf.h \
include/openssl/crypto.h \
include/openssl/ct.h \
+ include/openssl/err.h \
include/openssl/ess.h \
include/openssl/fipskey.h \
include/openssl/opensslv.h \
@@ -49,6 +50,7 @@ GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
GENERATE[include/openssl/crmf.h]=include/openssl/crmf.h.in
GENERATE[include/openssl/crypto.h]=include/openssl/crypto.h.in
GENERATE[include/openssl/ct.h]=include/openssl/ct.h.in
+GENERATE[include/openssl/err.h]=include/openssl/err.h.in
GENERATE[include/openssl/ess.h]=include/openssl/ess.h.in
GENERATE[include/openssl/fipskey.h]=include/openssl/fipskey.h.in
GENERATE[include/openssl/ocsp.h]=include/openssl/ocsp.h.in
diff --git a/include/openssl/conf.h.in b/include/openssl/conf.h.in
index 2f1fceb2fb..6e3a10ed55 100644
--- a/include/openssl/conf.h.in
+++ b/include/openssl/conf.h.in
@@ -10,7 +10,7 @@
*/
{-
-use OpenSSL::stackhash qw(generate_stack_macros);
+use OpenSSL::stackhash qw(generate_stack_macros generate_lhash_macros);
-}
#ifndef OPENSSL_CONF_H
@@ -40,11 +40,10 @@ typedef struct {
} CONF_VALUE;
{-
- generate_stack_macros("CONF_VALUE");
+ generate_stack_macros("CONF_VALUE")
+ .generate_lhash_macros("CONF_VALUE");
-}
-DEFINE_LHASH_OF(CONF_VALUE);
-
struct conf_st;
struct conf_method_st;
typedef struct conf_method_st CONF_METHOD;
diff --git a/include/openssl/err.h b/include/openssl/err.h.in
similarity index 99%
rename from include/openssl/err.h
rename to include/openssl/err.h.in
index 8e76b812df..b916f436e3 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h.in
@@ -7,6 +7,10 @@
* https://www.openssl.org/source/license.html
*/
+{-
+use OpenSSL::stackhash qw(generate_lhash_macros);
+-}
+
#ifndef OPENSSL_ERR_H
# define OPENSSL_ERR_H
# pragma once
@@ -337,7 +341,9 @@ typedef struct ERR_string_data_st {
const char *string;
} ERR_STRING_DATA;
-DEFINE_LHASH_OF(ERR_STRING_DATA);
+{-
+ generate_lhash_macros("ERR_STRING_DATA");
+-}
/* 12 lines and some on an 80 column terminal */
#define ERR_MAX_DATA_SIZE 1024
diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h
index 5ad9b16ab2..ccdd3a60ee 100644
--- a/include/openssl/lhash.h
+++ b/include/openssl/lhash.h
@@ -125,6 +125,42 @@ void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
# define LHASH_OF(type) struct lhash_st_##type
+/* Helper macro for internal use */
+# define DEFINE_LHASH_OF_INTERNAL(type) \
+ LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \
+ typedef int (*lh_##type##_compfunc)(const type *a, const type *b); \
+ typedef unsigned long (*lh_##type##_hashfunc)(const type *a); \
+ typedef void (*lh_##type##_doallfunc)(type *a); \
+ static ossl_unused ossl_inline type *ossl_check_##type##_lh_plain_type(type *ptr) \
+ { \
+ return ptr; \
+ } \
+ static ossl_unused ossl_inline const type *ossl_check_const_##type##_lh_plain_type(const type *ptr) \
+ { \
+ return ptr; \
+ } \
+ static ossl_unused ossl_inline const OPENSSL_LHASH *ossl_check_const_##type##_lh_type(const LHASH_OF(type) *lh) \
+ { \
+ return (const OPENSSL_LHASH *)lh; \
+ } \
+ static ossl_unused ossl_inline OPENSSL_LHASH *ossl_check_##type##_lh_type(LHASH_OF(type) *lh) \
+ { \
+ return (OPENSSL_LHASH *)lh; \
+ } \
+ static ossl_unused ossl_inline OPENSSL_LH_COMPFUNC ossl_check_##type##_lh_compfunc_type(lh_##type##_compfunc cmp) \
+ { \
+ return (OPENSSL_LH_COMPFUNC)cmp; \
+ } \
+ static ossl_unused ossl_inline OPENSSL_LH_HASHFUNC ossl_check_##type##_lh_hashfunc_type(lh_##type##_hashfunc hfn) \
+ { \
+ return (OPENSSL_LH_HASHFUNC)hfn; \
+ } \
+ static ossl_unused ossl_inline OPENSSL_LH_DOALL_FUNC ossl_check_##type##_lh_doallfunc_type(lh_##type##_doallfunc dfn) \
+ { \
+ return (OPENSSL_LH_DOALL_FUNC)dfn; \
+ } \
+ LHASH_OF(type)
+
# define DEFINE_LHASH_OF(type) \
LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \
static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \
@@ -220,32 +256,6 @@ DEFINE_LHASH_OF(OPENSSL_CSTRING);
# pragma warning (pop)
# endif
-/*
- * If called without higher optimization (min. -xO3) the Oracle Developer
- * Studio compiler generates code for the defined (static inline) functions
- * above.
- * This would later lead to the linker complaining about missing symbols when
- * this header file is included but the resulting object is not linked against
- * the Crypto library (openssl#6912).
- */
-# ifdef __SUNPRO_C
-# pragma weak OPENSSL_LH_new
-# pragma weak OPENSSL_LH_flush
-# pragma weak OPENSSL_LH_free
-# pragma weak OPENSSL_LH_insert
-# pragma weak OPENSSL_LH_delete
-# pragma weak OPENSSL_LH_retrieve
-# pragma weak OPENSSL_LH_error
-# pragma weak OPENSSL_LH_num_items
-# pragma weak OPENSSL_LH_node_stats_bio
-# pragma weak OPENSSL_LH_node_usage_stats_bio
-# pragma weak OPENSSL_LH_stats_bio
-# pragma weak OPENSSL_LH_get_down_load
-# pragma weak OPENSSL_LH_set_down_load
-# pragma weak OPENSSL_LH_doall
-# pragma weak OPENSSL_LH_doall_arg
-# endif /* __SUNPRO_C */
-
#ifdef __cplusplus
}
#endif
diff --git a/util/find-doc-nits b/util/find-doc-nits
index 006edbd184..ac661827dd 100755
--- a/util/find-doc-nits
+++ b/util/find-doc-nits
@@ -100,6 +100,8 @@ my $ignored = qr/(?| ^i2d_
| ^_?DECLARE_
| ^sk_
| ^SKM_DEFINE_STACK_OF_INTERNAL
+ | ^lh_
+ | ^DEFINE_LHASH_OF_INTERNAL
)/x;
# Collect all POD files, both internal and public, and regardless of location
diff --git a/util/perl/OpenSSL/ParseC.pm b/util/perl/OpenSSL/ParseC.pm
index b2ac909dc1..7e6377dd17 100644
--- a/util/perl/OpenSSL/ParseC.pm
+++ b/util/perl/OpenSSL/ParseC.pm
@@ -281,7 +281,7 @@ EOF
{ regexp => qr/(.*)\bLHASH_OF<<<\((.*?)\)>>>(.*)/,
massager => sub { return ("$1struct lhash_st_$2$3"); }
},
- { regexp => qr/DEFINE_LHASH_OF<<<\((.*)\)>>>/,
+ { regexp => qr/DEFINE_LHASH_OF(?:_INTERNAL)?<<<\((.*)\)>>>/,
massager => sub {
return (<<"EOF");
static ossl_inline LHASH_OF($1) * lh_$1_new(unsigned long (*hfn)(const $1 *),
diff --git a/util/perl/OpenSSL/stackhash.pm b/util/perl/OpenSSL/stackhash.pm
index fd7a8cbd06..7cf9c26411 100644
--- a/util/perl/OpenSSL/stackhash.pm
+++ b/util/perl/OpenSSL/stackhash.pm
@@ -16,7 +16,8 @@ our @ISA = qw(Exporter);
our @EXPORT_OK = qw(generate_stack_macros generate_const_stack_macros
generate_stack_string_macros
generate_stack_const_string_macros
- generate_stack_block_macros);
+ generate_stack_block_macros
+ generate_lhash_macros);
sub generate_stack_macros_int {
my $nametype = shift;
@@ -77,4 +78,28 @@ sub generate_stack_const_string_macros {
sub generate_stack_block_macros {
return generate_stack_macros_int("OPENSSL_BLOCK", "void", "void");
}
+
+sub generate_lhash_macros {
+ my $type = shift;
+
+ my $macros = <<END_MACROS;
+DEFINE_LHASH_OF_INTERNAL(${type});
+#define lh_${type}_new(hfn, cmp) ((LHASH_OF(${type}) *)OPENSSL_LH_new(ossl_check_${type}_lh_hashfunc_type(hfn), ossl_check_${type}_lh_compfunc_type(cmp)))
+#define lh_${type}_free(lh) OPENSSL_LH_free(ossl_check_${type}_lh_type(lh))
+#define lh_${type}_flush(lh) OPENSSL_LH_flush(ossl_check_${type}_lh_type(lh))
+#define lh_${type}_insert(lh, ptr) ((${type} *)OPENSSL_LH_insert(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_plain_type(ptr)))
+#define lh_${type}_delete(lh, ptr) ((${type} *)OPENSSL_LH_delete(ossl_check_${type}_lh_type(lh), ossl_check_const_${type}_lh_plain_type(ptr)))
+#define lh_${type}_retrieve(lh, ptr) ((${type} *)OPENSSL_LH_retrieve(ossl_check_${type}_lh_type(lh), ossl_check_const_${type}_lh_plain_type(ptr)))
+#define lh_${type}_error(lh) OPENSSL_LH_error(ossl_check_${type}_lh_type(lh))
+#define lh_${type}_num_items(lh) OPENSSL_LH_num_items(ossl_check_${type}_lh_type(lh))
+#define lh_${type}_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_${type}_lh_type(lh), out)
+#define lh_${type}_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_${type}_lh_type(lh), out)
+#define lh_${type}_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_${type}_lh_type(lh), out)
+#define lh_${type}_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_${type}_lh_type(lh))
+#define lh_${type}_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_${type}_lh_type(lh), dl)
+#define lh_${type}_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_doallfunc_type(dfn))
+END_MACROS
+
+ return $macros;
+}
1;
More information about the openssl-commits
mailing list