Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sample program demo scripts #2698

Draft
wants to merge 22 commits into
base: development
Choose a base branch
from

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Jun 14, 2019

Kickstart a framework for demo scripts for sample programs. This has two goals: to show how to use the sample programs (for some, it isn't clear what arguments to pass or how to use them in sequence), and to run the programs on the CI.

This pull request is being split into 3 parts:

There is already a demo script programs/psa/key_ladder_demo.sh and this PR adds a second one. I wrote a third one in #2472. This PR also adds instructions to run the demo scripts in a few components of all.sh.

The number of functions used potentially by all demo scripts was growing quickly so I split out some shared functions into a common script programs/demo_common.sh.

Non-goals:

  • Demonstrate every program. Let's do this gradually at our own pace.
  • Run the demo scripts on Windows.

Needs backports: maybe. It would be better, to keep the testing similar across supported branches.

@gilles-peskine-arm gilles-peskine-arm added enhancement mbed TLS team needs-review Every commit must be reviewed by at least two team members, needs-backports Backports are missing or are pending review and approval. component-platform Portability layer and build scripts labels Jun 14, 2019
@gilles-peskine-arm gilles-peskine-arm force-pushed the sample_program_demo_scripts-development branch from c094063 to 5704d27 Compare June 14, 2019 17:57
@gilles-peskine-arm gilles-peskine-arm mentioned this pull request Jun 25, 2019
4 tasks
@gilles-peskine-arm gilles-peskine-arm force-pushed the sample_program_demo_scripts-development branch from bcdc838 to c37aeaa Compare April 22, 2020 19:51
@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-backports Backports are missing or are pending review and approval. needs-review Every commit must be reviewed by at least two team members, labels Apr 22, 2020
@gilles-peskine-arm gilles-peskine-arm force-pushed the sample_program_demo_scripts-development branch from c37aeaa to 4d8fff8 Compare April 22, 2020 21:55
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
The programs are usable as long as the requisite parts of X509 are
included in the build. This can mean ECDSA but no RSA, and it can mean
no bignum if asymmetric cryptography is provided by an alternate
implementation that doesn't use bignum.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm force-pushed the sample_program_demo_scripts-development branch from 4d8fff8 to 037d0b8 Compare April 22, 2020 21:59
@gilles-peskine-arm gilles-peskine-arm force-pushed the sample_program_demo_scripts-development branch from 037d0b8 to e73f07a Compare April 23, 2020 15:51
@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests and removed needs-work labels Apr 23, 2020
run_demos.py is the frontend to a framework for smoke-testing the
sample programs. It runs scripts called programs/*/*_demo.sh
("demo scripts") and check that they succeed. A typical demo script
runs one sample program or a combination of sample programs to
demonstrate their usage.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Show how to create a self-signed certificate.

Show how to create a certificate signing request and create the
corresponding certificate.

Use OpenSSL if available to show the certificate contents, because we
don't have a tool to do that.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Only executable programs should have the execution permission.
If a file has an extension that makes it potentially executable, check
whether it has a shebang line. Only files with a shebang line should
be executable.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
The new file programs/demo_common.sh contains initialization code,
utility functions and cleanup code meant to be used by all demo
scripts written in sh.

Initial features:

* msg: Display a message.
* run, run_bad: Run a command, visibly.
* $root_dir, $programs_dir: location of the mbedtls source tree.
* $files_to_clean: files that are cleaned up on exit.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Demo scripts should declare their build-time dependencies, to make
them more user-friendly. If a dependency is not met, users should see
an explicit message rather than an incomprehensible error.

Don't rely on the dependencies of individual programs because some
demo scripts use multiple programs and because some scripts might have
additional requirements.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@daverodgman daverodgman added this to the October Sprint milestone Sep 2, 2020
This was referenced Nov 24, 2021
@mpg
Copy link
Contributor

mpg commented Jan 14, 2022

Note: when this is revived, programs added in the meantime will need to be included. See for example #5435

@mpg mpg added the historical-reviewing Currently reviewing (for legacy PR/issues) label Jun 24, 2022
@mpg mpg removed this from the October 2020 Sprint milestone Jul 1, 2022
@mpg mpg added needs-adoption stalled PR that someone should pick up and complete historical-reviewed Reviewed & agreed to keep legacy PR/issue and removed historical-reviewing Currently reviewing (for legacy PR/issues) labels Jul 1, 2022
@mpg mpg mentioned this pull request Apr 5, 2023
3 tasks
@tom-daubney-arm
Copy link
Contributor

As part of our review of historical PRs we have made the decision to convert older PRs that have not been updated in 3 months into drafts until they are worked on again.

@tom-daubney-arm tom-daubney-arm marked this pull request as draft May 18, 2023 18:11
@gilles-peskine-arm gilles-peskine-arm removed needs-review Every commit must be reviewed by at least two team members, needs-adoption stalled PR that someone should pick up and complete labels Jul 25, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
component-platform Portability layer and build scripts enhancement historical-reviewed Reviewed & agreed to keep legacy PR/issue needs-work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants