Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

cryptography: safely vendor and port modern libraries #32

Closed
Shamar opened this issue Nov 26, 2015 · 2 comments
Closed

cryptography: safely vendor and port modern libraries #32

Shamar opened this issue Nov 26, 2015 · 2 comments

Comments

@Shamar
Copy link

Shamar commented Nov 26, 2015

Given we want to replace libsec, we need a modern well established crypto library that will replace it.
Since it's required by the kernel (random number generation, devtls and so on), it's going to be part of our core system.

Thus we need

  1. to native port it, with the long term goal of contributing the port to the upstream community
    • to native port its dependencies, with the long term goal of contributing the port the respective upstream communities
    • to keep control on the version we use, avoiding to automatically include the "latest" version
  2. to minimize our impact on code that we do not really understand
  3. to be able to add our own regression tests
  4. to be able to run all tests provided by the upstream libraries that apply to Harvey

All this should be achieved

  1. preserving reproducible builds and our ability to use git bisect
  2. adopting a trust-less semi automatic and verifiable process during the updates of the library, to prevent
    • the introduction of security flaws in the imported sources (that could pass unnoticed during a large update to a new upstream version)
    • any delay of critical security updates that could advantage an attacker
    • the introduction of security flaws in the port scripts (that could pass unnoticed during a large update to a new upstream version)

To this aim we decided to code a set of Go utilities that can automatically vendor a source archive according to directives described in a json file (from download to checksum, including a final git commit with a standardized message) and automatically verify that the code imported matches the one contained in the archive declared in the json,
This tool would prevent the first obvious threat described above and will reduce the risk of the second, as it is pointless to discuss an automated commit that builds, passes the regression tests and pass the source verification: the only check that remains to reviewers (on this regard) is to ensure that the URI of the archive prescribed in the json and its digests actually match the intended one.

To address the third possible threat in an (almost) trust-less fashion, we need to be able to easily review the port scripts when the are updated. This unfortunately precludes the use of patch files because they are sensible to many small non-semantic changes that can occur during a version update and that, all together, can hide to a human reviewer a single semantic change (think for example to the removal of a single null check hidden in a large patch-set addressing whitespace changes, #include replacements and so on).

For this reason we are going to use dedicated easy to read scripts for every single transformations that the sources will require: for example during a review it is much easier to ensure that a remove-stdio-include.sed script behaves correctly, than the same transformation spread in dozen of patch files (or in one patch targeting multiple files).

In the long term, when Harvey will be a mainstream OS supported like any other by the upstream developers, the vendor tool and its automatic checker will be still useful for updates: we will only need to remove the porting scripts from the build,json.

Shamar added a commit to Shamar/harvey that referenced this issue Dec 1, 2015
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
Shamar added a commit that referenced this issue Dec 1, 2015
…see #32

Introduced util/continuous-build.sh to simplify .travis.yml in the process.

Change-Id: Idbbc453abd35e21599141b8e9e4bcc3274cbf67f
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
Shamar added a commit that referenced this issue Dec 8, 2015
The zlib.h header has been polished and installed in /sys/include/

Building /sys/src/libz will install:

	/$ARCH/lib/libz.a
	/$ARCH/bin/regress/libz/example

regress/libz/example	PASS
			it creates a valid foo.gz in the current folder
			and verify its contents.

In /sys/src/libz/patch you can find the sed scripts used during the port.
In /sys/src/libz/harvey you can find the files that will be actually compiled.
The whole process is idempotent.

Change-Id: I5bb635a68fc1aa4a773fd7bdb29df3538dcee552
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
Shamar added a commit that referenced this issue Dec 9, 2015
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
@elbing elbing mentioned this issue May 19, 2016
@louy2
Copy link

louy2 commented May 19, 2016

A todo list of the libraries in need of porting may serve a better issue. Like so:

  • zlib
  • liblts

Source:

- [ ] zlib
- [ ] liblts

@rminnich
Copy link
Contributor

rminnich commented Mar 3, 2017

no longer needed.

@rminnich rminnich closed this as completed Mar 3, 2017
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
…see Harvey-OS#32

Introduced util/continuous-build.sh to simplify .travis.yml in the process.

Change-Id: Idbbc453abd35e21599141b8e9e4bcc3274cbf67f
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
The zlib.h header has been polished and installed in /sys/include/

Building /sys/src/libz will install:

	/$ARCH/lib/libz.a
	/$ARCH/bin/regress/libz/example

regress/libz/example	PASS
			it creates a valid foo.gz in the current folder
			and verify its contents.

In /sys/src/libz/patch you can find the sed scripts used during the port.
In /sys/src/libz/harvey you can find the files that will be actually compiled.
The whole process is idempotent.

Change-Id: I5bb635a68fc1aa4a773fd7bdb29df3538dcee552
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
…see Harvey-OS#32

Introduced util/continuous-build.sh to simplify .travis.yml in the process.

Change-Id: Idbbc453abd35e21599141b8e9e4bcc3274cbf67f
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
The zlib.h header has been polished and installed in /sys/include/

Building /sys/src/libz will install:

	/$ARCH/lib/libz.a
	/$ARCH/bin/regress/libz/example

regress/libz/example	PASS
			it creates a valid foo.gz in the current folder
			and verify its contents.

In /sys/src/libz/patch you can find the sed scripts used during the port.
In /sys/src/libz/harvey you can find the files that will be actually compiled.
The whole process is idempotent.

Change-Id: I5bb635a68fc1aa4a773fd7bdb29df3538dcee552
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
…see Harvey-OS#32

Introduced util/continuous-build.sh to simplify .travis.yml in the process.

Change-Id: Idbbc453abd35e21599141b8e9e4bcc3274cbf67f
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
The zlib.h header has been polished and installed in /sys/include/

Building /sys/src/libz will install:

	/$ARCH/lib/libz.a
	/$ARCH/bin/regress/libz/example

regress/libz/example	PASS
			it creates a valid foo.gz in the current folder
			and verify its contents.

In /sys/src/libz/patch you can find the sed scripts used during the port.
In /sys/src/libz/harvey you can find the files that will be actually compiled.
The whole process is idempotent.

Change-Id: I5bb635a68fc1aa4a773fd7bdb29df3538dcee552
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jan 5, 2018
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
sevki pushed a commit to sevki/harvey that referenced this issue Jan 6, 2018
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
sevki pushed a commit to sevki/harvey that referenced this issue Jan 6, 2018
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
…see Harvey-OS#32

Introduced util/continuous-build.sh to simplify .travis.yml in the process.

Change-Id: Idbbc453abd35e21599141b8e9e4bcc3274cbf67f
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
The zlib.h header has been polished and installed in /sys/include/

Building /sys/src/libz will install:

	/$ARCH/lib/libz.a
	/$ARCH/bin/regress/libz/example

regress/libz/example	PASS
			it creates a valid foo.gz in the current folder
			and verify its contents.

In /sys/src/libz/patch you can find the sed scripts used during the port.
In /sys/src/libz/harvey you can find the files that will be actually compiled.
The whole process is idempotent.

Change-Id: I5bb635a68fc1aa4a773fd7bdb29df3538dcee552
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
Change-Id: I13596b1f5d01575efba4346474d0965ab4480aee
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
…see Harvey-OS#32

Introduced util/continuous-build.sh to simplify .travis.yml in the process.

Change-Id: Idbbc453abd35e21599141b8e9e4bcc3274cbf67f
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
The zlib.h header has been polished and installed in /sys/include/

Building /sys/src/libz will install:

	/$ARCH/lib/libz.a
	/$ARCH/bin/regress/libz/example

regress/libz/example	PASS
			it creates a valid foo.gz in the current folder
			and verify its contents.

In /sys/src/libz/patch you can find the sed scripts used during the port.
In /sys/src/libz/harvey you can find the files that will be actually compiled.
The whole process is idempotent.

Change-Id: I5bb635a68fc1aa4a773fd7bdb29df3538dcee552
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jan 8, 2018
git does not preserve write permissions: if we remove them we loose repeatable builds.

Change-Id: Ic7e9497ad123fe28c82df0466b16a5de5a6842f9
Signed-off-by: Giacomo Tesio <giacomo@tesio.it>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jul 24, 2021
Signed-off-by: Fazlul Shahriar <fshahriar@gmail.com>
rminnich pushed a commit to rminnich/harvey that referenced this issue Jul 24, 2021
Signed-off-by: Fazlul Shahriar <fshahriar@gmail.com>
floren pushed a commit that referenced this issue Jul 24, 2021
Signed-off-by: Fazlul Shahriar <fshahriar@gmail.com>
rminnich added a commit that referenced this issue Jul 25, 2021
rminnich added a commit that referenced this issue Jul 25, 2021
This reverts commit d19ad6b.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
gmacd pushed a commit to gmacd/harvey that referenced this issue Jul 26, 2021
Signed-off-by: Fazlul Shahriar <fshahriar@gmail.com>
gmacd pushed a commit to gmacd/harvey that referenced this issue Aug 4, 2021
Signed-off-by: Fazlul Shahriar <fshahriar@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants