summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-09-27 15:56:35 +0200
committerRichard Levitte <levitte@openssl.org>2018-12-06 12:24:47 +0100
commit3a63dbef15b62b121c5df8762f8cb915fb06b27a (patch)
tree5408ad7c75146d2a70da69adf99c395f5fa67c19
parent672f943ad6c6d16b1f65a77b8e2c83c8f44a112b (diff)
Switch to MAJOR.MINOR.PATCH versioning and version 3.0.0-dev
We're strictly use version numbers of the form MAJOR.MINOR.PATCH. Letter releases are things of days past. The most central change is that we now express the version number with three macros, one for each part of the version number: OPENSSL_VERSION_MAJOR OPENSSL_VERSION_MINOR OPENSSL_VERSION_PATCH We also provide two additional macros to express pre-release and build metadata information (also specified in semantic versioning): OPENSSL_VERSION_PRE_RELEASE OPENSSL_VERSION_BUILD_METADATA To get the library's idea of all those values, we introduce the following functions: 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); Additionally, for shared library versioning (which is out of scope in semantic versioning, but that we still need): OPENSSL_SHLIB_VERSION We also provide a macro that contains the release date. This is not part of the version number, but is extra information that we want to be able to display: OPENSSL_RELEASE_DATE Finally, also provide the following convenience functions: const char *OPENSSL_version_text(void); const char *OPENSSL_version_text_full(void); The following macros and functions are deprecated, and while currently existing for backward compatibility, they are expected to disappear: OPENSSL_VERSION_NUMBER OPENSSL_VERSION_TEXT OPENSSL_VERSION OpenSSL_version_num() OpenSSL_version() Also, this function is introduced to replace OpenSSL_version() for all indexes except for OPENSSL_VERSION: OPENSSL_info() For configuration, the option 'newversion-only' is added to disable all the macros and functions that are mentioned as deprecated above. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7724)
-rw-r--r--CHANGES14
-rw-r--r--Configurations/descrip.mms.tmpl7
-rw-r--r--Configurations/unix-Makefile.tmpl7
-rw-r--r--Configurations/windows-makefile.tmpl4
-rwxr-xr-xConfigure40
-rw-r--r--NEWS4
-rw-r--r--README2
-rw-r--r--VMS/openssl_shutdown.com.in2
-rw-r--r--VMS/openssl_startup.com.in2
-rw-r--r--apps/speed.c4
-rw-r--r--apps/version.c3
-rw-r--r--build.info11
-rw-r--r--crypto/cversion.c31
-rw-r--r--doc/man3/EVP_PKEY_supports_digest_nid.pod2
-rw-r--r--doc/man3/OPENSSL_VERSION_NUMBER.pod113
-rw-r--r--doc/man3/OpenSSL_version.pod191
-rw-r--r--engines/e_padlock.c13
-rw-r--r--include/openssl/crypto.h16
-rw-r--r--include/openssl/opensslconf.h.in8
-rw-r--r--include/openssl/opensslv.h200
-rw-r--r--test/recipes/80-test_cipherlist.t2
-rw-r--r--test/recipes/90-test_shlibload.t3
-rw-r--r--test/shlibloadtest.c39
-rw-r--r--test/versions.c5
-rw-r--r--util/libcrypto.num59
-rwxr-xr-xutil/mkdef.pl14
-rwxr-xr-xutil/mkrc.pl32
-rw-r--r--util/perl/OpenSSL/Ordinals.pm8
-rw-r--r--util/perl/OpenSSL/Test.pm11
-rw-r--r--util/private.num9
30 files changed, 493 insertions, 363 deletions
diff --git a/CHANGES b/CHANGES
index c55457509b..e31b087b4a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,7 +7,19 @@
https://github.com/openssl/openssl/commits/ and pick the appropriate
release branch.
- Changes between 1.1.1 and 1.1.2 [xx XXX xxxx]
+ Changes between 1.1.1 and 3.0.0 [xx XXX xxxx]
+
+ *) Switch to a new version scheme using three numbers MAJOR.MINOR.PATCH.
+
+ o Major releases (indicated by incrementing the MAJOR release number)
+ may introduce incompatible API/ABI changes.
+ o Minor releases (indicated by incrementing the MINOR release number)
+ may introduce new features but retain API/ABI compatibility.
+ o Patch releases (indicated by incrementing the PATCH number)
+ are intended for bug fixes and other improvements of existing
+ features only (like improving performance or adding documentation)
+ and retain API/ABI compatibility.
+ [Richard Levitte]
*) Remove the 'dist' target and add a tarball building script. The
'dist' target has fallen out of use, and it shouldn't be
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index c6a31c8dd7..4215fe92b2 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -104,13 +104,10 @@ BLDDIR={- $config{builddir} -}
# to testing.
VERBOSE=$(V)
-VERSION={- $config{version} -}
+VERSION={- "$config{major}.$config{minor}.$config{patch}$config{prerelease}$config{build_metadata}" -}
MAJOR={- $config{major} -}
MINOR={- $config{minor} -}
-SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
-SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
-SHLIB_MAJOR={- $config{shlib_major} -}
-SHLIB_MINOR={- $config{shlib_minor} -}
+SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
SHLIB_TARGET={- $target{shared_target} -}
EXE_EXT=.EXE
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index ecdd0c147c..c0e6d521ef 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -88,13 +88,10 @@ CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
SRCDIR={- $config{sourcedir} -}
BLDDIR={- $config{builddir} -}
-VERSION={- $config{version} -}
+VERSION={- "$config{major}.$config{minor}.$config{patch}$config{prerelease}$config{build_metadata}" -}
MAJOR={- $config{major} -}
MINOR={- $config{minor} -}
-SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
-SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
-SHLIB_MAJOR={- $config{shlib_major} -}
-SHLIB_MINOR={- $config{shlib_minor} -}
+SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
SHLIB_TARGET={- $target{shared_target} -}
SHLIB_EXT={- $shlibext -}
SHLIB_EXT_SIMPLE={- $shlibextsimple -}
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index e1426ccf41..8b3914d7ac 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -71,11 +71,11 @@ PLATFORM={- $config{target} -}
SRCDIR={- $config{sourcedir} -}
BLDDIR={- $config{builddir} -}
-VERSION={- $config{version} -}
+VERSION={- "$config{major}.$config{minor}.$config{patch}$config{prerelease}$config{build_metadata}" -}
MAJOR={- $config{major} -}
MINOR={- $config{minor} -}
-SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
+SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
LIBS={- join(" ", map { ( shlib_import($_), lib($_) ) } @{$unified_info{libraries}}) -}
SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
diff --git a/Configure b/Configure
index 65bbec1f31..f9515a945c 100755
--- a/Configure
+++ b/Configure
@@ -242,28 +242,34 @@ if (grep /^reconf(igure)?$/, @argvcopy) {
$config{perlargv} = [ @argvcopy ];
# Collect version numbers
-$config{version} = "unknown";
-$config{version_num} = "unknown";
-$config{shlib_version_number} = "unknown";
-$config{shlib_version_history} = "unknown";
+$config{major} = "unknown";
+$config{minor} = "unknown";
+$config{patch} = "unknown";
+$config{prerelease} = "";
+$config{build_metadata} = "";
+$config{shlib_version} = "unknown";
collect_information(
collect_from_file(catfile($srcdir,'include/openssl/opensslv.h')),
- qr/OPENSSL.VERSION.TEXT.*OpenSSL (\S+) / => sub { $config{version} = $1; },
- qr/OPENSSL.VERSION.NUMBER.*(0x\S+)/ => sub { $config{version_num}=$1 },
- qr/SHLIB_VERSION_NUMBER *"([^"]+)"/ => sub { $config{shlib_version_number}=$1 },
- qr/SHLIB_VERSION_HISTORY *"([^"]*)"/ => sub { $config{shlib_version_history}=$1 }
+ 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; },
);
-if ($config{shlib_version_history} ne "") { $config{shlib_version_history} .= ":"; }
-
-($config{major}, $config{minor})
- = ($config{version} =~ /^([0-9]+)\.([0-9\.]+)/);
-($config{shlib_major}, $config{shlib_minor})
- = ($config{shlib_version_number} =~ /^([0-9]+)\.([0-9\.]+)/);
die "erroneous version information in opensslv.h: ",
- "$config{major}, $config{minor}, $config{shlib_major}, $config{shlib_minor}\n"
- if ($config{major} eq "" || $config{minor} eq ""
- || $config{shlib_major} eq "" || $config{shlib_minor} eq "");
+ "$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");
# Collect target configurations
diff --git a/NEWS b/NEWS
index df16b7894f..7ac249e5f5 100644
--- a/NEWS
+++ b/NEWS
@@ -5,8 +5,10 @@
This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file.
- Major changes between OpenSSL 1.1.1 and OpenSSL 1.1.2 [under development]
+ Major changes between OpenSSL 1.1.1 and OpenSSL 3.0.0 [under development]
+ o Changed our version number scheme and set the next major release to
+ 3.0.0
o Added EVP_MAC, an EVP layer MAC API, and a generic EVP_PKEY to EVP_MAC
bridge.
diff --git a/README b/README
index 6818807a4c..fe3f98070c 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
- OpenSSL 1.1.2-dev
+ OpenSSL 3.0.0-dev
Copyright (c) 1998-2018 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
diff --git a/VMS/openssl_shutdown.com.in b/VMS/openssl_shutdown.com.in
index fd4e3d5086..c3b8de8b6d 100644
--- a/VMS/openssl_shutdown.com.in
+++ b/VMS/openssl_shutdown.com.in
@@ -26,7 +26,7 @@ $ ENDIF
$
$ ! Abbrevs
$ DEAS := DEASSIGN /NOLOG 'P1'
-$ sv := {- sprintf "%02d%02d", split m|\.|, $config{shlib_version_number} -}
+$ sv := {- sprintf "%02d%02d", split m|\.|, $config{shlib_version} -}
$ pz := {- $config{pointer_size} -}
$
$ DEAS OSSL$DATAROOT
diff --git a/VMS/openssl_startup.com.in b/VMS/openssl_startup.com.in
index 9e6e1c0b35..a6624eb698 100644
--- a/VMS/openssl_startup.com.in
+++ b/VMS/openssl_startup.com.in
@@ -88,7 +88,7 @@ $
$ ! Abbrevs
$ DEFT := DEFINE /TRANSLATION=CONCEALED /NOLOG 'P1'
$ DEF := DEFINE /NOLOG 'P1'
-$ sv := {- sprintf "%02d%02d", split m|\.|, $config{shlib_version_number} -}
+$ sv := {- sprintf "%02d%02d", split m|\.|, $config{shlib_version} -}
$ pz := {- $config{pointer_size} -}
$
$ DEFT OSSL$DATAROOT 'OPENSSLDIR_']
diff --git a/apps/speed.c b/apps/speed.c
index 833bb9bfe9..08ddad0213 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -3223,8 +3223,8 @@ int speed_main(int argc, char **argv)
show_res:
#endif
if (!mr) {
- printf("%s\n", OpenSSL_version(OPENSSL_VERSION));
- printf("%s\n", OpenSSL_version(OPENSSL_BUILT_ON));
+ printf("version: %s\n", OpenSSL_version(OPENSSL_FULL_VERSION_STRING));
+ printf("built on: %s\n", OpenSSL_version(OPENSSL_BUILT_ON));
printf("options:");
printf("%s ", BN_options());
#ifndef OPENSSL_NO_MD2
diff --git a/apps/version.c b/apps/version.c
index 2aca163615..515a107651 100644
--- a/apps/version.c
+++ b/apps/version.c
@@ -118,7 +118,8 @@ opthelp:
version = 1;
if (version) {
- if (OpenSSL_version_num() == OPENSSL_VERSION_NUMBER)
+ if (strcmp(OpenSSL_version(OPENSSL_FULL_VERSION_STRING),
+ OPENSSL_FULL_VERSION_STR) == 0)
printf("%s\n", OpenSSL_version(OPENSSL_VERSION));
else
printf("%s (Library: %s)\n",
diff --git a/build.info b/build.info
index c2ed667afb..afcb772caf 100644
--- a/build.info
+++ b/build.info
@@ -3,14 +3,11 @@
SUBDIRS=crypto ssl apps test util tools fuzz engines
{-
- use File::Spec::Functions;
-
- our $sover = $config{shlib_version_number};
- our $sover_filename = $sover;
- $sover_filename =~ s|\.|_|g
+ my @sover = split(/\./, $config{shlib_version});
+ our $sover_filename;
+ $sover_filename = join('.', @sover)
if $config{target} =~ /^mingw/ || $config{target} =~ /^VC-/;
- $sover_filename =
- sprintf "%02d%02d", split m|\.|, $config{shlib_version_number}
+ $sover_filename = join('', map { sprintf "%02d", $_ } @sover)
if $config{target} =~ /^vms/;
"";
-}
diff --git a/crypto/cversion.c b/crypto/cversion.c
index 534e7eba55..16cd241f25 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -11,16 +11,47 @@
#include "buildinf.h"
+#if OPENSSL_API_COMPAT < 0x30000000L
unsigned long OpenSSL_version_num(void)
{
return OPENSSL_VERSION_NUMBER;
}
+#endif
+
+unsigned int OPENSSL_version_major(void)
+{
+ return OPENSSL_VERSION_MAJOR;
+}
+
+unsigned int OPENSSL_version_minor(void)
+{
+ return OPENSSL_VERSION_MINOR;
+}
+
+unsigned int OPENSSL_version_patch(void)
+{
+ return OPENSSL_VERSION_PATCH;
+}
+
+const char *OPENSSL_version_pre_release(void)
+{
+ return OPENSSL_VERSION_PRE_RELEASE_STR;
+}
+
+const char *OPENSSL_version_build_metadata(void)
+{
+ return OPENSSL_VERSION_BUILD_METADATA_STR;
+}
const char *OpenSSL_version(int t)
{
switch (t) {
case OPENSSL_VERSION:
return OPENSSL_VERSION_TEXT;
+ case OPENSSL_VERSION_STRING:
+ return OPENSSL_VERSION_STR;
+ case OPENSSL_FULL_VERSION_STRING:
+ return OPENSSL_FULL_VERSION_STR;
case OPENSSL_BUILT_ON:
return DATE;
case OPENSSL_CFLAGS:
diff --git a/doc/man3/EVP_PKEY_supports_digest_nid.pod b/doc/man3/EVP_PKEY_supports_digest_nid.pod
index 4f0882c210..48a75f82de 100644
--- a/doc/man3/EVP_PKEY_supports_digest_nid.pod
+++ b/doc/man3/EVP_PKEY_supports_digest_nid.pod
@@ -39,7 +39,7 @@ L<EVP_PKEY_verify_recover(3)>,
=head1 HISTORY
-This function was first added to OpenSSL 1.1.2.
+This function was first added to OpenSSL 3.0.0.
=head1 COPYRIGHT
diff --git a/doc/man3/OPENSSL_VERSION_NUMBER.pod b/doc/man3/OPENSSL_VERSION_NUMBER.pod
deleted file mode 100644
index 55a55c706a..0000000000
--- a/doc/man3/OPENSSL_VERSION_NUMBER.pod
+++ /dev/null
@@ -1,113 +0,0 @@
-=pod
-
-=head1 NAME
-
-OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT, OpenSSL_version,
-OpenSSL_version_num - get OpenSSL version number
-
-=head1 SYNOPSIS
-
- #include <openssl/opensslv.h>
- #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL
- #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
-
- #include <openssl/crypto.h>
-
- unsigned long OpenSSL_version_num();
- const char *OpenSSL_version(int t);
-
-=head1 DESCRIPTION
-
-OPENSSL_VERSION_NUMBER is a numeric release version identifier:
-
- MNNFFPPS: major minor fix patch status
-
-The status nibble has one of the values 0 for development, 1 to e for betas
-1 to 14, and f for release.
-
-for example
-
- 0x000906000 == 0.9.6 dev
- 0x000906023 == 0.9.6b beta 3
- 0x00090605f == 0.9.6e release
-
-Versions prior to 0.9.3 have identifiers E<lt> 0x0930.
-Versions between 0.9.3 and 0.9.5 had a version identifier with this
-interpretation:
-
- MMNNFFRBB major minor fix final beta/patch
-
-for example
-
- 0x000904100 == 0.9.4 release
- 0x000905000 == 0.9.5 dev
-
-Version 0.9.5a had an interim interpretation that is like the current one,
-except the patch level got the highest bit set, to keep continuity. The
-number was therefore 0x0090581f.
-
-OPENSSL_VERSION_TEXT is the text variant of the version number and the
-release date. For example,
-"OpenSSL 1.0.1a 15 Oct 2015".
-
-OpenSSL_version_num() returns the version number.
-
-OpenSSL_version() returns different strings depending on B<t>:
-
-=over 4
-
-=item OPENSSL_VERSION
-
-The text variant of the version number and the release date. For example,
-"OpenSSL 1.0.1a 15 Oct 2015".
-
-=item OPENSSL_CFLAGS
-
-The compiler flags set for the compilation process in the form
-"compiler: ..." if available or "compiler: information not available"
-otherwise.
-
-=item OPENSSL_BUILT_ON
-
-The date of the build process in the form "built on: ..." if available
-or "built on: date not available" otherwise.
-
-=item OPENSSL_PLATFORM
-
-The "Configure" target of the library build in the form "platform: ..."
-if available or "platform: information not available" otherwise.
-
-=item OPENSSL_DIR
-
-The "OPENSSLDIR" setting of the library build in the form "OPENSSLDIR: "...""
-if available or "OPENSSLDIR: N/A" otherwise.
-
-=item OPENSSL_ENGINES_DIR
-
-The "ENGINESDIR" setting of the library build in the form "ENGINESDIR: "...""
-if available or "ENGINESDIR: N/A" otherwise.
-
-=back
-
-For an unknown B<t>, the text "not available" is returned.
-
-=head1 RETURN VALUES
-
-OpenSSL_version_num() returns the version number.
-
-OpenSSL_version() returns requested version strings.
-
-=head1 SEE ALSO
-
-L<crypto(7)>
-
-=head1 COPYRIGHT
-
-Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
-
-Licensed under the OpenSSL license (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
new file mode 100644
index 0000000000..cf5794a720
--- /dev/null
+++ b/doc/man3/OpenSSL_version.pod
@@ -0,0 +1,191 @@
+=pod
+
+=head1 NAME
+
+OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH,
+OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA,
+OPENSSL_VERSION_PRE_RELEASE_STR, OPENSSL_VERSION_BUILD_METADATA_STR,
+OPENSSL_VERSION_TEXT,
+OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch,
+OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version,
+OPENSSL_VERSION_NUMBER, OpenSSL_version_num
+- get OpenSSL version number
+
+=head1 SYNOPSIS
+
+ #include <openssl/opensslv.h>
+
+ #define OPENSSL_VERSION_MAJOR x
+ #define OPENSSL_VERSION_MINOR y
+ #define OPENSSL_VERSION_PATCH z
+
+ /* The definitions here are typical release values */
+ #undef OPENSSL_VERSION_PRE_RELEASE
+ #undef OPENSSL_VERSION_BUILD_METADATA
+ #define OPENSSL_VERSION_PRE_RELEASE_STR ""
+ #define OPENSSL_VERSION_BUILD_METADATA_STR ""
+
+ #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
+
+ 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);
+
+Deprecated:
+
+ /* from openssl/opensslv.h */
+ #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL
+
+ /* from openssl/crypto.h */
+ unsigned long OpenSSL_version_num();
+
+=head1 DESCRIPTION
+
+=head2 Macros
+
+The three macros B<OPENSSL_VERSION_MAJOR>, B<OPENSSL_VERSION_MINOR> and
+B<OPENSSL_VERSION_PATCH> represent the three parts of a 3 numbered version
+number, MAJOR.MINOR.PATCH.
+
+The macro B<OPENSSL_VERSION_PRE_RELEASE> is an added bit of text that,
+when defined, indicates that this is a pre-release version, such as
+C<"-dev"> for an ongoing development snapshot, C<"-alpha3"> for an
+alpha release, etc...
+The value must be a string.
+
+The macro B<OPENSSL_VERSION_BUILD_METADATA> is extra metadata, reserved
+for other parties (examples: C<"+fips">, C<"+vendor.1">).
+The OpenSSL project will not touch this macro.
+The value must be a string.
+
+B<OPENSSL_VERSION_STR> is a convenience macro to get the short version
+number string, "MAJOR.MINOR.PATCH".
+
+B<OPENSSL_FULL_VERSION_STR> is a convenience macro to get the longer
+version number string, which combines B<OPENSSL_VERSION_STR>,
+B<OPENSSL_VERSION_PRE_RELEASE> and B<OPENSSL_VERSION_BUILD_METADATA>.
+
+B<OPENSSL_VERSION_TEXT> is a convenience macro to get a full descriptive
+version text, which includes B<OPENSSL_FULL_VERSION_STR> and the release
+date.
+
+=head2 Functions
+
+OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(),
+OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return
+the values of the macros above for the build of the library, respectively.
+
+OpenSSL_version() returns different strings depending on B<t>:
+
+=over 4
+
+=item OPENSSL_VERSION
+
+The value of B<OPENSSL_VERSION_TEXT>
+
+=item OPENSSL_VERSION_STRING
+
+The value of B<OPENSSL_VERSION_STR>
+
+=item OPENSSL_FULL_VERSION_STRING
+
+The value of B<OPENSSL_FULL_VERSION_STR>
+
+=item OPENSSL_CFLAGS
+
+The compiler flags set for the compilation process in the form
+"compiler: ..." if available or "compiler: information not available"
+otherwise.
+
+=item OPENSSL_BUILT_ON
+
+The date of the build process in the form "built on: ..." if available
+or "built on: date not available" otherwise.
+
+=item OPENSSL_PLATFORM
+
+The "Configure" target of the library build in the form "platform: ..."
+if available or "platform: information not available" otherwise.
+
+=item OPENSSL_DIR
+
+The "OPENSSLDIR" setting of the library build in the form "OPENSSLDIR: "...""
+if available or "OPENSSLDIR: N/A" otherwise.
+
+=item OPENSSL_ENGINES_DIR
+
+The "ENGINESDIR" setting of the library build in the form "ENGINESDIR: "...""
+if available or "ENGINESDIR: N/A" otherwise.
+
+=back
+
+For an unknown B<t>, the text "not available" is returned.
+
+=head1 BACKWARD COMPATIBILITY
+
+For compatibility, some older macros and functions are retained or
+synthesised.
+They are all considered deprecated.
+
+=head2 Macros
+
+B<OPENSSL_VERSION_NUMBER> is a combination of the major, minor and
+patch version into a single integer 0xMNN00PP0L, where:
+
+=over 4
+
+=item M
+
+is the number from B<OPENSSL_VERSION_MAJOR>, in hexadecimal notation
+
+=item NN
+
+is the number from B<OPENSSL_VERSION_MINOR>, in hexadecimal notation
+
+=item PP
+
+is the number from B<OPENSSL_VERSION_PATCH>, in hexadecimal notation
+
+=back
+
+=head2 Functions
+
+OpenSSL_version_num() returns the value of B<OPENSSL_VERSION_NUMBER>.
+
+=head1 RETURN VALUES
+
+OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch()
+return the version number parts as integers.
+
+OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return
+the values of B<OPENSSL_VERSION_PRE_RELEASE> and
+B<OPENSSL_VERSION_BUILD_METADATA> respectively as constant strings.
+For any of them that is undefined, the empty string is returned.
+
+OpenSSL_version() returns constant strings.
+
+=head1 SEE ALSO
+
+L<crypto(7)>
+
+=head1 HISTORY
+
+The macros and functions described here were added to OpenSSL 3.0.0,
+with the exception of the L</BACKWARD COMPATIBILITY> ones.
+
+=head1 COPYRIGHT
+
+Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
+
+Licensed under the OpenSSL license (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/engines/e_padlock.c b/engines/e_padlock.c
index f6b1f16981..4d5df7f26b 100644
--- a/engines/e_padlock.c
+++ b/engines/e_padlock.c
@@ -22,19 +22,6 @@
#ifndef OPENSSL_NO_HW
# ifndef OPENSSL_NO_HW_PADLOCK
-/* Attempt to have a single source for both 0.9.7 and 0.9.8 :-) */
-# if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
-# ifndef OPENSSL_NO_DYNAMIC_ENGINE
-# define DYNAMIC_ENGINE
-# endif
-# elif (OPENSSL_VERSION_NUMBER >= 0x00907000L)
-# ifdef ENGINE_DYNAMIC_SUPPORT
-# define DYNAMIC_ENGINE
-# endif
-# else
-# error "Only OpenSSL >= 0.9.7 is supported"
-# endif
-
/*
* VIA PadLock AES is available *ONLY* on some x86 CPUs. Not only that it
* doesn't exist elsewhere, but it even can't be compiled on other platforms!
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index 889b342ab2..c7b6e47047 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -157,14 +157,16 @@ int OPENSSL_hexchar2int(unsigned char c);
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
-unsigned long OpenSSL_version_num(void);
+DEPRECATEDIN_3(unsigned long OpenSSL_version_num(void))
const char *OpenSSL_version(int type);
-# define OPENSSL_VERSION 0
-# define OPENSSL_CFLAGS 1
-# define OPENSSL_BUILT_ON 2
-# define OPENSSL_PLATFORM 3
-# define OPENSSL_DIR 4
-# define OPENSSL_ENGINES_DIR 5
+# define OPENSSL_VERSION 0
+# define OPENSSL_CFLAGS 1
+# define OPENSSL_BUILT_ON 2
+# define OPENSSL_PLATFORM 3
+# define OPENSSL_DIR 4
+# define OPENSSL_ENGINES_DIR 5
+# define OPENSSL_VERSION_STRING 6
+# define OPENSSL_FULL_VERSION_STRING 7
int OPENSSL_issetugid(void);
diff --git a/include/openssl/opensslconf.h.in b/include/openssl/opensslconf.h.in
index e44fe35bcc..a364bfb1cc 100644
--- a/include/openssl/opensslconf.h.in
+++ b/include/openssl/opensslconf.h.in
@@ -85,13 +85,7 @@ extern "C" {
# define OPENSSL_API_COMPAT OPENSSL_MIN_API
#endif
-/*
- * Do not deprecate things to be deprecated in version 3.0 before the
- * OpenSSL version number matches.
- */
-#if OPENSSL_VERSION_NUMBER < 0x30000000L
-# define DEPRECATEDIN_3(f) f;
-#elif OPENSSL_API_COMPAT < 0x30000000L
+#if OPENSSL_API_COMPAT < 0x30000000L
# define DEPRECATEDIN_3(f) DECLARE_DEPRECATED(f)
#else
# define DEPRECATEDIN_3(f)
diff --git a/include/openssl/opensslv.h b/include/openssl/opensslv.h
index f22601adcd..7634eb14cd 100644
--- a/include/openssl/opensslv.h
+++ b/include/openssl/opensslv.h
@@ -10,92 +10,134 @@
#ifndef HEADER_OPENSSLV_H
# define HEADER_OPENSSLV_H
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C" {
-#endif
-
-/*-
- * Numeric release version identifier:
- * MNNFFPPS: major minor fix patch status
- * The status nibble has one of the values 0 for development, 1 to e for betas
- * 1 to 14, and f for release. The patch level is exactly that.
- * For example:
- * 0.9.3-dev 0x00903000
- * 0.9.3-beta1 0x00903001
- * 0.9.3-beta2-dev 0x00903002
- * 0.9.3-beta2 0x00903002 (same as ...beta2-dev)
- * 0.9.3 0x0090300f
- * 0.9.3a 0x0090301f
- * 0.9.4 0x0090400f
- * 1.2.3z 0x102031af
- *
- * For continuity reasons (becau