Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement ed255519 using openssl too #2922

Merged
merged 4 commits into from
Jul 7, 2023

Conversation

alexlarsson
Copy link
Member

This adds an openssl-based implementation to ostree-sign-ed25519.c which is used if libsodium was not manually configured.

The target usedcase for this is: #2921

@alexlarsson
Copy link
Member Author

Ah, it seems to fail if build with --with-crypto=glib. Will look at it.

@alexlarsson
Copy link
Member Author

The debian testing build is failing with:

2023-07-06T16:08:14.3477143Z ERROR: tests/test-composefs.sh - missing test plan
2023-07-06T16:08:14.3477941Z ERROR: tests/test-composefs.sh - exited with status 1

I wonder what this is about. I didn't really change that...

@alexlarsson alexlarsson force-pushed the openssl-ed25519 branch 3 times, most recently from 1c73a4d to 4fb976c Compare July 6, 2023 17:06
@alexlarsson
Copy link
Member Author

Ok, got everything working. But I don't understand how the composefs test worked before?

@cgwalters
Copy link
Member

But I don't understand how the composefs test worked before?

Yeah I must have broken it a bit ago and it's not a gating test. Mind splitting out that fix as a separate distinct PR?

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, awesome! My biggest question here is: Are the signatures from libsodium and openssl interoperable?

Ah wait this is triggering a dim memory...yes, from git grep --author=walters --grep=signature, I found 40d6f6b and if indeed that test is passing, I think we're good!

src/libostree/ostree-sign-ed25519.c Outdated Show resolved Hide resolved
@alexlarsson
Copy link
Member Author

OK, awesome! My biggest question here is: Are the signatures from libsodium and openssl interoperable?

Yes, I tried it both ways.

@alexlarsson
Copy link
Member Author

And, yes:
PASS: tests/test-pre-signed-pull.sh 1 pre-signed pull

@cgwalters
Copy link
Member

OK nice work here, I think let's get #2923 in and then rebase this on top and merge. (Alternatively you could drop the overlapping fixes from the composefs fix from this PR, because that test isn't currently gating, but eh)

src/libostree/ostree-sign-ed25519.c Outdated Show resolved Hide resolved
src/libostree/ostree-sign-ed25519.c Outdated Show resolved Hide resolved
@alexlarsson
Copy link
Member Author

Feel free to rebase this when #2923 lands, should work then.

This adds some defines for ed25519 key sizes and drops uses
of the libsodium defines for these, as well as replacing sodium_bin2hex
use with ot_bin2hex. Some code that wes optionally built before are now
always built.

The goal for this is to support both libsodium and openssl.

Also fixes return value of _load_pk_from_stream(). It used
to always return FALSE.
libsodium is used if configured to keep the old behaviour, but if
it is not enabled, and openssl is used, then ed25519 is now supported.
@alexlarsson
Copy link
Member Author

/usr/bin/ld: ./.libs/libotutil.a(libotutil_la-ot-checksum-utils.o): undefined reference to symbol 'EVP_DigestInit_ex@@OPENSSL_3.0.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libcrypto.so.3: error adding symbols: DSO missing from command line

Wth? This build in previous CI runs...

The checksum utils uses the crypto lib, but we're not explicitly linking
to it. I think this is why the CI got this error when using openssl
on debian, during ostree binary linking:

/usr/bin/ld: ./.libs/libotutil.a(libotutil_la-ot-checksum-utils.o): undefined reference to symbol 'EVP_DigestInit_ex@@OPENSSL_3.0.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libcrypto.so.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
@cgwalters cgwalters enabled auto-merge July 7, 2023 18:49
@cgwalters cgwalters merged commit a6d9c71 into ostreedev:main Jul 7, 2023
21 checks passed
@cgwalters
Copy link
Member

BTW nice work here!

alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Jul 11, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Jul 11, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Jul 11, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Jul 11, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Aug 16, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Nov 13, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Nov 13, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Nov 13, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to alexlarsson/osbuild that referenced this pull request Nov 13, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
alexlarsson added a commit to osbuild/osbuild that referenced this pull request Nov 14, 2023
This form of signatures has been (build-time-optionally) supported
since ostree 2020.4 as an alternative to the old gpg signatures. With
the current work on composefs[1] they are becomming more important, as
they will allow verification of the commit (and thus the composefs
image) during boot, giving us a full trusted boot chain all the way
into the ostree userspace.

Note: `ostree sign` used to require libsodium and was thus disabled in
e.g. the Fedora build of ostree. However, recently[2] it is also supported
with openssl, which will let it be more widely used.

[1] ostreedev/ostree#2921
[2] ostreedev/ostree#2922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants