Switch to MAJOR.MINOR.PATCH versioning and version 3.0.0-dev
authorRichard Levitte <levitte@openssl.org>
Thu, 27 Sep 2018 13:56:35 +0000 (15:56 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 6 Dec 2018 11:24:47 +0000 (12:24 +0100)
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)

30 files changed:
CHANGES
Configurations/descrip.mms.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
Configure
NEWS
README
VMS/openssl_shutdown.com.in
VMS/openssl_startup.com.in
apps/speed.c
apps/version.c
build.info
crypto/cversion.c
doc/man3/EVP_PKEY_supports_digest_nid.pod
doc/man3/OPENSSL_VERSION_NUMBER.pod [deleted file]
doc/man3/OpenSSL_version.pod [new file with mode: 0644]
engines/e_padlock.c
include/openssl/crypto.h
include/openssl/opensslconf.h.in
include/openssl/opensslv.h
test/recipes/80-test_cipherlist.t
test/recipes/90-test_shlibload.t
test/shlibloadtest.c
test/versions.c
util/libcrypto.num
util/mkdef.pl
util/mkrc.pl
util/perl/OpenSSL/Ordinals.pm
util/perl/OpenSSL/Test.pm
util/private.num

diff --git a/CHANGES b/CHANGES
index c55457509b8b552f611a9cdfbaf66c6ebcabd034..e31b087b4a0f2eff46f4876a2c6a48ad98616ebe 100644 (file)
--- 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
index c6a31c8dd7b6d6ea96b3f007c56a4c94ca911a1d..4215fe92b25eee796021eef503962128cdfd9897 100644 (file)
@@ -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
index ecdd0c147cb295a7a7aca78ec8b1815e3f941310..c0e6d521efc07cd059705cb4935bf3c1124dddda 100644 (file)
@@ -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 -}
index e1426ccf4190f22b81558a2cc31d709b87d6a711..8b3914d7ac3a0151ac1b398cc16473ec4b977d5c 100644 (file)
@@ -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}}) -}
index 65bbec1f312cd4c50eba909dd04b005862487d9c..f9515a945c36647aac11b39ba4639979f1bf25fc 100755 (executable)
--- 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 df16b7894f9a79a9ebf295675e580e7d7b320bb2..7ac249e5f591ec1d5d7f64a36783d975f5521a07 100644 (file)
--- 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 6818807a4cbd1aaa454c7adf005bbc9519ea05a7..fe3f98070c2de4611f397c7e6311bf203b55d8c6 100644 (file)
--- 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
index fd4e3d5086d2c62b4766e3a4173a233f275b3a07..c3b8de8b6d68bc41f469a4cba832c186a9143098 100644 (file)
@@ -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
index 9e6e1c0b35bea0731ced801bd83bf854ea69fa99..a6624eb6983a6508c2a1854eb0a003c9cf82a572 100644 (file)
@@ -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_']
index 833bb9bfe9329ea210d00f5582de0b48b20680b8..08ddad0213adb4e0975c7186d3309d004edab1c0 100644 (file)
@@ -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
index 2aca1636152bb263ba36b978a49ecec8fcf1fa14..515a1076511bf00ddf246f547a4f5e4a5ec4e827 100644 (file)
@@ -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",
index c2ed667afb04af36f24f82922085b41f5de24cbd..afcb772caffb3457fddef4dd3061d9f4aa079313 100644 (file)
@@ -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/;
      "";
 -}
index 534e7eba55b367a3e863fe720e64c1b880215133..16cd241f25ed0744fe117202993fa115cbff87a8 100644 (file)
 
 #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:
index 4f0882c21082dab13ef724bf8dccd4e7c792a13f..48a75f82ded568323572cb2f20dbcb23379aeabd 100644 (file)
@@ -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 (file)
index 55a55c7..0000000
+++ /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 (file)
index 0000000..cf5794a
--- /dev/null
@@ -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
index f6b1f169810e43b5b5b50e8295ce1d508bdf9455..4d5df7f26ba4b2458390eafc54cda638fb7da0f6 100644 (file)
 #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!
