From 3a63dbef15b62b121c5df8762f8cb915fb06b27a Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 27 Sep 2018 15:56:35 +0200 Subject: [PATCH] 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 Reviewed-by: Matthias St. Pierre Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/7724) --- CHANGES | 14 +- Configurations/descrip.mms.tmpl | 7 +- Configurations/unix-Makefile.tmpl | 7 +- Configurations/windows-makefile.tmpl | 4 +- Configure | 40 +++-- NEWS | 4 +- README | 2 +- VMS/openssl_shutdown.com.in | 2 +- VMS/openssl_startup.com.in | 2 +- apps/speed.c | 4 +- apps/version.c | 3 +- build.info | 11 +- crypto/cversion.c | 31 ++++ doc/man3/EVP_PKEY_supports_digest_nid.pod | 2 +- doc/man3/OPENSSL_VERSION_NUMBER.pod | 113 ------------ doc/man3/OpenSSL_version.pod | 191 +++++++++++++++++++++ engines/e_padlock.c | 13 -- include/openssl/crypto.h | 16 +- include/openssl/opensslconf.h.in | 8 +- include/openssl/opensslv.h | 200 +++++++++++++--------- test/recipes/80-test_cipherlist.t | 2 +- test/recipes/90-test_shlibload.t | 3 +- test/shlibloadtest.c | 39 +++-- test/versions.c | 5 +- util/libcrypto.num | 59 ++++--- util/mkdef.pl | 14 +- util/mkrc.pl | 32 +--- util/perl/OpenSSL/Ordinals.pm | 8 +- util/perl/OpenSSL/Test.pm | 11 +- util/private.num | 9 +- 30 files changed, 493 insertions(+), 363 deletions(-) delete mode 100644 doc/man3/OPENSSL_VERSION_NUMBER.pod create mode 100644 doc/man3/OpenSSL_version.pod 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, =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 - #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL - #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx" - - #include - - 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 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: - -=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, 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 - -=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. - -=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 + + #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 + + 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, B and +B represent the three parts of a 3 numbered version +number, MAJOR.MINOR.PATCH. + +The macro B 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 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 is a convenience macro to get the short version +number string, "MAJOR.MINOR.PATCH". + +B is a convenience macro to get the longer +version number string, which combines B, +B and B. + +B is a convenience macro to get a full descriptive +version text, which includes B 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: + +=over 4 + +=item OPENSSL_VERSION + +The value of B + +=item OPENSSL_VERSION_STRING + +The value of B + +=item OPENSSL_FULL_VERSION_STRING + +The value of B + +=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, 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 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, in hexadecimal notation + +=item NN + +is the number from B, in hexadecimal notation + +=item PP + +is the number from B, in hexadecimal notation + +=back + +=head2 Functions + +OpenSSL_version_num() returns the value of B. + +=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 and +B 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 + +=head1 HISTORY + +The macros and functions described here were added to OpenSSL 3.0.0, +with the exception of the L 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. + +=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 (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 +# 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 */ diff --git a/test/recipes/80-test_cipherlist.t b/test/recipes/80-test_cipherlist.t index 5c1b1d4545..bf6abc7739 100644 --- a/test/recipes/80-test_cipherlist.t +++ b/test/recipes/80-test_cipherlist.t @@ -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")); diff --git a/test/recipes/90-test_shlibload.t b/test/recipes/90-test_shlibload.t index 2761d58502..82800a7814 100644 --- a/test/recipes/90-test_shlibload.t +++ b/test/recipes/90-test_shlibload.t @@ -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; } diff --git a/test/shlibloadtest.c b/test/shlibloadtest.c index 53714aa125..417fbfd6c0 100644 --- a/test/shlibloadtest.c +++ b/test/shlibloadtest.c @@ -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) { diff --git a/test/versions.c b/test/versions.c index 3ab05ec35d..309670937a 100644 --- a/test/versions.c +++ b/test/versions.c @@ -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; } diff --git a/util/libcrypto.num b/util/libcrypto.num index 85a15a0480..964f581667 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -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: diff --git a/util/mkdef.pl b/util/mkdef.pl index 9cb1147d28..eac4f50a17 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -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; _____ } } diff --git a/util/mkrc.pl b/util/mkrc.pl index 6762bc4a56..16b1ab48bf 100755 --- a/util/mkrc.pl +++ b/util/mkrc.pl @@ -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 () { - 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 diff --git a/util/perl/OpenSSL/Ordinals.pm b/util/perl/OpenSSL/Ordinals.pm index 07bdf8122c..928e383f9e 100644 --- a/util/perl/OpenSSL/Ordinals.pm +++ b/util/perl/OpenSSL/Ordinals.pm @@ -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 }; } diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm index 9564b26046..a9436e6da4 100644 --- a/util/perl/OpenSSL/Test.pm +++ b/util/perl/OpenSSL/Test.pm @@ -810,9 +810,9 @@ sub quotify { =item B -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'} ); } diff --git a/util/private.num b/util/private.num index d6724ed5f3..8e89f1f399 100644 --- a/util/private.num +++ b/util/private.num @@ -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 -- 2.25.1