All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/3]
@ 2026-05-24  5:15 Jarkko Sakkinen
  2026-05-24  5:15 ` [PATCH v8 1/3] lib/asn1_encoder: Add asn1_encode_integer_bytes() Jarkko Sakkinen
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2026-05-24  5:15 UTC (permalink / raw)
  To: keyrings
  Cc: David Howells, linux-crypto, linux-integrity, David Woodhouse,
	James Bottomley, Stefan Berger, Herbert Xu, Jarkko Sakkinen,
	James Bottomley, Mimi Zohar, Paul Moore, James Morris,
	Serge E. Hallyn, open list:SECURITY SUBSYSTEM, open list

This series introduces key type for operating with asymmetric keys using
a TPM2 chip.

Change Log
==========

v8:
- Reset patch change logs given the overhaul of the code and patches.
- Have only single new subkey type.
- Make key type only use TPM operations.
- Use TPM2_Sign for both ECC and RSA keys.
- Align key descriptions with other key types.

Previous versions
=================

* v7: https://lore.kernel.org/linux-integrity/20240528210823.28798-1-jarkko@kernel.org/
* v6: https://lore.kernel.org/linux-integrity/20240528035136.11464-1-jarkko@kernel.org/
* v5: https://lore.kernel.org/linux-integrity/20240523212515.4875-1-jarkko@kernel.org/
* v4: https://lore.kernel.org/linux-integrity/20240522005252.17841-1-jarkko@kernel.org/
* v3: https://lore.kernel.org/linux-integrity/20240521152659.26438-1-jarkko@kernel.org/
* v2: https://lore.kernel.org/linux-integrity/336755.1716327854@warthog.procyon.org.uk/
* v1: https://lore.kernel.org/linux-integrity/20240520184727.22038-1-jarkko@kernel.org/
* Derived from https://lore.kernel.org/all/20200518172704.29608-1-prestwoj@gmail.com/


Jarkko Sakkinen (3):
  lib/asn1_encoder: Add asn1_encode_integer_bytes()
  crypto: Migrate TPMKey ASN.1 objects from trusted-keys
  keys: asymmetric: tpm2_asymmetric

 crypto/Kconfig                            |    7 +
 crypto/Makefile                           |    6 +
 crypto/asymmetric_keys/Kconfig            |   17 +
 crypto/asymmetric_keys/Makefile           |    1 +
 crypto/asymmetric_keys/tpm2_asymmetric.c  | 1096 +++++++++++++++++++++
 crypto/tpm2_key.asn1                      |   11 +
 crypto/tpm2_key.c                         |  150 +++
 include/crypto/tpm2_key.h                 |   46 +
 include/linux/asn1_encoder.h              |    3 +
 include/linux/tpm.h                       |   10 +
 lib/asn1_encoder.c                        |   62 ++
 security/keys/trusted-keys/Kconfig        |    2 +-
 security/keys/trusted-keys/Makefile       |    2 -
 security/keys/trusted-keys/tpm2key.asn1   |   11 -
 security/keys/trusted-keys/trusted_tpm2.c |  119 +--
 15 files changed, 1421 insertions(+), 122 deletions(-)
 create mode 100644 crypto/asymmetric_keys/tpm2_asymmetric.c
 create mode 100644 crypto/tpm2_key.asn1
 create mode 100644 crypto/tpm2_key.c
 create mode 100644 include/crypto/tpm2_key.h
 delete mode 100644 security/keys/trusted-keys/tpm2key.asn1

-- 
2.47.3


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH] branch: colorize branches checked out in a linked working tree the same way as the current branch is colorized
@ 2018-09-27 15:13 Nickolai Belakovski
  2019-02-19  8:31 ` [PATCH v8 0/3] nbelakovski
  0 siblings, 1 reply; 10+ messages in thread
From: Nickolai Belakovski @ 2018-09-27 15:13 UTC (permalink / raw)
  To: git

In order to more clearly display which branches are active, the output
of git branch is modified to colorize branches checked out in any linked
worktrees with the same color as the current branch.

This is meant to simplify workflows related to worktree, particularly
due to the limitations of not being able to check out the same branch in
two worktrees and the inability to delete a branch checked out in a
worktree. When performing branch operations like checkout and delete, it
would be useful to know more readily if the branches in which the user
is interested are already checked out in a worktree.

The git worktree list command contains the relevant information, however
this is a much less frquently used command than git branch.

Signed-off-by: Nickolai Belakovski <nbelakovski@gmail.com>
---