index 889b342ab2a36501be6c4806538510ae771c4096..c7b6e47047034fbb5d90ab971946614af143d2bb 100644 (file)
@@ -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);
 
index e44fe35bccac1a56983c3066e3890124b21d4266..a364bfb1ccce0330d99ad7c44f6c3512fa1b663a 100644 (file)
@@ -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)
index f22601adcd3f41178f6cd8b306b107562dd5c26f..7634eb14cd796608bb31410259df3058ab2d4e74 100644 (file)
 #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 (because 0.9.5 is already out, and is coded
- * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level
- * part is slightly different, by setting the highest bit.  This means
- * that 0.9.5a looks like this: 0x0090581f.  At 0.9.6, we can start
- * with 0x0090600S...
- *
- * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.)
- * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
- *  major minor fix final patch/beta)
+# endif
+
+/*
+ * SECTION 1: VERSION DATA.  These will change for each release
  */
-# define OPENSSL_VERSION_NUMBER  0x10102000L
-# define OPENSSL_VERSION_TEXT    "OpenSSL 1.1.2-dev  xx XXX xxxx"
-
-/*-
- * The macros below are to be used for shared library (.so, .dll, ...)
- * versioning.  That kind of versioning works a bit differently between
- * operating systems.  The most usual scheme is to set a major and a minor
- * number, and have the runtime loader check that the major number is equal
- * to what it was at application link time, while the minor number has to
- * be greater or equal to what it was at application link time.  With this
- * scheme, the version number is usually part of the file name, like this:
- *
- *      libcrypto.so.0.9
- *
- * Some unixen also make a softlink with the major version number only:
- *
- *      libcrypto.so.0
- *
- * On Tru64 and IRIX 6.x it works a little bit differently.  There, the
- * shared library version is stored in the file, and is actually a series
- * of versions, separated by colons.  The rightmost version present in the
- * library when linking an application is stored in the application to be
- * matched at run time.  When the application is run, a check is done to
- * see if the library version stored in the application matches any of the
- * versions in the version string of the library itself.
- * This version string can be constructed in any way, depending on what
- * kind of matching is desired.  However, to implement the same scheme as
- * the one used in the other unixen, all compatible versions, from lowest
- * to highest, should be part of the string.  Consecutive builds would
- * give the following versions strings:
- *
- *      3.0
- *      3.0:3.1
- *      3.0:3.1:3.2
- *      4.0
- *      4.0:4.1
+
+/*
+ * Base version macros
  *
- * Notice how version 4 is completely incompatible with version, and
- * therefore give the breach you can see.
+ * These macros express version number MAJOR.MINOR.PATCH exactly
+ */
+# define OPENSSL_VERSION_MAJOR  3
+# define OPENSSL_VERSION_MINOR  0
+# define OPENSSL_VERSION_PATCH  0
+
+/*
+ * Additional version information, defined only when used.
  *
- * There may be other schemes as well that I haven't yet discovered.
+ * These are also part of the new version scheme, but aren't part
+ * of the version number itself.
+ */
+
+/* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */
+# define OPENSSL_VERSION_PRE_RELEASE "-dev"
+/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */
+/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */
+# undef OPENSSL_VERSION_BUILD_METADATA
+
+/*
+ * Note: OPENSSL_VERSION_BUILD_METADATA will never be defined by
+ * the OpenSSL Project, it's entirely reserved for others vendors
+ */
+
+/*
+ * Absolute string versions of OPENSSL_VERSION_PRE_RELEASE and
+ * OPENSSL_VERSION_BUILD_METADATA.  As opposed to those, which
+ * may be undefined, these are guaranteed to have strings as
+ * values.
+ */
+
+# ifdef OPENSSL_VERSION_PRE_RELEASE
+#  define OPENSSL_VERSION_PRE_RELEASE_STR OPENSSL_VERSION_PRE_RELEASE
+# else
+#  define OPENSSL_VERSION_PRE_RELEASE_STR ""
+# endif
+# ifdef OPENSSL_VERSION_BUILD_METADATA
+#  define OPENSSL_VERSION_BUILD_METADATA_STR OPENSSL_VERSION_BUILD_METADATA
+# else
+#  define OPENSSL_VERSION_BUILD_METADATA_STR ""
+# endif
+
+/*
+ * Shared library version
  *
- * So, here's the way it works here: first of all, the library version
- * number doesn't need at all to match the overall OpenSSL version.
- * However, it's nice and more understandable if it actually does.
- * The current library version is stored in the macro SHLIB_VERSION_NUMBER,
- * which is just a piece of text in the format "M.m.e" (Major, minor, edit).
- * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways,
- * we need to keep a history of version numbers, which is done in the
- * macro SHLIB_VERSION_HISTORY.  The numbers are separated by colons and
- * should only keep the versions that are binary compatible with the current.
+ * This is strictly to express ABI version, which may or may not
+ * be related to the API version expressed with the macros above.
+ * This is defined in free form.
+ */
+# define OPENSSL_SHLIB_VERSION 3
+
+/*
+ * SECTION 2: USEFUL MACROS AND FUNCTIONS
+ */
+
+/* For checking general API compatibility when preprocessing */
+# 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
+ * with the values from the corresponding OPENSSL_VERSION_ macros) and the
+ * 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
+
+/*
+ * SECTION 3: ADDITIONAL METADATA
+ */
+# define OPENSSL_RELEASE_DATE "xx XXX xxxx"
+# define OPENSSL_VERSION_TEXT                                           \
+    "OpenSSL " OPENSSL_FULL_VERSION_STR " " OPENSSL_RELEASE_DATE
+
+/*
+ * SECTION 3: BACKWARD COMPATIBILITY
  */
