johntheripper: fix issue #130

This commit is contained in:
blshkv 2016-12-07 23:07:13 +08:00
parent b6fa17a90c
commit 72035f4dc5
No known key found for this signature in database
GPG key ID: 9CCF6FCB8D8A14BF
2 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,15 @@
diff --git a/src/truecrypt_fmt_plug.c b/src/truecrypt_fmt_plug.c
index 1c95c39..8cef85e 100644
--- src/truecrypt_fmt_plug.c
+++ src/truecrypt_fmt_plug.c
@@ -310,8 +310,8 @@ static int crypt_all(int *pcount, struct db_salt *salt)
pbkdf2_sha512_sse((const unsigned char **)pin, lens, psalt->salt, 64, psalt->num_iterations, &(x.poutc), sizeof(key), 0);
}
#else
- if (is_sha512)
- pbkdf2_sha512((const unsigned char*)key_buffer[i], strlen(key_buffer[i]), psalt->salt, 64, num_iterations, key, sizeof(key), 0);
+ if (psalt->hash_type == IS_SHA512)
+ pbkdf2_sha512((const unsigned char*)key_buffer[i], strlen((char*)key_buffer[i]), psalt->salt, 64, psalt->num_iterations, key, sizeof(key), 0);
#endif
else if (psalt->hash_type == IS_RIPEMD160)
pbkdf2_ripemd160(key_buffer[i], strlen((char*)(key_buffer[i])), psalt->salt, 64, psalt->num_iterations, key, sizeof(key), 0);

View file

@ -0,0 +1,158 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
inherit cuda flag-o-matic toolchain-funcs pax-utils
MY_PN="john"
MY_P="${MY_PN}-${PV}"
JUMBO="jumbo-1"
DESCRIPTION="fast password cracker"
HOMEPAGE="http://www.openwall.com/john/"
SRC_URI="minimal? ( http://www.openwall.com/john/j/${MY_P}.tar.gz )
!minimal? ( http://www.openwall.com/john/j/${MY_P}-${JUMBO}.tar.gz )"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="commoncrypto cuda custom-cflags kerberos -minimal mpi opencl openmp +openssl pcap rexgen wow"
REQUIRED_USE="openmp? ( !minimal )
mpi? ( !minimal )
cuda? ( !minimal )
opencl? ( !minimal )
^^ ( openssl commoncrypto )"
DEPEND="!minimal? ( >=dev-libs/openssl-1.0.1:0 )
mpi? ( virtual/mpi )
cuda? ( x11-drivers/nvidia-drivers
dev-util/nvidia-cuda-toolkit:= )
opencl? ( virtual/opencl )
kerberos? ( virtual/krb5 )
wow? ( dev-libs/gmp:* )
pcap? ( net-libs/libpcap )
dev-libs/gmp
sys-libs/zlib
app-arch/bzip2"
# commoncrypto? ( )
# rexgen? ( )
RDEPEND="${DEPEND}"
S="${WORKDIR}"
pkg_setup() {
if use openmp && [[ ${MERGE_TYPE} != binary ]]; then
tc-has-openmp || die "Please switch to an openmp compatible compiler"
fi
}
src_prepare() {
if use cuda; then
cd "${MY_P}-${JUMBO}/src" || die
cuda_src_prepare
fi
if use minimal; then
cd "${MY_P}" || die
else
cd "${MY_P}-${JUMBO}" || die
fi
epatch ${FILESDIR}/480e95b0e449863be3e1a5b0bc634a67df28b618.patch
}
src_configure() {
if use minimal; then
cd "${MY_P}/src" || die
else
cd "${MY_P}-${JUMBO}/src" || die
fi
use custom-cflags || strip-flags
# John ignores CPPFLAGS, use CFLAGS instead
append-cflags -DJOHN_SYSTEMWIDE=1
append-cflags -DJOHN_SYSTEMWIDE_HOME="'\"${EPREFIX}/etc/john\"'"
NVIDIA_CUDA="${EPREFIX}/opt/cuda/" econf \
--disable-native-macro \
--disable-native-tests \
$(use_enable cuda) \
$(use_enable mpi) \
$(use_enable opencl) \
$(use_enable openmp) \
$(use_enable pcap) \
$(use_enable rexgen) \
$(use_with commoncrypto) \
$(use_with openssl)
}
src_compile() {
if use minimal; then
cd "${MY_P}" || die
else
cd "${MY_P}-${JUMBO}" || die
fi
use custom-cflags || strip-flags
# John ignores CPPFLAGS, use CFLAGS instead
append-cflags -DJOHN_SYSTEMWIDE=1
append-cflags -DJOHN_SYSTEMWIDE_HOME="'\"${EPREFIX}/etc/john\"'"
emake -C src
}
src_test() {
if use minimal; then
cd "${MY_P}" || die
else
cd "${MY_P}-${JUMBO}" || die
fi
pax-mark -mr run/john
if use opencl || use cuda; then
ewarn "GPU tests fail, skipping all tests..."
else
make -C src check
fi
}
src_install() {
if use minimal; then
cd "${MY_P}" || die
else
cd "${MY_P}-${JUMBO}" || die
fi
# executables
dosbin run/john
newsbin run/mailer john-mailer
pax-mark -mr "${ED}usr/sbin/john" || die
if ! use minimal; then
# grep '$(LN)' Makefile.in | head -n-3 | tail -n+2 | cut -d' ' -f3 | cut -d/ -f3
for s in \
unshadow unafs undrop unique ssh2john putty2john pfx2john keepass2john keyring2john \
zip2john gpg2john rar2john racf2john keychain2john kwallet2john pwsafe2john dmg2john \
hccap2john base64conv truecrypt_volume2john keystore2john
do
dosym john /usr/sbin/$s
done
insinto /usr/share/john
doins run/*.py
if use opencl; then
insinto /usr/share/john/kernels
doins run/kernels/*
fi
fi
# config files
insinto /etc/john
doins run/*.chr run/password.lst
doins run/*.conf
# documentation
dodoc doc/*
}