[openssl] master update
Richard Levitte
levitte at openssl.org
Fri Oct 18 10:23:08 UTC 2019
The branch master has been updated
via f5453462117e3deb4b077756e2d24edb2ff3b1af (commit)
via 9495a6c45bc7cd69845f9a22eec1fbf8ac735b81 (commit)
via f3866324f0e9bd33feb48aefbe18d8f465d8f2a2 (commit)
via 20551b2e62ed8c2fa97e0106a0350f40f3422dd5 (commit)
from 3d48457478bd61030c370e4090c1462fc4453d81 (commit)
- Log -----------------------------------------------------------------
commit f5453462117e3deb4b077756e2d24edb2ff3b1af
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Oct 17 18:15:13 2019 +0200
Move the version function declarations to include/openssl/crypto.h
include/openssl/crypto.h is where older similar functions already
live, and since opensslv.h became a template, it's no longer useful
for parsing by util/mknum.pl.
Affected declarations:
unsigned int OPENSSL_version_major(void);
unsigned int OPENSSL_version_minor(void);
unsigned int OPENSSL_version_patch(void);
const char *OPENSSL_version_pre_release(void);
const char *OPENSSL_version_build_metadata(void);
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10205)
commit 9495a6c45bc7cd69845f9a22eec1fbf8ac735b81
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Oct 17 16:12:37 2019 +0200
Remove the version number in README
It's cumbersome to have to edit it at release time, it can't be made a
README.in for display reasons (Github won't show it), and having the
version number here gives no special benefit.
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10205)
commit f3866324f0e9bd33feb48aefbe18d8f465d8f2a2
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Oct 17 16:05:38 2019 +0200
Generate include/openssl/opensslv.h
The added benefit is that the result becomes much simple, and easier to
digest for those that still rely on the pre-3.0 opensslv.h contents.
Fixes #10203
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10205)
commit 20551b2e62ed8c2fa97e0106a0350f40f3422dd5
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Oct 17 16:03:06 2019 +0200
Configure: get version from the file 'VERSION' instead of 'opensslv.h'
'VERSION' is a very easy file to parse, as opposed to a header file.
We also have the benefit of holding the version information in one
very well known place and can then generate all other version texts
as we see fit, for example opensslv.h.
Fixes #10203
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10205)
-----------------------------------------------------------------------
Summary of changes:
Configure | 51 ++++-----
README | 2 -
VERSION | 7 ++
build.info | 6 +-
doc/internal/man7/VERSION.pod | 149 ++++++++++++++++++++++++++
doc/man3/OpenSSL_version.pod | 4 +-
include/openssl/crypto.h | 11 ++
include/openssl/{opensslv.h => opensslv.h.in} | 58 +++++-----
util/mkrc.pl | 7 +-
9 files changed, 231 insertions(+), 64 deletions(-)
create mode 100644 VERSION
create mode 100644 doc/internal/man7/VERSION.pod
rename include/openssl/{opensslv.h => opensslv.h.in} (71%)
diff --git a/Configure b/Configure
index 3df3e0c96a..7ff8b06214 100755
--- a/Configure
+++ b/Configure
@@ -255,38 +255,39 @@ if (grep /^reconf(igure)?$/, @argvcopy) {
$config{perlargv} = [ @argvcopy ];
# Collect version numbers
-$config{major} = "unknown";
-$config{minor} = "unknown";
-$config{patch} = "unknown";
-$config{prerelease} = "";
-$config{build_metadata} = "";
-$config{shlib_version} = "unknown";
+my %version = ();
collect_information(
- collect_from_file(catfile($srcdir,'include/openssl/opensslv.h')),
- qr/#\s+define\s+OPENSSL_VERSION_MAJOR\s+(\d+)/ =>
- sub { $config{major} = $1; },
- qr/#\s+define\s+OPENSSL_VERSION_MINOR\s+(\d+)/ =>
- sub { $config{minor} = $1; },
- qr/#\s+define\s+OPENSSL_VERSION_PATCH\s+(\d+)/ =>
- sub { $config{patch} = $1; },
- qr/#\s+define\s+OPENSSL_VERSION_PRE_RELEASE\s+"((?:\\.|[^"])*)"/ =>
- sub { $config{prerelease} = $1; },
- qr/#\s+define\s+OPENSSL_VERSION_BUILD_METADATA\s+"((?:\\.|[^"])*)"/ =>
- sub { $config{build_metadata} = $1; },
- qr/#\s+define\s+OPENSSL_SHLIB_VERSION\s+([\d\.]+)/ =>
- sub { $config{shlib_version} = $1; },
+ collect_from_file(catfile($srcdir,'VERSION')),
+ qr/\s*(\w+)\s*=\s*(.*?)\s*$/ =>
+ sub {
+ # Only define it if there is a value at all
+ $version{uc $1} = $2 if $2 ne '';
+ },
+ "OTHERWISE" =>
+ sub { die "Something wrong with this line:\n$_\nin $srcdir/VERSION" },
);
-die "erroneous version information in opensslv.h: ",
- "$config{major}.$config{minor}.$config{patch}, $config{shlib_version}\n"
- if ($config{major} eq "unknown"
- || $config{minor} eq "unknown"
- || $config{patch} eq "unknown"
- || $config{shlib_version} eq "unknown");
+
+$config{major} = $version{MAJOR} // 'unknown';
+$config{minor} = $version{MINOR} // 'unknown';
+$config{patch} = $version{PATCH} // 'unknown';
+$config{prerelease} =
+ defined $version{PRE_RELEASE_TAG} ? "-$version{PRE_RELEASE_TAG}" : '';
+$config{build_metadata} =
+ defined $version{BUILD_METADATA} ? "+$version{BUILD_METADATA}" : '';
+$config{shlib_version} = $version{SHLIB_VERSION} // 'unknown';
+$config{release_date} = $version{RELEASE_DATE} // 'xx XXX xxxx';
$config{version} = "$config{major}.$config{minor}.$config{patch}";
$config{full_version} = "$config{version}$config{prerelease}$config{build_metadata}";
+die "erroneous version information in VERSION: ",
+ "$config{version}, $config{shlib_version}\n"
+ unless (defined $version{MAJOR}
+ && defined $version{MINOR}
+ && defined $version{PATCH}
+ && defined $version{SHLIB_VERSION});
+
# Collect target configurations
my $pattern = catfile(dirname($0), "Configurations", "*.conf");
diff --git a/README b/README
index 3559566414..5bd9e13f17 100644
--- a/README
+++ b/README
@@ -1,6 +1,4 @@
- OpenSSL 3.0.0-dev
-
Copyright (c) 1998-2018 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
All rights reserved.
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000000..cba848cebe
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,7 @@
+MAJOR=3
+MINOR=0
+PATCH=0
+PRE_RELEASE_TAG=dev
+BUILD_METADATA=
+RELEASE_DATE=
+SHLIB_VERSION=3
diff --git a/build.info b/build.info
index 5e63b440df..6b70b11006 100644
--- a/build.info
+++ b/build.info
@@ -9,9 +9,11 @@ DEPEND[libssl]=libcrypto
# Empty DEPEND "indices" means the dependencies are expected to be built
# unconditionally before anything else.
-DEPEND[]=include/openssl/opensslconf.h include/crypto/bn_conf.h \
- include/crypto/dso_conf.h doc/man7/openssl_user_macros.pod
+DEPEND[]=include/openssl/opensslconf.h include/openssl/opensslv.h \
+ include/crypto/bn_conf.h include/crypto/dso_conf.h \
+ doc/man7/openssl_user_macros.pod
GENERATE[include/openssl/opensslconf.h]=include/openssl/opensslconf.h.in
+GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
GENERATE[doc/man7/openssl_user_macros.pod]=doc/man7/openssl_user_macros.pod.in
diff --git a/doc/internal/man7/VERSION.pod b/doc/internal/man7/VERSION.pod
new file mode 100644
index 0000000000..4bc8ba6b93
--- /dev/null
+++ b/doc/internal/man7/VERSION.pod
@@ -0,0 +1,149 @@
+=pod
+
+=head1 NAME
+
+VERSION - OpenSSL version information
+
+=head1 SYNOPSIS
+
+ MAJOR=3
+ MINOR=0
+ PATCH=0
+ PRE_RELEASE_TAG=dev
+ BUILD_METADATA=
+ RELEASE_DATE=
+ SHLIB_VERSION=3
+
+=head1 DESCRIPTION
+
+This file is a set of keyed information looking like simple variable
+assignments. When given an empty value, they are seen as unassigned.
+The keys that are recognised are:
+
+=over 4
+
+=item B<MAJOR>, B<MINOR>, B<PATCH>
+
+The three parts of OpenSSL's 3 numbered version number, MAJOR.MINOR.PATCH.
+These are used to compose the values for the C macros B<OPENSSL_VERSION_MAJOR>,
+B<OPENSSL_VERSION_MINOR>, B<OPENSSL_VERSION_PACTH>.
+
+=item B<PRE_RELEASE_TAG>
+
+This is the added pre-release tag, which is added to the version separated by
+a dash. For a value C<foo>, the C macro B<OPENSSL_VERSION_PRE_RELEASE> gets
+the string C<-foo> (dash added).
+
+=item B<BUILD_METADATA>
+
+Extra metadata to be used by anyone for their own purposes. This is added to
+the version and possible pre-release tag, separated by a plus sign. For a
+value C<bar>, the C macro B<OPENSSL_VERSION_BUILD_METADATA> gets the string
+C<+bar>.
+
+=item B<RELEASE_DATE>
+
+Defined in releases. When not set, it gets the value C<xx XXX xxxx>.
+
+=item B<SHLIB_VERSION>
+
+The shared library version, which is something other than the project version.
+
+=back
+
+It is a configuration error if B<MAJOR>, B<MINOR>, B<PATCH> and B<SHLIB_VERSION>
+don't have values. Configuration will stop in that case.
+
+=head2 Affected configuration data
+
+The following items in %config from F<configdata.pm> are affected:
+
+=over 4
+
+=item $config{major}, $config{minor}, $config{patch}, $config{shlib_version}
+
+These items get their values from B<MAJOR>, B<MINOR>, B<PATCH>, and
+B<SHLIB_VERSION>, respectively.
+
+=item $config{prerelease}
+
+If B<PRERELEASE> is assigned a value, $config{prerelease} gets that same value,
+prefixed by a dash, otherwise the empty string.
+
+=item $config{build_metadata}
+
+If B<BUILD_METADATA> is assigned a value, $config{build_metadata} gets that same
+value, prefixed by a plus sign, otherwise the empty string.
+
+=item $config{release_date}
+
+If B<RELEASE_DATE> is assigned a value, $config{release_date} gets that same
+value, otherwise the string C<xx XXX yyyy>.
+
+=item $config{version}
+
+The minimal version number, a string composed from B<MAJOR>, B<MINOR> and
+B<PATCH>, separated by periods. For C<MAJOR=3>, C<MINOR=0> and C<PATCH=0>,
+the string will be C<3.0.0>.
+
+=item $config{full_version}
+
+The fully loaded version number, a string composed from $config{version},
+$config{prerelease} and $config{build_metadata}. See See L</EXAMPLES> for
+a few examples.
+
+=back
+
+=head1 EXAMPLES
+
+=over 4
+
+=item 1.
+
+ MAJOR=3
+ MINOR=0
+ PATCH=0
+ PRE_RELEASE_TAG=dev
+ BUILD_METADATA=
+
+The fully loaded version number ($config{full_version}) will be
+C<3.0.0-dev>.
+
+=item 2.
+
+ MAJOR=3
+ MINOR=0
+ PATCH=0
+ PRE_RELEASE_TAG=
+ BUILD_METADATA=something
+
+The fully loaded version number ($config{full_version}) will be
+C<3.0.0+something>.
+
+=item 3.
+
+ MAJOR=3
+ MINOR=0
+ PATCH=0
+ PRE_RELEASE_TAG=alpha3
+ BUILD_METADATA=something
+
+The fully loaded version number ($config{full_version}) will be
+C<3.0.0-alpha3+something>.
+
+=back
+
+=head1 SEE ALSO
+
+L<OpenSSL_version(3)>
+
+=head1 COPYRIGHT
+
+Copyright 2019 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
+in the file LICENSE in the source distribution or at
+L<https://www.openssl.org/source/license.html>.
+
+=cut
diff --git a/doc/man3/OpenSSL_version.pod b/doc/man3/OpenSSL_version.pod
index 18eaf4a9e9..7e9c36eb76 100644
--- a/doc/man3/OpenSSL_version.pod
+++ b/doc/man3/OpenSSL_version.pod
@@ -27,14 +27,14 @@ OPENSSL_VERSION_NUMBER, OpenSSL_version_num, OPENSSL_info
#define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
+ #include <openssl/crypto.h>
+
unsigned int OPENSSL_version_major(void);
unsigned int OPENSSL_version_minor(void);
unsigned int OPENSSL_version_patch(void);
const char *OPENSSL_version_pre_release(void);
const char *OPENSSL_version_build_metadata(void);
- #include <openssl/crypto.h>
-
const char *OpenSSL_version(int t);
const char *OPENSSL_info(int t);
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index 9fb2fa3925..7a74f3d4eb 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -164,6 +164,17 @@ int OPENSSL_hexchar2int(unsigned char c);
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
+/*
+ * These functions return the values of OPENSSL_VERSION_MAJOR,
+ * OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE
+ * and OPENSSL_VERSION_BUILD_METADATA, respectively.
+ */
+unsigned int OPENSSL_version_major(void);
+unsigned int OPENSSL_version_minor(void);
+unsigned int OPENSSL_version_patch(void);
+const char *OPENSSL_version_pre_release(void);
+const char *OPENSSL_version_build_metadata(void);
+
unsigned long OpenSSL_version_num(void);
const char *OpenSSL_version(int type);
# define OPENSSL_VERSION 0
diff --git a/include/openssl/opensslv.h b/include/openssl/opensslv.h.in
similarity index 71%
rename from include/openssl/opensslv.h
rename to include/openssl/opensslv.h.in
index cb3eb32d0b..69ba8c657a 100644
--- a/include/openssl/opensslv.h
+++ b/include/openssl/opensslv.h.in
@@ -1,4 +1,6 @@
/*
+ * {- join("\n * ", @autowarntext) -}
+ *
* Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@@ -29,9 +31,9 @@ extern "C" {
*
* These macros express version number MAJOR.MINOR.PATCH exactly
*/
-# define OPENSSL_VERSION_MAJOR 3
-# define OPENSSL_VERSION_MINOR 0
-# define OPENSSL_VERSION_PATCH 0
+# define OPENSSL_VERSION_MAJOR {- $config{major} -}
+# define OPENSSL_VERSION_MINOR {- $config{minor} -}
+# define OPENSSL_VERSION_PATCH {- $config{patch} -}
/*
* Additional version information, defined only when used.
@@ -41,10 +43,24 @@ extern "C" {
*/
/* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */
-# define OPENSSL_VERSION_PRE_RELEASE "-dev"
+{- $config{prerelease}
+ ? << "_____"
+# define OPENSSL_VERSION_PRE_RELEASE "$config{prerelease}"
+_____
+ : << "_____"
+# undef OPENSSL_VERSION_PRE_RELEASE
+_____
+-}
/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */
/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */
+{- $build_metadata
+ ? << "_____"
+# define OPENSSL_VERSION_BUILD_METADATA "{- $config{build_metadata} -}"
+_____
+ : << "_____"
# undef OPENSSL_VERSION_BUILD_METADATA
+_____
+-}
/*
* Note: OPENSSL_VERSION_BUILD_METADATA will never be defined by
@@ -76,7 +92,7 @@ extern "C" {
* be related to the API version expressed with the macros above.
* This is defined in free form.
*/
-# define OPENSSL_SHLIB_VERSION 3
+# define OPENSSL_SHLIB_VERSION {- $config{shlib_version} -}
/*
* SECTION 2: USEFUL MACROS AND FUNCTIONS
@@ -86,21 +102,6 @@ extern "C" {
# define OPENSSL_VERSION_PREREQ(maj,min) \
((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
-/* Helper macros for CPP string composition */
-# define OPENSSL_MSTR_HELPER(x) #x
-# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x)
-
-/*
- * These return the values of OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR,
- * OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE and
- * OPENSSL_VERSION_BUILD_METADATA, respectively.
- */
-unsigned int OPENSSL_version_major(void);
-unsigned int OPENSSL_version_minor(void);
-unsigned int OPENSSL_version_patch(void);
-const char *OPENSSL_version_pre_release(void);
-const char *OPENSSL_version_build_metadata(void);
-
/*
* Macros to get the version in easily digested string form, both the short
* "MAJOR.MINOR.PATCH" variant (where MAJOR, MINOR and PATCH are replaced
@@ -108,21 +109,16 @@ const char *OPENSSL_version_build_metadata(void);
* longer variant with OPENSSL_VERSION_PRE_RELEASE_STR and
* OPENSSL_VERSION_BUILD_METADATA_STR appended.
*/
-# define OPENSSL_VERSION_STR \
- OPENSSL_MSTR(OPENSSL_VERSION_MAJOR) "." \
- OPENSSL_MSTR(OPENSSL_VERSION_MINOR) "." \
- OPENSSL_MSTR(OPENSSL_VERSION_PATCH)
-# define OPENSSL_FULL_VERSION_STR \
- OPENSSL_VERSION_STR \
- OPENSSL_VERSION_PRE_RELEASE_STR \
- OPENSSL_VERSION_BUILD_METADATA_STR
+# define OPENSSL_VERSION_STR "{- $config{version} -}"
+# define OPENSSL_FULL_VERSION_STR "{- $config{full_version} -}"
/*
* SECTION 3: ADDITIONAL METADATA
+ *
+ * These strings are defined separately to allow them to be parsable.
*/
-# define OPENSSL_RELEASE_DATE "xx XXX xxxx"
-# define OPENSSL_VERSION_TEXT \
- "OpenSSL " OPENSSL_FULL_VERSION_STR " " OPENSSL_RELEASE_DATE
+# define OPENSSL_RELEASE_DATE "{- $config{release_date} -}"
+# define OPENSSL_VERSION_TEXT "OpenSSL {- "$config{full_version} $config{release_date}" -}"
/*
* SECTION 4: BACKWARD COMPATIBILITY
diff --git a/util/mkrc.pl b/util/mkrc.pl
index b4c53edf6b..8ff358857d 100755
--- a/util/mkrc.pl
+++ b/util/mkrc.pl
@@ -11,8 +11,11 @@ use warnings;
use lib ".";
use configdata;
-my $cversion = "$config{major},$config{minor},$config{patch}";
-my $version = "$config{major}.$config{minor}.$config{patch}$config{prerelease}$config{build_metadata}";
+my $cversion = "$config{version}";
+my $version = "$config{full_version}";
+
+# RC syntax for versions uses commas as separators, rather than period
+$cversion =~ s|\.|,|g;
my $filename = $ARGV[0];
my $description = "OpenSSL library";
More information about the openssl-commits
mailing list