-# define SHLIB_VERSION_HISTORY ""
-# define SHLIB_VERSION_NUMBER "1.1"
+# include <openssl/opensslconf.h>
 
+# if !OPENSSL_API_4
+/* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */
+#  ifdef OPENSSL_VERSION_PRE_RELEASE
+#   define _OPENSSL_VERSION_PRE_RELEASE 0x0
+#  else
+#   define _OPENSSL_VERSION_PRE_RELEASE 0xf
+#  endif
+#  define OPENSSL_VERSION_NUMBER        \
+    (long)( (OPENSSL_VERSION_MAJOR<<28)  \
+            |(OPENSSL_VERSION_MINOR<<20) \
+            |(OPENSSL_VERSION_PATCH<<4)  \
+            |_OPENSSL_VERSION_PRE_RELEASE )
+# endif
 
-#ifdef  __cplusplus
+# ifdef  __cplusplus
 }
-#endif
+# endif
 #endif                          /* HEADER_OPENSSLV_H */
index 5c1b1d45457f800f0ba107126b8f1ed6a23a18ca..bf6abc7739f772aedc482e612ec04c9e1ad4ce62 100644 (file)
@@ -20,7 +20,7 @@ setup("test_cipherlist");
 my ($build_version, $library_version) = openssl_versions();
 plan skip_all =>
     "This test recipe isn't supported when doing regression testing"
-    if $build_version != $library_version;
+    if $build_version ne $library_version;
 
 my $no_anytls = alldisabled(available_protocols("tls"));
 
index 2761d58502ba764b3e1e912628b4c5d7a13eadea..82800a7814f6bc332eb0f0db55f35393630e65e5 100644 (file)
@@ -46,7 +46,6 @@ sub shlib {
     $lib = $unified_info{sharednames}->{$lib}
         . ($target{shlib_variant} || "")
         . ($target{shared_extension} || ".so");
-    $lib =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
-             |.$config{shlib_version_number}|x;
+    $lib =~ s|\.\$\(SHLIB_VERSION_NUMBER\)|.$config{shlib_version}|;
     return $lib;
 }
