Skip to content

Commit

Permalink
canokey-qemu: fix build on x86_64-darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssais committed May 17, 2024
1 parent 2ab410d commit d3dd025
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkgs/applications/virtualization/qemu/canokey-qemu-memcpy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Submodule canokey-core contains modified content
diff --git i/canokey-core/applets/oath/oath.c w/canokey-core/applets/oath/oath.c
index bd8361a..7ace6c1 100644
--- i/canokey-core/applets/oath/oath.c
+++ w/canokey-core/applets/oath/oath.c
@@ -41,7 +41,7 @@ int oath_install(uint8_t reset) {
static int oath_select(const CAPDU *capdu, RAPDU *rapdu) {
if (P2 != 0x00) EXCEPT(SW_WRONG_P1P2);

- memcpy(RDATA, (uint8_t[]){OATH_TAG_VERSION, 3, 0x05, 0x05, 0x05, OATH_TAG_NAME, HANDLE_LEN}, 7);
+ memcpy(RDATA, (uint8_t[])({OATH_TAG_VERSION, 3, 0x05, 0x05, 0x05, OATH_TAG_NAME, HANDLE_LEN}), 7);
if (read_attr(OATH_FILE, ATTR_HANDLE, RDATA + 7, HANDLE_LEN) < 0) return -1;
LL = 7 + HANDLE_LEN;

4 changes: 4 additions & 0 deletions pkgs/applications/virtualization/qemu/canokey-qemu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ stdenv.mkDerivation rec {
hash = "sha256-4V/2UOgGWgL+tFJO/k90bCDjWSVyIpxw3nYi9NU/OxA=";
};

patches = [
./canokey-qemu-memcpy.patch
];

postPatch = ''
substituteInPlace canokey-core/CMakeLists.txt \
--replace "COMMAND git describe --always --tags --long --abbrev=8 --dirty >>" "COMMAND echo '$rev' >>"
Expand Down

0 comments on commit d3dd025

Please sign in to comment.