From 0ca0851a01251b960ba19d958978004168f58593 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 26 Feb 2019 17:04:25 +0300 Subject: Add implementation --- openssl/tests/.gitignore | 4 +++ openssl/tests/build/.gitignore | 3 ++ openssl/tests/build/bootstrap.build | 9 ++++++ openssl/tests/build/root.build | 16 ++++++++++ openssl/tests/buildfile | 5 +++ openssl/tests/rsa.testscript | 61 +++++++++++++++++++++++++++++++++++++ openssl/tests/version.testscript | 14 +++++++++ 7 files changed, 112 insertions(+) create mode 100644 openssl/tests/.gitignore create mode 100644 openssl/tests/build/.gitignore create mode 100644 openssl/tests/build/bootstrap.build create mode 100644 openssl/tests/build/root.build create mode 100644 openssl/tests/buildfile create mode 100644 openssl/tests/rsa.testscript create mode 100644 openssl/tests/version.testscript (limited to 'openssl/tests') diff --git a/openssl/tests/.gitignore b/openssl/tests/.gitignore new file mode 100644 index 0000000..ce6eed8 --- /dev/null +++ b/openssl/tests/.gitignore @@ -0,0 +1,4 @@ +# Testscript output directories (can be symlinks). +# +test +test-* diff --git a/openssl/tests/build/.gitignore b/openssl/tests/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/openssl/tests/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/openssl/tests/build/bootstrap.build b/openssl/tests/build/bootstrap.build new file mode 100644 index 0000000..dd525c0 --- /dev/null +++ b/openssl/tests/build/bootstrap.build @@ -0,0 +1,9 @@ +# file : tests/build/bootstrap.build +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : OpenSSL and SSLeay Licenses; see accompanying LICENSE file + +project = # Unnamed tests subproject. + +using config +using test +using dist diff --git a/openssl/tests/build/root.build b/openssl/tests/build/root.build new file mode 100644 index 0000000..d593d3d --- /dev/null +++ b/openssl/tests/build/root.build @@ -0,0 +1,16 @@ +# file : tests/build/root.build +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : OpenSSL and SSLeay Licenses; see accompanying LICENSE file + +# We need to configure C module to obtain the target information (see below). +# +using c + +# Setup the openssl program that we are testing. +# +import openssl = openssl%exe{openssl} +testscript{*}: test = $openssl + +# Specify the test target for cross-testing. +# +test.target = $c.target diff --git a/openssl/tests/buildfile b/openssl/tests/buildfile new file mode 100644 index 0000000..63882e6 --- /dev/null +++ b/openssl/tests/buildfile @@ -0,0 +1,5 @@ +# file : tests/buildfile +# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd +# license : OpenSSL and SSLeay Licenses; see accompanying LICENSE file + +./: testscript{*} $openssl diff --git a/openssl/tests/rsa.testscript b/openssl/tests/rsa.testscript new file mode 100644 index 0000000..47f17cb --- /dev/null +++ b/openssl/tests/rsa.testscript @@ -0,0 +1,61 @@ +# file : tests/rsa.testscript +# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd +# license : OpenSSL and SSLeay Licenses; see accompanying LICENSE file + ++cat <=openssl.cnf +repository = build2.org +company = Code Synthesis +email = info@build2.org + +[ req ] + +distinguished_name = req_distinguished_name +x509_extensions = v3_req +prompt = no +utf8 = yes + +[ req_distinguished_name ] + +O = $company +CN = name:$repository + +[ v3_req ] + +keyUsage = critical,digitalSignature +extendedKeyUsage = critical,codeSigning +subjectAltName = email:$email +EOI + ++$* genrsa 4096 >=key.pem 2>>~%EOO% + %Generating RSA private key, 4096 bit long modulus.*% + %.* + EOO + ++cat key.pem >>~%EOO% + -----BEGIN RSA PRIVATE KEY----- + %.{1,64}%.+ + -----END RSA PRIVATE KEY----- + EOO + ++$* req -x509 -new -key key.pem -days 1825 -config openssl.cnf >=cert.pem + ++cat cert.pem >>~%EOO% + -----BEGIN CERTIFICATE----- + %.{1,64}%.+ + -----END CERTIFICATE----- + EOO + +: cert-fingerprint +: +{ + $* x509 -sha256 -noout -fingerprint <<<../cert.pem >>~%EOO% + %SHA256 Fingerprint=([[:xdigit:]]{2}:){31}[[:xdigit:]]{2}% + EOO +} + +: sign-verify +: +{ + $* rsautl -sign -inkey ../key.pem <'test' | \ + $* rsautl -verify -certin -inkey ../cert.pem >'test' +} diff --git a/openssl/tests/version.testscript b/openssl/tests/version.testscript new file mode 100644 index 0000000..bc14c50 --- /dev/null +++ b/openssl/tests/version.testscript @@ -0,0 +1,14 @@ +# file : tests/version.testscript +# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd +# license : OpenSSL and SSLeay Licenses; see accompanying LICENSE file + +$* version -a >>~"%EOO%" + OpenSSL 1.1.1a 20 Nov 2018 + %built on: .+ UTC% + %platform: $c.target.class-$c.target.cpu% + %options: .+% + %compiler: $c.class .*-DLIBCRYPTO_BUILD.*% + %OPENSSLDIR: ".+"% + %ENGINESDIR: ".+"% + %Seeding source: .+% + EOO -- cgit v1.1