index 53714aa12591602272f6715bc13964b7440389d3..417fbfd6c0b7c794dddc80e7c75b3e697218c514 100644 (file)
@@ -22,7 +22,9 @@ typedef const SSL_METHOD * (*TLS_method_t)(void);
 typedef SSL_CTX * (*SSL_CTX_new_t)(const SSL_METHOD *meth);
 typedef void (*SSL_CTX_free_t)(SSL_CTX *);
 typedef unsigned long (*ERR_get_error_t)(void);
-typedef unsigned long (*OpenSSL_version_num_t)(void);
+typedef unsigned long (*OPENSSL_version_major_t)(void);
+typedef unsigned long (*OPENSSL_version_minor_t)(void);
+typedef unsigned long (*OPENSSL_version_patch_t)(void);
 typedef DSO * (*DSO_dsobyaddr_t)(void (*addr)(void), int flags);
 typedef int (*DSO_free_t)(DSO *dso);
 
@@ -107,12 +109,14 @@ static int test_lib(void)
     union {
         void (*func)(void);
         SHLIB_SYM sym;
-    } symbols[3];
+    } symbols[4];
     TLS_method_t myTLS_method;
     SSL_CTX_new_t mySSL_CTX_new;
     SSL_CTX_free_t mySSL_CTX_free;
     ERR_get_error_t myERR_get_error;
-    OpenSSL_version_num_t myOpenSSL_version_num;
+    OPENSSL_version_major_t myOPENSSL_version_major;
+    OPENSSL_version_minor_t myOPENSSL_version_minor;
+    OPENSSL_version_patch_t myOPENSSL_version_patch;
     int result = 0;
 
     switch (test_type) {
@@ -150,26 +154,27 @@ static int test_lib(void)
     }
 
     if (!TEST_true(shlib_sym(cryptolib, "ERR_get_error", &symbols[0].sym))
-            || !TEST_true(shlib_sym(cryptolib, "OpenSSL_version_num",
-                                    &symbols[1].sym)))
+           || !TEST_true(shlib_sym(cryptolib, "OPENSSL_version_major",
+                                   &symbols[1].sym))
+           || !TEST_true(shlib_sym(cryptolib, "OPENSSL_version_minor",
+                                   &symbols[2].sym))
+           || !TEST_true(shlib_sym(cryptolib, "OPENSSL_version_patch",
+                                   &symbols[3].sym)))
         goto end;
     myERR_get_error = (ERR_get_error_t)symbols[0].func;
     if (!TEST_int_eq(myERR_get_error(), 0))
         goto end;
 
-    /*
-     * The bits that COMPATIBILITY_MASK lets through MUST be the same in
-     * the library and in the application.
-     * The bits that are masked away MUST be a larger or equal number in
-     * the library compared to the application.
-     */
-# define COMPATIBILITY_MASK 0xfff00000L
-    myOpenSSL_version_num = (OpenSSL_version_num_t)symbols[1].func;
-    if (!TEST_int_eq(myOpenSSL_version_num() & COMPATIBILITY_MASK,
-                     OPENSSL_VERSION_NUMBER & COMPATIBILITY_MASK))
+    /* Make sure the libraries are a compatible version */
+    myOPENSSL_version_major = (OPENSSL_version_major_t)symbols[1].func;
+    myOPENSSL_version_minor = (OPENSSL_version_minor_t)symbols[2].func;
+    myOPENSSL_version_patch = (OPENSSL_version_patch_t)symbols[3].func;
+    if (!TEST_int_eq(myOPENSSL_version_major(), OPENSSL_VERSION_MAJOR))
         goto end;
