Skip to content

Commit 2138adf

Browse files
authored
truecrack: fix build on gcc-14 (#380703)
2 parents 5c59ad6 + 9aefcbb commit 2138adf

File tree

2 files changed

+60
-14
lines changed

2 files changed

+60
-14
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/src/Common/CpuCore.c
2+
+++ b/src/Common/CpuCore.c
3+
@@ -96,7 +96,7 @@
4+
derive_key_whirlpool ( word, wordlength+1, salt, PKCS5_SALT_SIZE, 1000, headerKey, cpu_GetMaxPkcs5OutSize ());
5+
else{
6+
perror("Key derivation function not supported");
7+
- return;
8+
+ return 0;
9+
}
10+
11+
value=cpu_Xts(encryptionAlgorithm,encryptedHeader,headerKey,cpu_GetMaxPkcs5OutSize(), masterKey, &length);

pkgs/by-name/tr/truecrack/package.nix

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
config,
77
cudaSupport ? config.cudaSupport,
88
pkg-config,
9+
versionCheckHook,
910
}:
1011

1112
gccStdenv.mkDerivation rec {
@@ -15,10 +16,14 @@ gccStdenv.mkDerivation rec {
1516
src = fetchFromGitLab {
1617
owner = "kalilinux";
1718
repo = "packages/truecrack";
18-
rev = "debian/${version}+git20150326-0kali1";
19-
sha256 = "+Rw9SfaQtO1AJO6UVVDMCo8DT0dYEbv7zX8SI+pHCRQ=";
19+
tag = "kali/${version}+git20150326-0kali4";
20+
hash = "sha256-d6ld6KHSqYM4RymHf5qcm2AWK6FHWC0rFaLRfIQ2m5Q=";
2021
};
2122

23+
patches = [
24+
./fix-empty-return.patch
25+
];
26+
2227
configureFlags = (
2328
if cudaSupport then
2429
[
@@ -38,24 +43,54 @@ gccStdenv.mkDerivation rec {
3843
cudatoolkit
3944
];
4045

41-
# Workaround build failure on -fno-common toolchains like upstream
42-
# gcc-10. Otherwise build fails as:
43-
# ld: CpuAes.o:/build/source/src/Crypto/CpuAes.h:1233: multiple definition of
44-
# `t_rc'; CpuCore.o:/build/source/src/Crypto/CpuAes.h:1237: first defined here
45-
# TODO: remove on upstream fixes it:
46-
# https://gitlab.com/kalilinux/packages/truecrack/-/issues/1
47-
env.NIX_CFLAGS_COMPILE = "-fcommon";
46+
env.NIX_CFLAGS_COMPILE = toString ([
47+
# Workaround build failure on -fno-common toolchains like upstream
48+
# gcc-10. Otherwise build fails as:
49+
# ld: CpuAes.o:/build/source/src/Crypto/CpuAes.h:1233: multiple definition of
50+
# `t_rc'; CpuCore.o:/build/source/src/Crypto/CpuAes.h:1237: first defined here
51+
# TODO: remove on upstream fixes it:
52+
# https://gitlab.com/kalilinux/packages/truecrack/-/issues/1
53+
"-fcommon"
54+
# Function are declared after they are used in the file, this is error since gcc-14.
55+
# Common/Crypto.c:42:13: error: implicit declaration of function 'cpu_CipherInit'; did you mean 'CipherInit'? []
56+
# https://gitlab.com/kalilinux/packages/truecrack/-/commit/5b0e3a96b747013bded7b33f65bb42be2dbafc86
57+
"-Wno-error=implicit-function-declaration"
58+
]);
4859

49-
installFlags = [ "prefix=$(out)" ];
5060
enableParallelBuilding = true;
5161

52-
meta = with lib; {
62+
installFlags = [ "prefix=$(out)" ];
63+
64+
doInstallCheck = true;
65+
66+
installCheckPhase = ''
67+
runHook preInstallCheck
68+
69+
echo "Cracking test volumes"
70+
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -w test/passwords.txt | grep -aF "Found password"
71+
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -c test/tes -m 4 | grep -aF "Found password"
72+
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -w test/passwords.txt | grep -aF "Found password"
73+
$out/bin/${meta.mainProgram} -t test/whirlpool_aes.test.tc -w test/passwords.txt -k whirlpool | grep -aF "Found password"
74+
$out/bin/${meta.mainProgram} -t test/sha512_aes.test.tc -w test/passwords.txt -k sha512 | grep -aF "Found password"
75+
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -w test/passwords.txt | grep -aF "Found password"
76+
$out/bin/${meta.mainProgram} -t test/ripemd160_serpent.test.tc -w test/passwords.txt -e serpent | grep -aF "Found password"
77+
$out/bin/${meta.mainProgram} -t test/ripemd160_twofish.test.tc -w test/passwords.txt -e twofish | grep -aF "Found password"
78+
echo "Finished cracking test volumes"
79+
80+
runHook postInstallCheck
81+
'';
82+
83+
nativeInstallCheckInputs = [
84+
versionCheckHook
85+
];
86+
87+
meta = {
5388
description = "Brute-force password cracker for TrueCrypt volumes, optimized for Nvidia Cuda technology";
5489
mainProgram = "truecrack";
5590
homepage = "https://gitlab.com/kalilinux/packages/truecrack";
5691
broken = cudaSupport;
57-
license = licenses.gpl3Plus;
58-
platforms = platforms.unix;
59-
maintainers = with maintainers; [ ethancedwards8 ];
92+
license = lib.licenses.gpl3Plus;
93+
platforms = lib.platforms.unix;
94+
maintainers = with lib.maintainers; [ ethancedwards8 ];
6095
};
6196
}

0 commit comments

Comments
 (0)