[openssl-commits] [openssl] master update
Richard Levitte
levitte at openssl.org
Sat Mar 31 14:40:36 UTC 2018
The branch master has been updated
via efe749c84050b99a8470aa58a6c464cf886cfc00 (commit)
from f91e026e38321d0c154f535ecd5af09e424e7f1b (commit)
- Log -----------------------------------------------------------------
commit efe749c84050b99a8470aa58a6c464cf886cfc00
Author: Richard Levitte <levitte at openssl.org>
Date: Mon Mar 26 11:00:05 2018 +0200
Refuse to run test_cipherlist unless shared library matches build
test/cipherlist_test.c is an internal consistency check, and therefore
requires that the shared library it runs against matches what it was
built for. test/recipes/test_cipherlist.t is made to refuse running
unless library version and build version match.
This adds a helper program test/versions.c, that simply displays the
library and the build version.
Partially fixes #5751
Reviewed-by: Andy Polyakov <appro at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5753)
(cherry picked from commit cde87deafa7486f26bdf954867a6d72ca4ea06e7)
-----------------------------------------------------------------------
Summary of changes:
test/build.info | 5 ++++
test/recipes/80-test_cipherlist.t | 7 +++++-
crypto/include/internal/sha.h => test/versions.c | 19 ++++++++--------
util/perl/OpenSSL/Test.pm | 29 +++++++++++++++++++++++-
4 files changed, 49 insertions(+), 11 deletions(-)
copy crypto/include/internal/sha.h => test/versions.c (51%)
diff --git a/test/build.info b/test/build.info
index f6f36fa..7887813 100644
--- a/test/build.info
+++ b/test/build.info
@@ -24,6 +24,7 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
ENDRAW[descrip.mms]
PROGRAMS_NO_INST=\
+ versions \
aborttest test_test \
sanitytest exdatatest bntest \
ectest ecstresstest ecdsatest gmdifftest pbelutest ideatest \
@@ -52,6 +53,10 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
servername_test ocspapitest rsa_mp_test fatalerrtest tls13ccstest \
sysdefaulttest
+ SOURCE[versions]=versions.c
+ INCLUDE[versions]=../include
+ DEPEND[versions]=../libcrypto
+
SOURCE[aborttest]=aborttest.c
INCLUDE[aborttest]=../include
DEPEND[aborttest]=../libcrypto
diff --git a/test/recipes/80-test_cipherlist.t b/test/recipes/80-test_cipherlist.t
index 98d537e..6e869c8 100644
--- a/test/recipes/80-test_cipherlist.t
+++ b/test/recipes/80-test_cipherlist.t
@@ -12,11 +12,16 @@ use strict;
use warnings;
use OpenSSL::Test::Simple;
-use OpenSSL::Test;
+use OpenSSL::Test qw(:DEFAULT openssl_versions);
use OpenSSL::Test::Utils qw(alldisabled available_protocols);
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;
+
my $no_anytls = alldisabled(available_protocols("tls"));
# If we have no protocols, then we also have no supported ciphers.
diff --git a/crypto/include/internal/sha.h b/test/versions.c
similarity index 51%
copy from crypto/include/internal/sha.h
copy to test/versions.c
index 458a75e..3ab05ec 100644
--- a/crypto/include/internal/sha.h
+++ b/test/versions.c
@@ -1,6 +1,5 @@
/*
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright (c) 2018, Oracle and/or its affiliates. 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
@@ -8,12 +7,14 @@
* https://www.openssl.org/source/license.html
*/
-#ifndef HEADER_INTERNAL_SHA_H
-# define HEADER_INTERNAL_SHA_H
+#include <stdio.h>
+#include <openssl/opensslv.h>
+#include <openssl/crypto.h>
-# include <openssl/opensslconf.h>
-
-int sha512_224_init(SHA512_CTX *);
-int sha512_256_init(SHA512_CTX *);
-
-#endif
+/* 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());
+ return 0;
+}
diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm
index ad77896..f4b1b50 100644
--- a/util/perl/OpenSSL/Test.pm
+++ b/util/perl/OpenSSL/Test.pm
@@ -21,7 +21,8 @@ $VERSION = "0.8";
@EXPORT_OK = (@Test::More::EXPORT_OK, qw(bldtop_dir bldtop_file
srctop_dir srctop_file
data_file
- pipe with cmdstr quotify));
+ pipe with cmdstr quotify
+ openssl_versions));
=head1 NAME
@@ -788,6 +789,32 @@ sub quotify {
return map { $arg_formatter->($_) } @_;
}
+=over 4
+
+=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.
+
+= back
+
+=cut
+
+my @versions = ();
+sub openssl_versions {
+ unless (@versions) {
+ my %lines =
+ map { s/\R$//;
+ /^(.*): (0x[[:xdigit:]]{8})$/;
+ die "Weird line: $_" unless defined $1;
+ $1 => hex($2) }
+ run(test(['versions']), capture => 1);
+ @versions = ( $lines{'Build version'}, $lines{'Library version'} );
+ }
+ return @versions;
+}
+
######################################################################
# private functions. These are never exported.
More information about the openssl-commits
mailing list