-    if (!TEST_int_ge(myOpenSSL_version_num() & ~COMPATIBILITY_MASK,
-                     OPENSSL_VERSION_NUMBER & ~COMPATIBILITY_MASK))
+    if (!TEST_int_ge(myOPENSSL_version_minor(), OPENSSL_VERSION_MINOR))
+        goto end;
+    if (myOPENSSL_version_minor() == OPENSSL_VERSION_MINOR
+        && !TEST_int_ge(myOPENSSL_version_patch(), OPENSSL_VERSION_PATCH))
         goto end;
 
     if (test_type == DSO_REFTEST) {
index 3ab05ec35d5d38f6a5abc8970ca423cf29225014..309670937a6436c05b163d2af493ea88d8fa8fad 100644 (file)
@@ -14,7 +14,8 @@
 /* A simple helper for the perl function OpenSSL::Test::openssl_versions */
 int main(void)
 {
-    printf("Build version: 0x%08lX\n", OPENSSL_VERSION_NUMBER);
-    printf("Library version: 0x%08lX\n", OpenSSL_version_num());
+    printf("Build version: %s\n", OPENSSL_FULL_VERSION_STR);
+    printf("Library version: %s\n",
+           OpenSSL_version(OPENSSL_FULL_VERSION_STRING));
     return 0;
 }
index 85a15a04807a6840fa3f04deb6e3af463c415bf4..964f5816677f8b1c4fc6f66891e3164c334cf4c4 100644 (file)
@@ -3263,7 +3263,7 @@ CMS_RecipientInfo_get0_pkey_ctx         3215      1_1_0   EXIST::FUNCTION:CMS
 OCSP_REQINFO_free                       3216   1_1_0   EXIST::FUNCTION:OCSP
 AUTHORITY_KEYID_new                     3217   1_1_0   EXIST::FUNCTION:
 i2d_DIST_POINT_NAME                     3218   1_1_0   EXIST::FUNCTION:
-OpenSSL_version_num                     3219   1_1_0   EXIST::FUNCTION:
+OpenSSL_version_num                     3219   1_1_0   EXIST::FUNCTION:DEPRECATEDIN_3
 OCSP_CERTID_free                        3220   1_1_0   EXIST::FUNCTION:OCSP
 BIO_hex_string                          3221   1_1_0   EXIST::FUNCTION:
 X509_REQ_sign_ctx                       3222   1_1_0   EXIST::FUNCTION:
@@ -4577,29 +4577,34 @@ OCSP_resp_get0_respdata                 4530    1_1_0j  EXIST::FUNCTION:OCSP
 EVP_MD_CTX_set_pkey_ctx                 4531   1_1_1   EXIST::FUNCTION:
 EVP_PKEY_meth_set_digest_custom         4532   1_1_1   EXIST::FUNCTION:
 EVP_PKEY_meth_get_digest_custom         4533   1_1_1   EXIST::FUNCTION:
-EVP_MAC_CTX_new                         4534   1_1_2   EXIST::FUNCTION:
-EVP_MAC_CTX_new_id                      4535   1_1_2   EXIST::FUNCTION:
-EVP_MAC_CTX_free                        4536   1_1_2   EXIST::FUNCTION:
-EVP_MAC_CTX_copy                        4537   1_1_2   EXIST::FUNCTION:
-EVP_MAC_CTX_mac                         4538   1_1_2   EXIST::FUNCTION:
-EVP_MAC_size                            4539   1_1_2   EXIST::FUNCTION:
-EVP_MAC_init                            4540   1_1_2   EXIST::FUNCTION:
-EVP_MAC_update                          4541   1_1_2   EXIST::FUNCTION:
-EVP_MAC_final                           4542   1_1_2   EXIST::FUNCTION:
-EVP_MAC_ctrl                            4543   1_1_2   EXIST::FUNCTION:
-EVP_MAC_vctrl                           4544   1_1_2   EXIST::FUNCTION:
-EVP_MAC_ctrl_str                        4545   1_1_2   EXIST::FUNCTION:
-EVP_MAC_str2ctrl                        4546   1_1_2   EXIST::FUNCTION:
-EVP_MAC_hex2ctrl                        4547   1_1_2   EXIST::FUNCTION:
-EVP_MAC_nid                             4548   1_1_2   EXIST::FUNCTION:
-EVP_get_macbyname                       4549   1_1_2   EXIST::FUNCTION:
-EVP_MAC_do_all                          4550   1_1_2   EXIST::FUNCTION:
-EVP_MAC_do_all_sorted                   4551   1_1_2   EXIST::FUNCTION:
-EVP_str2ctrl                            4552   1_1_2   EXIST::FUNCTION:
-EVP_hex2ctrl                            4553   1_1_2   EXIST::FUNCTION:
-EVP_PKEY_supports_digest_nid            4554   1_1_2   EXIST::FUNCTION:
-SRP_VBASE_add0_user                     4555   1_1_2   EXIST::FUNCTION:SRP
-SRP_user_pwd_new                        4556   1_1_2   EXIST::FUNCTION:SRP
-SRP_user_pwd_set_gN                     4557   1_1_2   EXIST::FUNCTION:SRP
-SRP_user_pwd_set1_ids                   4558   1_1_2   EXIST::FUNCTION:SRP
-SRP_user_pwd_set0_sv                    4559   1_1_2   EXIST::FUNCTION:SRP
+EVP_MAC_CTX_new                         4534   3_0_0   EXIST::FUNCTION:
+EVP_MAC_CTX_new_id                      4535   3_0_0   EXIST::FUNCTION:
+EVP_MAC_CTX_free                        4536   3_0_0   EXIST::FUNCTION:
+EVP_MAC_CTX_copy                        4537   3_0_0   EXIST::FUNCTION:
+EVP_MAC_CTX_mac                         4538   3_0_0   EXIST::FUNCTION:
+EVP_MAC_size                            4539   3_0_0   EXIST::FUNCTION:
+EVP_MAC_init                            4540   3_0_0   EXIST::FUNCTION:
+EVP_MAC_update                          4541   3_0_0   EXIST::FUNCTION:
+EVP_MAC_final                           4542   3_0_0   EXIST::FUNCTION:
+EVP_MAC_ctrl                            4543   3_0_0   EXIST::FUNCTION:
+EVP_MAC_vctrl                           4544   3_0_0   EXIST::FUNCTION:
+EVP_MAC_ctrl_str                        4545   3_0_0   EXIST::FUNCTION:
+EVP_MAC_str2ctrl                        4546   3_0_0   EXIST::FUNCTION:
+EVP_MAC_hex2ctrl                        4547   3_0_0   EXIST::FUNCTION:
+EVP_MAC_nid                             4548   3_0_0   EXIST::FUNCTION:
+EVP_get_macbyname                       4549   3_0_0   EXIST::FUNCTION:
+EVP_MAC_do_all                          4550   3_0_0   EXIST::FUNCTION:
+EVP_MAC_do_all_sorted                   4551   3_0_0   EXIST::FUNCTION:
+EVP_str2ctrl                            4552   3_0_0   EXIST::FUNCTION:
+EVP_hex2ctrl                            4553   3_0_0   EXIST::FUNCTION:
+EVP_PKEY_supports_digest_nid            4554   3_0_0   EXIST::FUNCTION:
+SRP_VBASE_add0_user                     4555   3_0_0   EXIST::FUNCTION:SRP
+SRP_user_pwd_new                        4556   3_0_0   EXIST::FUNCTION:SRP
+SRP_user_pwd_set_gN                     4557   3_0_0   EXIST::FUNCTION:SRP
+SRP_user_pwd_set1_ids                   4558   3_0_0   EXIST::FUNCTION:SRP
+SRP_user_pwd_set0_sv                    4559   3_0_0   EXIST::FUNCTION:SRP
+OPENSSL_version_major                   4560   3_0_0   EXIST::FUNCTION:
+OPENSSL_version_minor                   4561   3_0_0   EXIST::FUNCTION:
+OPENSSL_version_patch                   4562   3_0_0   EXIST::FUNCTION:
+OPENSSL_version_pre_release             4563   3_0_0   EXIST::FUNCTION:
+OPENSSL_version_build_metadata          4564   3_0_0   EXIST::FUNCTION:
index 9cb1147d289871653573301954fc2f4e8040e3c2..eac4f50a1770e22ba009d170a6aaaa60038c2ff4 100755 (executable)
@@ -386,19 +386,9 @@ _____
 _____
 
     if (defined $version) {
-        my ($libvmajor, $libvminor, $libvedit, $libvpatch) =
-            $version =~ /^(\d+)_(\d+)_(\d+)([a-z]{0,2})(?:-.*)?$/;
-        my $libvpatchnum = 0;
-        for (split '', $libvpatch // '') {
-            $libvpatchnum += ord(lc($_)) - 96;
-            # To compensate because the letter 'z' is always followed by
-            # another, i.e. doesn't add any value on its own
-            $libvpatchnum-- if lc($_) eq 'z';
-        }
-        my $match1 = $libvmajor * 100 + $libvminor;
-        my $match2 = $libvedit * 100 + $libvpatchnum;
+        my ($libvmajor, $libvminor) = $version =~ /^(\d+)_(\d+)$/;
         print <<"_____";
-GSMATCH=LEQUAL,$match1,$match2
+GSMATCH=LEQUAL,$libvmajor,$libvminor;
 _____
     }
 }
