-
Notifications
You must be signed in to change notification settings - Fork 305
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
sign: Support x509 signature type #3278
Open
ueno
wants to merge
6
commits into
ostreedev:main
Choose a base branch
from
ueno:wip/dueno/pkcs8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
334e0b0
sign: Fix typo in error messages and comments
ueno 62e5452
sign: Use explicit_bzero to clear secret key material
ueno ef44e33
sign: Factor out logic to read key blobs
ueno 0fa1061
sign: Add PEM reading facility
ueno 5583563
tests: Use tap_ok/tap_end in test-signed-commit.sh
ueno e83eda0
sign: Support spki signature type
ueno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (C) 2024 Red Hat, Inc. | ||
* | ||
* SPDX-License-Identifier: LGPL-2.0+ | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "config.h" | ||
|
||
#include "ostree-blob-reader-base64.h" | ||
|
||
struct _OstreeBlobReaderBase64 | ||
{ | ||
GDataInputStream parent_instance; | ||
}; | ||
|
||
static void ostree_blob_reader_base64_iface_init (OstreeBlobReaderInterface *iface); | ||
|
||
G_DEFINE_TYPE_WITH_CODE (OstreeBlobReaderBase64, _ostree_blob_reader_base64, | ||
G_TYPE_DATA_INPUT_STREAM, | ||
G_IMPLEMENT_INTERFACE (OSTREE_TYPE_BLOB_READER, | ||
ostree_blob_reader_base64_iface_init)); | ||
|
||
static void | ||
ostree_blob_reader_base64_iface_init (OstreeBlobReaderInterface *iface) | ||
{ | ||
iface->read_blob = ostree_blob_reader_base64_read_blob; | ||
} | ||
|
||
static void | ||
_ostree_blob_reader_base64_class_init (OstreeBlobReaderBase64Class *klass) | ||
{ | ||
} | ||
|
||
static void | ||
_ostree_blob_reader_base64_init (OstreeBlobReaderBase64 *self) | ||
{ | ||
} | ||
|
||
OstreeBlobReaderBase64 * | ||
_ostree_blob_reader_base64_new (GInputStream *stream) | ||
{ | ||
return g_object_new (OSTREE_TYPE_BLOB_READER_BASE64, "base-stream", stream, NULL); | ||
} | ||
|
||
GBytes * | ||
ostree_blob_reader_base64_read_blob (OstreeBlobReader *self, GCancellable *cancellable, | ||
GError **error) | ||
{ | ||
gsize len = 0; | ||
g_autoptr (GError) local_error = NULL; | ||
g_autofree char *line | ||
= g_data_input_stream_read_line (G_DATA_INPUT_STREAM (self), &len, cancellable, &local_error); | ||
if (local_error != NULL) | ||
{ | ||
g_propagate_error (error, g_steal_pointer (&local_error)); | ||
return NULL; | ||
} | ||
|
||
if (line == NULL) | ||
return NULL; | ||
|
||
gsize n_elements; | ||
g_base64_decode_inplace (line, &n_elements); | ||
explicit_bzero (line + n_elements, len - n_elements); | ||
|
||
return g_bytes_new_take (g_steal_pointer (&line), n_elements); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2024 Red Hat, Inc. | ||
* | ||
* SPDX-License-Identifier: LGPL-2.0+ | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ostree-blob-reader.h" | ||
|
||
G_BEGIN_DECLS | ||
|
||
#define OSTREE_TYPE_BLOB_READER_BASE64 (_ostree_blob_reader_base64_get_type ()) | ||
|
||
_OSTREE_PUBLIC | ||
G_DECLARE_FINAL_TYPE (OstreeBlobReaderBase64, _ostree_blob_reader_base64, OSTREE, | ||
BLOB_READER_BASE64, GDataInputStream); | ||
|
||
_OSTREE_PUBLIC | ||
OstreeBlobReaderBase64 *_ostree_blob_reader_base64_new (GInputStream *stream); | ||
|
||
_OSTREE_PUBLIC | ||
GBytes *ostree_blob_reader_base64_read_blob (OstreeBlobReader *self, GCancellable *cancellable, | ||
GError **error); | ||
|
||
G_END_DECLS |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worthy of the same comment you have in a similar place
/* Don't leak the trailing encoded bytes */
later in the code (maybe also worthy of a shared helper function?).But also...I don't fully grasp the threat model here...aren't the decoded bytes equally sensitive? In what cases would the trailing data in the malloc buffer be somehow accessible when the full buffer wouldn't?
Don't get me wrong, not arguing against it, but I would just like to understand a little bit more.