Skip to content

Commit 5b34cd1

Browse files
committed
RAR formats: Optionally build without non-free unrar code
If unrar sources are missing or --without-unrar is used with configure, build RAR formats without the unrar code. Such build can only attack stored files or archives with header protection. Closes openwall#4731
1 parent 0c96d95 commit 5b34cd1

7 files changed

+107
-7
lines changed

doc/NEWS

+6-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,12 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
187187
[magnum; 2021]
188188

189189
- Improved Monero support: Now supports legacy wallets from before 2016 that are
190-
not using JSON format yet. [patrickd, magnumripper, solardiz; 2021]
190+
not using JSON format yet. [patrickd; 2021]
191+
192+
- Add --without-unrar option to configure, for building without the non-free
193+
ClamAV unrar code (crippling the RAR v3 formats a little). Simply deleting
194+
src/unrar*.[ch] will infer that option as well. [magnum; 2021]
195+
191196

192197
Major changes from 1.8.0-jumbo-1 (December 2014) to 1.9.0-jumbo-1 (May 2019):
193198

doc/README-DISTROS

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Our source tree includes ClamAV unrar code which is non-free. Distros can build
2+
without it using --without-unrar option to configure (crippling the RAR v3
3+
formats a little). Simply deleting src/unrar*.[ch] before running configure
4+
will infer that option as well.
5+
6+
--
7+
18
Here's how to build a CPU-fallback chain (with OpenMP fallback too) for
29
distros. See params.h for some background detail. The only actually tricky
310
part is escaping the quotes enough to survive just long enough.

src/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ JOHN_OBJS = \
9393
dynamic_fmt.o dynamic_parser.o dynamic_preloads.o dynamic_utils.o dynamic_big_crypt.o \
9494
dynamic_compiler.o dynamic_compiler_lib.o \
9595
ripemd.o tiger.o \
96-
unrarcmd.o unrarfilter.o unrarhlp.o unrar.o unrarppm.o unrarvm.o \
96+
@UNRAR_OBJS@ \
9797
rar2john.o \
9898
zip2john.o pkzip.o \
9999
$(PLUGFORMATS_OBJS) \

src/autoconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@
324324
/* Define to 1 if you have the <unixlib/local.h> header file. */
325325
#undef HAVE_UNIXLIB_LOCAL_H
326326

327+
/* Define to 1 if you have the ClamAV unrar files. */
328+
#undef HAVE_UNRAR
329+
327330
/* Define to 1 if you have the `vfork' function. */
328331
#undef HAVE_VFORK
329332

src/configure

+40-1
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ CRYPT_LIBS
663663
Z_LIBS
664664
RT_LIBS
665665
M_LIBS
666+
UNRAR_OBJS
666667
OPENSSL_LIBS
667668
OPENSSL_CFLAGS
668669
JOHN_NO_SIMD
@@ -749,6 +750,7 @@ ac_subst_files=''
749750
ac_user_opts='
750751
enable_option_checking
751752
with_openssl
753+
with_unrar
752754
with_endian
753755
with_systemwide
754756
enable_asan
@@ -1415,6 +1417,8 @@ Optional Packages:
14151417
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
14161418
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
14171419
--without-openssl Do not use OpenSSL (exclude much functionality)
1420+
--without-unrar Omit non-free unrar code (rendering RAR v3 support
1421+
incomplete)
14181422
--with-endian=little|big
14191423
Set endianness for target if it doesn't detect
14201424
properly
@@ -3411,6 +3415,14 @@ else
34113415
fi
34123416

34133417

3418+
# Check whether --with-unrar was given.
3419+
if test "${with_unrar+set}" = set; then :
3420+
withval=$with_unrar;
3421+
else
3422+
with_unrar=yes
3423+
fi
3424+
3425+
34143426
# Check whether --with-endian was given.
34153427
if test "${with_endian+set}" = set; then :
34163428
withval=$with_endian;
@@ -12403,6 +12415,33 @@ fi
1240312415

1240412416
fi
1240512417

12418+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for (non-free) ClamAV unrar code" >&5
12419+
$as_echo_n "checking for (non-free) ClamAV unrar code... " >&6; }
12420+
if test $with_unrar = yes; then
12421+
for sf in unrar.c unrarcmd.c unrarfilter.c unrarhlp.c unrarppm.c unrarvm.c unrar.h unrarcmd.h unrarfilter.h unrarhlp.h unrarppm.h unrarvm.h; do
12422+
if test ! -s $sf; then
12423+
unrar_files="no (files missing)"
12424+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12425+
$as_echo "no" >&6; }
12426+
break
12427+
fi
12428+
done
12429+
if test -z "$unrar_files"; then
12430+
unrar_files="yes"
12431+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
12432+
$as_echo "yes" >&6; }
12433+
12434+
$as_echo "#define HAVE_UNRAR 1" >>confdefs.h
12435+
12436+
UNRAR_OBJS="unrarcmd.o unrarfilter.o unrarhlp.o unrar.o unrarppm.o unrarvm.o"
12437+
12438+
fi
12439+
else
12440+
unrar_files="no (disabled)"
12441+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
12442+
$as_echo "disabled" >&6; }
12443+
fi
12444+
1240612445
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
1240712446
$as_echo_n "checking for sqrt in -lm... " >&6; }
1240812447
if ${ac_cv_lib_m_sqrt+:} false; then :
@@ -16418,7 +16457,6 @@ else
1641816457
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating *_plug.c rules" >&5
1641916458
$as_echo "$as_me: creating *_plug.c rules" >&6;}
1642016459
fi
16421-
1642216460
if test "`echo *_plug.c`" != "*_plug.c"; then
1642316461
PLUGFORMATS_OBJS=`echo *_plug.c | sed 's/opencl[A-Za-z0-9_\-]*\.c //g;s/\.c/.o/g'`
1642416462

@@ -17973,6 +18011,7 @@ libgmp (PRINCE mode and faster SRP formats) ${ac_cv_lib_gmp___gmpz_init}
1797318011
libz (pkzip and some other formats) ........ ${using_zlib}
1797418012
libbz2 (gpg2john extra decompression logic) ${using_bz2}
1797518013
libpcap (vncpcap2john and SIPdump) ......... ${using_pcap}
18014+
Non-free unrar code (complete RAR support) . ${unrar_files}
1797618015
OpenMPI support (default disabled) ......... ${using_mpi}
1797718016
ZTEX USB-FPGA module 1.15y support ......... ${ztex}
1797818017

src/configure.ac