index 6762bc4a5698e085a099c4518381e37e2ba21632..16b1ab48bfdb08020b80e87649fe25f33b36fcc0 100755 (executable)
@@ -10,33 +10,9 @@ use strict;
 use warnings;
 use lib ".";
 use configdata;
-use File::Spec::Functions;
 
-my $versionfile = catfile( $config{sourcedir}, "include/openssl/opensslv.h" );
-
-my ( $ver, $v1, $v2, $v3, $v4, $beta, $version );
-
-open FD, $versionfile or die "Couldn't open include/openssl/opensslv.h: $!\n";
-while (<FD>) {
-    if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) {
-        $ver     = hex($1);
-        $v1      = ( $ver >> 28 );
-        $v2      = ( $ver >> 20 ) & 0xff;
-        $v3      = ( $ver >> 12 ) & 0xff;
-        $v4      = ( $ver >>  4 ) & 0xff;
-        $beta    = $ver & 0xf;
-        $version = "$v1.$v2.$v3";
-        if ( $beta == 0xf ) {
-            $version .= chr( ord('a') + $v4 - 1 ) if ($v4);
-        } elsif ( $beta == 0 ) {
-            $version .= "-dev";
-        } else {
-            $version .= "-beta$beta";
-        }
-        last;
-    }
-}
-close(FD);
+my $cversion = "$config{major},$config{minor},$config{patch}";
+my $version = "$config{major}.$config{minor}.$config{patch}$config{prerelease}$config{build_metadata}";
 
 my $filename = $ARGV[0];
 my $description = "OpenSSL library";
