Last active
February 27, 2024 09:32
-
-
Save pk5ls20/a172ac7d58864b368337b5b414e2c9f2 to your computer and use it in GitHub Desktop.
git-crypt patch that can be compiled normally in Github Action
This file contains hidden or 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
From 08dbdcfed4fb182c0efaacb32a6c46481ced095b Mon Sep 17 00:00:00 2001 | |
From: Andrew Ayer <[email protected]> | |
Date: Tue, 7 Jun 2022 12:34:04 -0400 | |
Subject: [PATCH 1/4] When adding GPG collaborator, include full fingerprint in | |
commit message | |
Short key IDs are bad (https://evil32.com/) | |
Closes: #253 | |
--- | |
commands.cpp | 3 ++- | |
gpg.cpp | 6 ------ | |
gpg.hpp | 1 - | |
3 files changed, 2 insertions(+), 8 deletions(-) | |
diff --git a/commands.cpp b/commands.cpp | |
index 81c401d..6b3c498 100644 | |
--- a/commands.cpp | |
+++ b/commands.cpp | |
@@ -1297,7 +1297,8 @@ int add_gpg_user (int argc, const char** argv) | |
std::ostringstream commit_message_builder; | |
commit_message_builder << "Add " << collab_keys.size() << " git-crypt collaborator" << (collab_keys.size() != 1 ? "s" : "") << "\n\nNew collaborators:\n\n"; | |
for (std::vector<std::pair<std::string, bool> >::const_iterator collab(collab_keys.begin()); collab != collab_keys.end(); ++collab) { | |
- commit_message_builder << '\t' << gpg_shorten_fingerprint(collab->first) << ' ' << gpg_get_uid(collab->first) << '\n'; | |
+ commit_message_builder << " " << collab->first << '\n'; | |
+ commit_message_builder << " " << gpg_get_uid(collab->first) << '\n'; | |
} | |
// git commit -m MESSAGE NEW_FILE ... | |
diff --git a/gpg.cpp b/gpg.cpp | |
index bec5892..901ffaf 100644 | |
--- a/gpg.cpp | |
+++ b/gpg.cpp | |
@@ -61,12 +61,6 @@ static std::string gpg_nth_column (const std::string& line, unsigned int col) | |
line.substr(pos); | |
} | |
-// given a key fingerprint, return the last 8 nibbles | |
-std::string gpg_shorten_fingerprint (const std::string& fingerprint) | |
-{ | |
- return fingerprint.size() == 40 ? fingerprint.substr(32) : fingerprint; | |
-} | |
- | |
// given a key fingerprint, return the key's UID (e.g. "John Smith <[email protected]>") | |
std::string gpg_get_uid (const std::string& fingerprint) | |
{ | |
diff --git a/gpg.hpp b/gpg.hpp | |
index 77997b1..be98aed 100644 | |
--- a/gpg.hpp | |
+++ b/gpg.hpp | |
@@ -41,7 +41,6 @@ struct Gpg_error { | |
explicit Gpg_error (std::string m) : message(m) { } | |
}; | |
-std::string gpg_shorten_fingerprint (const std::string& fingerprint); | |
std::string gpg_get_uid (const std::string& fingerprint); | |
std::vector<std::string> gpg_lookup_key (const std::string& query); | |
std::vector<std::string> gpg_list_secret_keys (); | |
-- | |
2.43.0.windows.1 | |
From dd588772d7e686480d16bb4c1c67cfb8a9299edf Mon Sep 17 00:00:00 2001 | |
From: pk5ls20 <[email protected]> | |
Date: Fri, 23 Feb 2024 19:46:25 +0800 | |
Subject: [PATCH 2/4] Update release-windows.yml | |
--- | |
.github/workflows/release-windows.yml | 5 ++--- | |
1 file changed, 2 insertions(+), 3 deletions(-) | |
diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml | |
index 6794e4a..4f92b45 100644 | |
--- a/.github/workflows/release-windows.yml | |
+++ b/.github/workflows/release-windows.yml | |
@@ -1,6 +1,5 @@ | |
-on: | |
- release: | |
- types: [published] | |
+on: | |
+ workflow_dispatch: | |
name: Build Release Binary (Windows) | |
jobs: | |
build: | |
-- | |
2.43.0.windows.1 | |
From 0f5cae037a2126d935efdee2a301adaf96d69248 Mon Sep 17 00:00:00 2001 | |
From: pk5ls20 <[email protected]> | |
Date: Fri, 23 Feb 2024 19:59:19 +0800 | |
Subject: [PATCH 3/4] Apply patch https://github.com/AGWA/git-crypt/pull/249 | |
--- | |
crypto-openssl-10.cpp | 5 ++--- | |
crypto-openssl-11.cpp | 5 ++--- | |
2 files changed, 4 insertions(+), 6 deletions(-) | |
diff --git a/crypto-openssl-10.cpp b/crypto-openssl-10.cpp | |
index f0f2c53..1623690 100644 | |
--- a/crypto-openssl-10.cpp | |
+++ b/crypto-openssl-10.cpp | |
@@ -28,16 +28,15 @@ | |
* as that of the covered work. | |
*/ | |
-#include <openssl/opensslconf.h> | |
+#include <openssl/hmac.h> | |
-#if !defined(OPENSSL_API_COMPAT) | |
+#if defined(HMAC_cleanup) | |
#include "crypto.hpp" | |
#include "key.hpp" | |
#include "util.hpp" | |
#include <openssl/aes.h> | |
#include <openssl/sha.h> | |
-#include <openssl/hmac.h> | |
#include <openssl/evp.h> | |
#include <openssl/rand.h> | |
#include <openssl/err.h> | |
diff --git a/crypto-openssl-11.cpp b/crypto-openssl-11.cpp | |
index adf03bb..518b90c 100644 | |
--- a/crypto-openssl-11.cpp | |
+++ b/crypto-openssl-11.cpp | |
@@ -28,16 +28,15 @@ | |
* as that of the covered work. | |
*/ | |
-#include <openssl/opensslconf.h> | |
+#include <openssl/hmac.h> | |
-#if defined(OPENSSL_API_COMPAT) | |
+#if !defined(HMAC_cleanup) | |
#include "crypto.hpp" | |
#include "key.hpp" | |
#include "util.hpp" | |
#include <openssl/aes.h> | |
#include <openssl/sha.h> | |
-#include <openssl/hmac.h> | |
#include <openssl/evp.h> | |
#include <openssl/rand.h> | |
#include <openssl/err.h> | |
-- | |
2.43.0.windows.1 | |
From a01995bf134eecbe1e6e5fd8b9cc2ee9fbb0d13c Mon Sep 17 00:00:00 2001 | |
From: pk5ls20 <[email protected]> | |
Date: Fri, 23 Feb 2024 20:04:19 +0800 | |
Subject: [PATCH 4/4] add build flag `-lcrypt32` | |
--- | |
.github/workflows/release-windows.yml | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml | |
index 4f92b45..17d7fba 100644 | |
--- a/.github/workflows/release-windows.yml | |
+++ b/.github/workflows/release-windows.yml | |
@@ -23,7 +23,7 @@ jobs: | |
openssl-devel | |
- name: Build binary | |
shell: msys2 {0} | |
- run: make LDFLAGS="-static-libstdc++ -static -lcrypto -lws2_32" | |
+ run: make LDFLAGS="-static-libstdc++ -static -lcrypto -lws2_32 -lcrypt32" | |
- name: Upload release artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
-- | |
2.43.0.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment