truecrack: fix build on gcc-14 (#380703)

This commit is contained in:
Pavol Rusnak
2025-02-14 12:02:40 +01:00
committed by GitHub
2 changed files with 60 additions and 14 deletions
@@ -0,0 +1,11 @@
--- a/src/Common/CpuCore.c
+++ b/src/Common/CpuCore.c
@@ -96,7 +96,7 @@
derive_key_whirlpool ( word, wordlength+1, salt, PKCS5_SALT_SIZE, 1000, headerKey, cpu_GetMaxPkcs5OutSize ());
else{
perror("Key derivation function not supported");
- return;
+ return 0;
}
value=cpu_Xts(encryptionAlgorithm,encryptedHeader,headerKey,cpu_GetMaxPkcs5OutSize(), masterKey, &length);
+49 -14
View File
@@ -6,6 +6,7 @@
config,
cudaSupport ? config.cudaSupport,
pkg-config,
versionCheckHook,
}:
gccStdenv.mkDerivation rec {
@@ -15,10 +16,14 @@ gccStdenv.mkDerivation rec {
src = fetchFromGitLab {
owner = "kalilinux";
repo = "packages/truecrack";
rev = "debian/${version}+git20150326-0kali1";
sha256 = "+Rw9SfaQtO1AJO6UVVDMCo8DT0dYEbv7zX8SI+pHCRQ=";
tag = "kali/${version}+git20150326-0kali4";
hash = "sha256-d6ld6KHSqYM4RymHf5qcm2AWK6FHWC0rFaLRfIQ2m5Q=";
};
patches = [
./fix-empty-return.patch
];
configureFlags = (
if cudaSupport then
[
@@ -38,24 +43,54 @@ gccStdenv.mkDerivation rec {
cudatoolkit
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: CpuAes.o:/build/source/src/Crypto/CpuAes.h:1233: multiple definition of
# `t_rc'; CpuCore.o:/build/source/src/Crypto/CpuAes.h:1237: first defined here
# TODO: remove on upstream fixes it:
# https://gitlab.com/kalilinux/packages/truecrack/-/issues/1
env.NIX_CFLAGS_COMPILE = "-fcommon";
env.NIX_CFLAGS_COMPILE = toString ([
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: CpuAes.o:/build/source/src/Crypto/CpuAes.h:1233: multiple definition of
# `t_rc'; CpuCore.o:/build/source/src/Crypto/CpuAes.h:1237: first defined here
# TODO: remove on upstream fixes it:
# https://gitlab.com/kalilinux/packages/truecrack/-/issues/1
"-fcommon"
# Function are declared after they are used in the file, this is error since gcc-14.
# Common/Crypto.c:42:13: error: implicit declaration of function 'cpu_CipherInit'; did you mean 'CipherInit'? []
# https://gitlab.com/kalilinux/packages/truecrack/-/commit/5b0e3a96b747013bded7b33f65bb42be2dbafc86
"-Wno-error=implicit-function-declaration"
]);
installFlags = [ "prefix=$(out)" ];
enableParallelBuilding = true;
meta = with lib; {
installFlags = [ "prefix=$(out)" ];
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
echo "Cracking test volumes"
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -w test/passwords.txt | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -c test/tes -m 4 | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -w test/passwords.txt | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/whirlpool_aes.test.tc -w test/passwords.txt -k whirlpool | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/sha512_aes.test.tc -w test/passwords.txt -k sha512 | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/ripemd160_aes.test.tc -w test/passwords.txt | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/ripemd160_serpent.test.tc -w test/passwords.txt -e serpent | grep -aF "Found password"
$out/bin/${meta.mainProgram} -t test/ripemd160_twofish.test.tc -w test/passwords.txt -e twofish | grep -aF "Found password"
echo "Finished cracking test volumes"
runHook postInstallCheck
'';
nativeInstallCheckInputs = [
versionCheckHook
];
meta = {
description = "Brute-force password cracker for TrueCrypt volumes, optimized for Nvidia Cuda technology";
mainProgram = "truecrack";
homepage = "https://gitlab.com/kalilinux/packages/truecrack";
broken = cudaSupport;
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ ethancedwards8 ];
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ ethancedwards8 ];
};
}