@@ -53,8 +29,8 @@ print <<___;
 LANGUAGE 0x09,0x01
 
 1 VERSIONINFO
-  FILEVERSION $v1,$v2,$v3,$v4
-  PRODUCTVERSION $v1,$v2,$v3,$v4
+  FILEVERSION $cversion
+  PRODUCTVERSION $cversion
   FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
   FILEFLAGS 0x01L
index 07bdf8122c7cf1f68c798002a81e5419892cbbf4..928e383f9ef96525bf09c89916917749c630b60f 100644 (file)
@@ -638,7 +638,7 @@ STRING must conform to the following EBNF description:
   space          = " " | "\t";
   symbol         = ( letter | "_"), { letter | digit | "_" };
   ordinal        = number;
-  version        = number, "_", number, "_", number, letter, [ letter ];
+  version        = number, "_", number, "_", number, [ letter, [ letter ] ];
   exist          = "EXIST" | "NOEXIST";
   platforms      = platform, { ",", platform };
   platform       = ( letter | "_" ) { letter | digit | "_" };
@@ -678,7 +678,7 @@ sub new {
             unless ( scalar @a == 4
                      && $a[0] =~ /^[A-Za-z_][A-Za-z_0-9]*$/
                      && $a[1] =~ /^\d+$/
-                     && $a[2] =~ /^(?:\*|\d+_\d+_\d+(?:[a-z]{0,2}))$/
+                     && $a[2] =~ /^(?:\*|\d+_\d+_\d+[a-z]{0,2})$/
                      && $a[3] =~ /^
                                   (?:NO)?EXIST:
                                   [^:]*:
@@ -841,6 +841,8 @@ OpenSSL::Ordinals::Item objects.
 =cut
 
 sub by_version {
+    # Until we're rid of everything with the old version scheme,
+    # we need to be able to handle older style x.y.zl versions.
     sub _ossl_versionsplit {
         my $textversion = shift;
         return $textversion if $textversion eq '*';
@@ -891,7 +893,7 @@ sub f_version {
 
     $version =~ s|\.|_|g if $version;
     croak "No version specified"
-        unless $version && $version =~ /^\d_\d_\d[a-z]{0,2}$/;
+        unless $version && $version =~ /^\d+_\d+_\d+[a-z]{0,2}$/;
 
     return sub { $_[0]->version() eq $version };
 }
index 9564b26046b997803af32750a1ae4a96cfcfb924..a9436e6da4c251216e167c528dea2be893ded422 100644 (file)
@@ -810,9 +810,9 @@ sub quotify {
 
 =item B<openssl_versions>
 
-Returns a list of two numbers, the first representing the build version,
-the second representing the library version.  See opensslv.h for more
-information on those numbers.
+Returns a list of two version numbers, the first representing the build
+version, the second representing the library version.  See opensslv.h for
+more information on those numbers.
 
 =back
 
@@ -823,9 +823,8 @@ sub openssl_versions {
     unless (@versions) {
         my %lines =
             map { s/\R$//;
-                  /^(.*): (0x[[:xdigit:]]{8})$/;
-                  die "Weird line: $_" unless defined $1;
-                  $1 => hex($2) }
+                  /^(.*): (.*)$/;
+                  $1 => $2 }
             run(test(['versions']), capture => 1);
         @versions = ( $lines{'Build version'}, $lines{'Library version'} );
     }
index d6724ed5f357a13e6aad27b53f208b49d4dc070f..8e89f1f3999670dbe8c0ac918edec3d4f2ffde98 100644 (file)
@@ -282,7 +282,14 @@ EVP_rc5_32_12_16_cfb                    define
 EVP_seed_cfb                            define
 EVP_sm4_cfb                             define
 OBJ_cleanup                             define deprecated 1.1.0
-OPENSSL_VERSION_NUMBER                  define
+OPENSSL_VERSION_MAJOR                   define
+OPENSSL_VERSION_MINOR                   define
+OPENSSL_VERSION_NUMBER                  define deprecated 3.0.0
+OPENSSL_VERSION_PATCH                   define
+OPENSSL_VERSION_PRE_RELEASE             define
+OPENSSL_VERSION_BUILD_METADATA          define
+OPENSSL_VERSION_PRE_RELEASE_STR         define
+OPENSSL_VERSION_BUILD_METADATA_STR      define
 OPENSSL_VERSION_TEXT                    define
 OPENSSL_clear_free                      define
 OPENSSL_clear_realloc                   define