+22-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ AC_ARG_VAR([LD], [full pathname of linker to use])
5555
dnl Define Packages.
5656
dnl Use OpenSSL (default: yes).
5757
AC_ARG_WITH(openssl, [AS_HELP_STRING([--without-openssl],[Do not use OpenSSL (exclude much functionality)])],,[with_openssl=yes])
58+
AC_ARG_WITH(unrar, [AS_HELP_STRING([--without-unrar],[Omit non-free unrar code (rendering RAR v3 support incomplete)])],,[with_unrar=yes])
5859
dnl Cludge for endian (if not auto detected)
5960
AC_ARG_WITH(endian, [AS_HELP_STRING([--with-endian=little|big],[Set endianness for target if it doesn't detect properly])],,[endian=unknown])
6061
dnl -DJOHN_SYSTEMWIDE
@@ -614,6 +615,26 @@ else
614615
fi]
615616
)
616617

618+
AC_MSG_CHECKING([for (non-free) ClamAV unrar code])
619+
if test $with_unrar = yes; then
620+
for sf in unrar.c unrarcmd.c unrarfilter.c unrarhlp.c unrarppm.c unrarvm.c unrar.h unrarcmd.h unrarfilter.h unrarhlp.h unrarppm.h unrarvm.h; do
621+
if test ! -s $sf; then
622+
unrar_files="no (files missing)"
623+
AC_MSG_RESULT([no])
624+
break
625+
fi
626+
done
627+
if test -z "$unrar_files"; then
628+
unrar_files="yes"
629+
AC_MSG_RESULT([yes])
630+
AC_DEFINE(HAVE_UNRAR, 1, [Define to 1 if you have the ClamAV unrar files.])
631+
AC_SUBST([UNRAR_OBJS], "unrarcmd.o unrarfilter.o unrarhlp.o unrar.o unrarppm.o unrarvm.o")
632+
fi
633+
else
634+
unrar_files="no (disabled)"
635+
AC_MSG_RESULT([disabled])
636+
fi
637+
617638
AC_CHECK_LIB([m],[sqrt],[AC_DEFINE(HAVE_LIBM,1,[Define to 1 if you have the `m' library (-lm).])] [AC_SUBST(M_LIBS, [-lm])],[AC_MSG_FAILURE(JtR requires libm being installed,1)])
618639
AC_CHECK_LIB([rt],[clock_gettime],[AC_DEFINE(HAVE_LIBRT,1,[Define to 1 if you have clock_gettime in the `rt' library (-lrt).])] [AC_SUBST(RT_LIBS, [-lrt])])
619640
AC_CHECK_LIB([z],[deflate],[AC_DEFINE(HAVE_LIBZ,1,[Define to 1 if you have the `z' library (-lz).])] [AC_SUBST(Z_LIBS, [-lz])])
@@ -1065,7 +1086,6 @@ if test x$using_cl = xyes ; then
10651086
else
10661087
AC_MSG_NOTICE([creating *_plug.c rules])
10671088
fi
1068-
10691089
if test "`echo *_plug.c`" != "*_plug.c"; then
10701090
AC_SUBST([PLUGFORMATS_OBJS],[`echo *_plug.c | sed 's/opencl[[A-Za-z0-9_\-]]*\.c //g;s/\.c/.o/g'`])
10711091
AC_SUBST([OPENCL_PLUGFORMATS_OBJS],[`echo opencl*_plug.c | sed 's/\.c/.o/g'`])
@@ -1261,6 +1281,7 @@ libgmp (PRINCE mode and faster SRP formats) ${ac_cv_lib_gmp___gmpz_init}
12611281
libz (pkzip and some other formats) ........ ${using_zlib}
12621282
libbz2 (gpg2john extra decompression logic) ${using_bz2}
12631283
libpcap (vncpcap2john and SIPdump) ......... ${using_pcap}
1284+
Non-free unrar code (complete RAR support) . ${unrar_files}
12641285
OpenMPI support (default disabled) ......... ${using_mpi}
12651286
ZTEX USB-FPGA module 1.15y support ......... ${ztex}
12661287

src/rar_common.c

+28-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#include "misc.h" // error()
1010
#include "john.h"
1111
#include "loader.h"
12+
#if AC_BUILT
13+
#include "autoconfig.h"
14+
#else
15+
#define HAVE_UNRAR 1
16+
#endif
1217

1318
#define BINARY_SIZE sizeof(fmt_data)
1419
#define BINARY_ALIGN sizeof(size_t)
@@ -39,18 +44,22 @@ static struct fmt_tests cpu_tests[] = {
3944
{"$RAR3$*0*56ce6de6ddee17fb*4c957e533e00b0e18dfad6accc490ad9", "john"},
4045
/* -p mode tests, -m0 and -m3 (in that order) */
4146
{"$RAR3$*1*c47c5bef0bbd1e98*965f1453*48*47*1*c5e987f81d316d9dcfdb6a1b27105ce63fca2c594da5aa2f6fdf2f65f50f0d66314f8a09da875ae19d6c15636b65c815*30", "test"},
47+
#if HAVE_UNRAR
4248
{"$RAR3$*1*b4eee1a48dc95d12*965f1453*64*47*1*0fe529478798c0960dd88a38a05451f9559e15f0cf20b4cac58260b0e5b56699d5871bdcc35bee099cc131eb35b9a116adaedf5ecc26b1c09cadf5185b3092e6*33", "test"},
4349
/* issue #2899 unrar bug */
4450
{"$RAR3$*1*00d7bc908cd4ad64*cc4b574e*16*7*1*58b582307dd07e0082a742d3f5d91ad3*33", "abc"},
4551
//{"$RAR3$*1*fa0d20d2d9868510*cc4b574e*16*7*1*48a4b1de0795cd2adb2fab5f89b4d916*33", "1я1"}, /* UTF-8 needed */
52+
#endif /* HAVE_UNRAR */
4653
#ifdef DEBUG
54+
#if HAVE_UNRAR
4755
/* Various lengths, these should be in self-test but not benchmark */
4856
/* from CMIYC 2012 */
4957
{"$RAR3$*1*0f263dd52eead558*834015cd*384*693*1*e28e9648f51b59e32f573b302f0e94aadf1050678b90c38dd4e750c7dd281d439ab4cccec5f1bd1ac40b6a1ead60c75625666307171e0fe2639d2397d5f68b97a2a1f733289eac0038b52ec6c3593ff07298fce09118c255b2747a02c2fa3175ab81166ebff2f1f104b9f6284a66f598764bd01f093562b5eeb9471d977bf3d33901acfd9643afe460e1d10b90e0e9bc8b77dc9ac40d40c2d211df9b0ecbcaea72c9d8f15859d59b3c85149b5bb5f56f0218cbbd9f28790777c39e3e499bc207289727afb2b2e02541b726e9ac028f4f05a4d7930efbff97d1ffd786c4a195bbed74997469802159f3b0ae05b703238da264087b6c2729d9023f67c42c5cbe40b6c67eebbfc4658dfb99bfcb523f62133113735e862c1430adf59c837305446e8e34fac00620b99f574fabeb2cd34dc72752014cbf4bd64d35f17cef6d40747c81b12d8c0cd4472089889a53f4d810b212fb314bf58c3dd36796de0feeefaf26be20c6a2fd00517152c58d0b1a95775ef6a1374c608f55f416b78b8c81761f1d*33:1::to-submit-challenges.txt", "wachtwoord"},
5058
{"$RAR3$*1*9759543e04fe3a22*834015cd*384*693*1*cdd2e2478e5153a581c47a201490f5d9b69e01584ae488a2a40203da9ba8c5271ed8edc8f91a7bd262bb5e5de07ecbe9e2003d054a314d16caf2ea1de9f54303abdee1ed044396f7e29c40c38e638f626442efd9f511b4743758cd4a6025c5af81d1252475964937d80bfd50d10c171e7e4041a66c02a74b2b451ae83b6807990fb0652a8cdab530c5a0c497575a6e6cbe2db2035217fe849d2e0b8693b70f3f97b757229b4e89c8273197602c23cc04ff5f24abf3d3c7eb686fc3eddce1bfe710cc0b6e8bd012928127da38c38dd8f056095982afacb4578f6280d51c6739739e033674a9413ca88053f8264c5137d4ac018125c041a3489daaf175ef75e9282d245b92948c1bbcf1c5f25b7028f6d207d87fe9598c2c7ccd1553e842a91ab8ca9261a51b14601a756070388d08039466dfa36f0b4c7ea7dd9ff25c9d98687203c58f9ec8757cafe4d2ed785d5a9e6d5ea838e4cc246a9e6d3c30979dcce56b380b05f9103e6443b35357550b50229c47f845a93a48602790096828d9d6bef0*33:1::to-submit-challenges.txt", "Sleepingbaby210"},
5159
{"$RAR3$*1*79e17c26407a7d52*834015cd*384*693*1*6844a189e732e9390b5a958b623589d5423fa432d756fd00940ac31e245214983507a035d4e0ee09469491551759a66c12150fe6c5d05f334fb0d8302a96d48ef4da04954222e0705507aaa84f8b137f284dbec344eee9cea6b2c4f63540c64df3ee8be3013466d238c5999e9a98eb6375ec5462869bba43401ec95077d0c593352339902c24a3324178e08fe694d11bfec646c652ffeafbdda929052c370ffd89168c83194fedf7c50fc7d9a1fbe64332063d267a181eb07b5d70a5854067db9b66c12703fde62728d3680cf3fdb9933a0f02bfc94f3a682ad5e7c428d7ed44d5ff554a8a445dea28b81e3a2631870e17f3f3c0c0204136802c0701590cc3e4c0ccd9f15e8be245ce9caa6969fab9e8443ac9ad9e73e7446811aee971808350c38c16c0d3372c7f44174666d770e3dd321e8b08fb2dc5e8a6a5b2a1720bad66e54abc194faabc5f24225dd8fee137ba5d4c2ed48c6462618e6333300a5b8dfc75c65608925e786eb0988f7b3a5ab106a55168d1001adc47ce95bba77b38c35b*33:1::to-submit-challenges.txt", "P-i-r-A-T-E"},
5260
{"$RAR3$*1*e1df79fd9ee1dadf*771a163b*64*39*1*edc483d67b94ab22a0a9b8375a461e06fa1108fa72970e16d962092c311970d26eb92a033a42f53027bdc0bb47231a12ed968c8d530a9486a90cbbc00040569b*33", "333"},
5361
{"$RAR3$*1*c83c00534d4af2db*771a163b*64*39*1*05244526d6b32cb9c524a15c79d19bba685f7fc3007a9171c65fc826481f2dce70be6148f2c3497f0d549aa4e864f73d4e4f697fdb66ff528ed1503d9712a414*33", "11eleven111"},
62+
#endif /* HAVE_UNRAR */
5463
{"$RAR3$*0*c203c4d80a8a09dc*49bbecccc08b5d893f308bce7ad36c0f", "sator"},
5564
{"$RAR3$*0*672fca155cb74ac3*8d534cd5f47a58f6493012cf76d2a68b", "arepo"},
5665
{"$RAR3$*0*c203c4d80a8a09dc*c3055efe7ca6587127fd541a5b88e0e4", "tenet"},
@@ -71,7 +80,7 @@ static struct fmt_tests cpu_tests[] = {
7180
{"$RAR3$*0*5fa43f823a60da63*af2630863e12046e42c4501c915636c9", "eleven11111"},
7281
{"$RAR3$*0*5fa43f823a60da63*88c0840d0bd98844173d35f867558ec2", "twelve121212"},
7382
{"$RAR3$*0*4768100a172fa2b6*48edcb5283ee2e4f0e8edb25d0d85eaa", "subconsciousness"},
74-
#endif
83+
#endif /* DEBUG */
7584
{NULL}
7685
};
7786

@@ -84,16 +93,19 @@ static struct fmt_tests gpu_tests[] = {
8493
{"$RAR3$*0*c203c4d80a8a09dc*1f406154556d4c895a8be207fd2b5d0c", "rotas"},
8594
/* -p mode tests, -m0 and -m3 (in that order) */
8695
{"$RAR3$*1*c47c5bef0bbd1e98*965f1453*48*47*1*c5e987f81d316d9dcfdb6a1b27105ce63fca2c594da5aa2f6fdf2f65f50f0d66314f8a09da875ae19d6c15636b65c815*30", "test"},
96+
#if HAVE_UNRAR
8797
{"$RAR3$*1*b4eee1a48dc95d12*965f1453*64*47*1*0fe529478798c0960dd88a38a05451f9559e15f0cf20b4cac58260b0e5b56699d5871bdcc35bee099cc131eb35b9a116adaedf5ecc26b1c09cadf5185b3092e6*33", "test"},
8898
/* issue #2899 unrar bug */
8999
{"$RAR3$*1*00d7bc908cd4ad64*cc4b574e*16*7*1*58b582307dd07e0082a742d3f5d91ad3*33", "abc"},
90100
//{"$RAR3$*1*fa0d20d2d9868510*cc4b574e*16*7*1*48a4b1de0795cd2adb2fab5f89b4d916*33", "1я1"}, /* UTF-8 needed */
101+
#endif /* HAVE_UNRAR */
91102
#ifdef DEBUG
92103
{"$RAR3$*0*af24c0c95e9cafc7*e7f207f30dec96a5ad6f917a69d0209e", "magnum"},
93104
{"$RAR3$*0*2653b9204daa2a8e*39b11a475f486206e2ec6070698d9bbc", "123456"},
94105
{"$RAR3$*0*63f1649f16c2b687*8a89f6453297bcdb66bd756fa10ddd98", "abc123"},
95106
/* -p mode tests, -m0 and -m3 (in that order) */
96107
{"$RAR3$*1*575b083d78672e85*965f1453*48*47*1*cd3d8756438f43ab70e668792e28053f0ad7449af1c66863e3e55332bfa304b2c082b9f23b36cd4a8ebc0b743618c5b2*30", "magnum"},
108+
#if HAVE_UNRAR
97109
{"$RAR3$*1*6f5954680c87535a*965f1453*64*47*1*c9bb398b9a5d54f035fd22be54bc6dc75822f55833f30eb4fb8cc0b8218e41e6d01824e3467475b90b994a5ddb7fe19366d293c9ee305316c2a60c3a7eb3ce5a*33", "magnum"},
98110
/* Various lengths, these should be in self-test but not benchmark */
99111
/* from CMIYC 2012 */
@@ -102,6 +114,7 @@ static struct fmt_tests gpu_tests[] = {
102114
{"$RAR3$*1*79e17c26407a7d52*834015cd*384*693*1*6844a189e732e9390b5a958b623589d5423fa432d756fd00940ac31e245214983507a035d4e0ee09469491551759a66c12150fe6c5d05f334fb0d8302a96d48ef4da04954222e0705507aaa84f8b137f284dbec344eee9cea6b2c4f63540c64df3ee8be3013466d238c5999e9a98eb6375ec5462869bba43401ec95077d0c593352339902c24a3324178e08fe694d11bfec646c652ffeafbdda929052c370ffd89168c83194fedf7c50fc7d9a1fbe64332063d267a181eb07b5d70a5854067db9b66c12703fde62728d3680cf3fdb9933a0f02bfc94f3a682ad5e7c428d7ed44d5ff554a8a445dea28b81e3a2631870e17f3f3c0c0204136802c0701590cc3e4c0ccd9f15e8be245ce9caa6969fab9e8443ac9ad9e73e7446811aee971808350c38c16c0d3372c7f44174666d770e3dd321e8b08fb2dc5e8a6a5b2a1720bad66e54abc194faabc5f24225dd8fee137ba5d4c2ed48c6462618e6333300a5b8dfc75c65608925e786eb0988f7b3a5ab106a55168d1001adc47ce95bba77b38c35b*33:1::to-submit-challenges.txt", "P-i-r-A-T-E"},
103115
{"$RAR3$*1*e1df79fd9ee1dadf*771a163b*64*39*1*edc483d67b94ab22a0a9b8375a461e06fa1108fa72970e16d962092c311970d26eb92a033a42f53027bdc0bb47231a12ed968c8d530a9486a90cbbc00040569b*33", "333"},
104116
{"$RAR3$*1*c83c00534d4af2db*771a163b*64*39*1*05244526d6b32cb9c524a15c79d19bba685f7fc3007a9171c65fc826481f2dce70be6148f2c3497f0d549aa4e864f73d4e4f697fdb66ff528ed1503d9712a414*33", "11eleven111"},
117+
#endif /* HAVE_UNRAR */
105118
{"$RAR3$*0*345f5f573a077ad7*638e388817cc7851e313406fd77730b9", "Boustrophedon"},
106119
{"$RAR3$*0*c9dea41b149b53b4*fcbdb66122d8ebdb32532c22ca7ab9ec", "password"},
107120
{"$RAR3$*0*7ce241baa2bd521b*f2b26d76424efa351c728b321671d074", "@"},
@@ -117,7 +130,7 @@ static struct fmt_tests gpu_tests[] = {
117130
{"$RAR3$*0*5fa43f823a60da63*af2630863e12046e42c4501c915636c9", "eleven11111"},
118131
{"$RAR3$*0*5fa43f823a60da63*88c0840d0bd98844173d35f867558ec2", "twelve121212"},
119132
{"$RAR3$*0*4768100a172fa2b6*48edcb5283ee2e4f0e8edb25d0d85eaa", "subconsciousness"},
120-
#endif
133+
#endif /* DEBUG */
121134
{NULL}
122135
};
123136
#endif
@@ -418,6 +431,15 @@ static int valid(char *ciphertext, struct fmt_main *self)
418431
}
419432
if (!(ptr = strtokm(NULL, "*"))) /* method */
420433
goto error;
434+
#if !HAVE_UNRAR
435+
if (atoi(ptr) != 30) {
436+
static int warned;
437+
438+
if (!warned++ && john_main_process)
439+
fprintf(stderr, "Warning: Packed RAR hash(es) seen but ignored, this build does not support them.\n");
440+
goto error;
441+
}
442+
#endif
421443
}
422444
MEM_FREE(keeptr);
423445
return 1;
@@ -590,7 +612,9 @@ inline static void check_rar(rar_file *cur_file, int index, unsigned char *key,
590612
/* Compare computed CRC with stored CRC */
591613
cracked[index] = !memcmp(crc_out, &cur_file->crc.c, 4);
592614
return;
593-
} else {
615+
}
616+
#if HAVE_UNRAR
617+
else {
594618
const int solid = 0;
595619
unpack_data_t *unpack_t;
596620
unsigned char pre_iv[16];
@@ -637,6 +661,7 @@ inline static void check_rar(rar_file *cur_file, int index, unsigned char *key,
637661
else
638662
cracked[index] = 0;
639663
}
664+
#endif /* HAVE_UNRAR */
640665
}
641666
}
642667

0 commit comments

Comments
 (0)