Notes:
    Travis CI results: https://travis-ci.org/nbelakovski/git/builds/432320949

 builtin/branch.c         | 35 ++++++++++++++++++++++++++++++-----
 t/t3203-branch-output.sh | 21 +++++++++++++++++++++
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 4fc55c350..65b58ff7c 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -334,11 +334,36 @@ static char *build_format(struct ref_filter
*filter, int maxwidth, const char *r
        struct strbuf local = STRBUF_INIT;
        struct strbuf remote = STRBUF_INIT;

-       strbuf_addf(&local, "%%(if)%%(HEAD)%%(then)* %s%%(else)  %s%%(end)",
-                   branch_get_color(BRANCH_COLOR_CURRENT),
-                   branch_get_color(BRANCH_COLOR_LOCAL));
-       strbuf_addf(&remote, "  %s",
-                   branch_get_color(BRANCH_COLOR_REMOTE));
+       // Prepend the current branch of this worktree with "* " and
all other branches with "  "
+       strbuf_addf(&local, "%%(if)%%(HEAD)%%(then)* %%(else)  %%(end)");
+       // Prepend remote branches with two spaces
+       strbuf_addstr(&remote, "  ");
+       if(want_color(branch_use_color)) {
+               // Create a nested if statement to evaluate if the
current ref is equal to a HEAD ref from either
+               // the main or any linked worktrees. If so, color it
CURRENT, otherwise color it LOCAL
+               struct strbuf color = STRBUF_INIT;
+               struct worktree **worktrees = get_worktrees(0);
+               int i;
+               for (i = 0; worktrees[i]; ++i) {
+                       strbuf_addf(&color,
"%%(if:equals=%s)%%(refname)%%(then)%s%%(else)",
+                                   worktrees[i]->head_ref,
+                                   branch_get_color(BRANCH_COLOR_CURRENT));
+               }
+               // add one more check in the nested if-else to cover
the detached HEAD state
+               strbuf_addf(&color, "%%(if)%%(HEAD)%%(then)%s%%(else)%s%%(end)",
+                           branch_get_color(BRANCH_COLOR_CURRENT),
+                           branch_get_color(BRANCH_COLOR_LOCAL));
+               // close up the nested if-else
+               for (; i > 0; --i) {
+                       strbuf_addf(&color, "%%(end)");
+               }
+               free_worktrees(worktrees);
+               strbuf_addbuf(&local, &color);
+               strbuf_release(&color);
+
+               strbuf_addf(&remote, "%s",
+                           branch_get_color(BRANCH_COLOR_REMOTE));
+    }

        if (filter->verbose) {
                struct strbuf obname = STRBUF_INIT;
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index ee6787614..369a156c0 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -240,6 +240,27 @@ test_expect_success 'git branch --format option' '
        test_i18ncmp expect actual
 '

+test_expect_success '"add" a worktree' '
+       mkdir worktree_dir &&
+       git worktree add -b master_worktree worktree_dir master
+'
+
+cat >expect <<'EOF'
+* <GREEN>(HEAD detached from fromtag)<RESET>
+  ambiguous<RESET>
+  branch-one<RESET>
+  branch-two<RESET>
+  master<RESET>
+  <GREEN>master_worktree<RESET>
+  ref-to-branch<RESET> -> branch-one
+  ref-to-remote<RESET> -> origin/branch-one
+EOF
+test_expect_success TTY 'worktree colors correct' '
+       test_terminal git branch >actual.raw &&
+       test_decode_color <actual.raw >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success "set up color tests" '
        echo "<RED>master<RESET>" >expect.color &&
        echo "master" >expect.bare &&

-- 
2.14.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-05-24 23:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-24  5:15 [PATCH v8 0/3] Jarkko Sakkinen
2026-05-24  5:15 ` [PATCH v8 1/3] lib/asn1_encoder: Add asn1_encode_integer_bytes() Jarkko Sakkinen
2026-05-24  5:15 ` [PATCH v8 2/3] crypto: Migrate TPMKey ASN.1 objects from trusted-keys Jarkko Sakkinen
2026-05-24  5:15 ` [PATCH v8 3/3] keys: asymmetric: tpm2_asymmetric Jarkko Sakkinen
2026-05-24  5:20 ` [PATCH v8 0/3] Jarkko Sakkinen
2026-05-24 23:18 ` Jarkko Sakkinen
2026-05-24 23:43 ` Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2018-09-27 15:13 [PATCH] branch: colorize branches checked out in a linked working tree the same way as the current branch is colorized Nickolai Belakovski
2019-02-19  8:31 ` [PATCH v8 0/3] nbelakovski
2019-02-21 12:36   ` Jeff King
2019-03-14  6:10     ` Nickolai Belakovski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.