openwall / john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
https://www.openwall.com/john/
Other
10.29k stars 2.1k forks source link

Cuda support / Windows package #4241

Closed kolet closed 4 years ago

kolet commented 4 years ago

hi,

i've search online with out any success, i'd like to be able to compile jtr cuda (to use my gpu cards) for windows.

i did try to compile this way ./configure x86_64-w64-mingw32

with out any success . error receiving is

configure: error: in `/mnt/c/Users/user/Desktop/JohnTheRipper/src':
configure: error: JtR requires OpenSSL headers being installed

all of this above was for the latest JtR from github.

i did install libssl-dev and libssl1.0.0 and libssl1.1 and libssl1.0-dev to make sure i rid of the openssl error , it did not work.

this is for CUDA version. it did successed to ./configure OPENSSL_LIBS="-lssl -lcrypto" --host=x86_64-w64-mingw32 (from WSL (sindows subsystem)

but when trying to make it with make clean && make -s it throw this error,

i did install libpcap-dev and libssl-dev

In file included from md5.c:25:0:
md5.h:25:10: fatal error: openssl/md5.h: No such file or directory
 #include <openssl/md5.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
Makefile:1593: recipe for target 'md5.o' failed
make[1]: *** [md5.o] Error 1
Makefile:195: recipe for target 'default' failed
make: *** [default] Error 2

is there any guide that i can follow to be able to compile it for windows machine (from ubuntu subsystem) compiling it for linux ubuntu subsystem from the ubuntu subsystem worked like a charm. like from a to z, if mingw64 as to be downloaded , from where since they are so many windows version and i wasnt able to run any one of them properly.

thanks

kolet commented 4 years ago

tried to be a smart ass and copied all the *.h files into a new folder i created named openssl inside the src folder next error i got was

make clean && make -sj4
rm -f ../run/john.exe ../run/unshadow.exe ../run/unafs.exe ../run/unique.exe ../run/undrop.exe ../run/rar2john.exe ../run/zip2john.exe ../run/genmkvpwd.exe ../run/mkvcalcproba.exe ../run/calc_stat.exe ../run/tgtsnarf.exe ../run/racf2john.exe ../run/hccap2john.exe ../run/raw2dyna.exe ../run/keepass2john.exe ../run/dmg2john.exe ../run/putty2john.exe ../run/uaf2john.exe ../run/wpapcap2john.exe ../run/gpg2john.exe ../run/cprepair.exe ../run/base64conv.exe
rm -f john-macosx-* *.o escrypt/*.o *.bak core
rm -f ../run/kernels/*
rm -f detect bench generic.h tmp.s
rm -f cuda/*.o cuda/*~ *~
cp /dev/null Makefile.dep
make[1]: Entering directory '/mnt/c/JohnTheRipper-CUDA/src/aes'
/usr/bin/find . -name \*.a -exec /bin/rm -f {} \;
/usr/bin/find . -name \*.o -exec /bin/rm -f {} \;
make[1]: Leaving directory '/mnt/c/JohnTheRipper-CUDA/src/aes'
make[1]: Entering directory '/mnt/c/JohnTheRipper-CUDA/src/escrypt'
/bin/rm -f tests crypto_scrypt-best.o crypto_scrypt-common.o sha256.o tests.o crypto_scrypt-*.o
make[1]: Leaving directory '/mnt/c/JohnTheRipper-CUDA/src/escrypt'
cp: missing destination file operand after '../run/kernels'
Try 'cp --help' for more information.
cp: missing destination file operand after '../run/kernels'
Try 'cp --help' for more information.
Makefile:913: recipe for target 'opencl_device_info.h' failed
make[1]: *** [opencl_device_info.h] Error 1
make[1]: *** Waiting for unfinished jobs....
cp: Makefile:913: recipe for target 'opencl_misc.h' failed
missing destination file operand after '../run/kernels'make[1]: *** [opencl_misc.h] Error 1

cp: Try 'cp --help' for more information.
missing destination file operand after '../run/kernels'Makefile:913: recipe for target 'opencl_sha2.h' failed

make[1]: *** [opencl_sha2.h] Error 1
Try 'cp --help' for more information.
Makefile:913: recipe for target 'opencl_DES_kernel_params.h' failed
make[1]: *** [opencl_DES_kernel_params.h] Error 1
Makefile:195: recipe for target 'default' failed
make: *** [default] Error 2
kolet commented 4 years ago

next thing i tried to do after reading countless issues here.

i tried this , i downloaded openssl from github compiled it with./Configure mingw64 --prefix=/build/openssl zlib shared and putted it inside /mnt/c/build/openssl/ same as jtr in /mnt/c/build/john..

then

NO_DEFAULT_PREFIX=1 ./configure OPENSSL_CFLAGS="-I/mnt/c/build/openssl/include" OPENSSL_LIBS="-lssl -lcrypto" CFLAGS_EXTRA="-I/mnt/c/build/openssl/include" LDFLAGS="-L/mnt/c/build/openssl/lib" --host=x86_64-w64-mingw32

went smooth no problem there.

however when compiling it,

another error happen

make clean && make -s
rm -f ../run/john.exe ../run/unshadow.exe ../run/unafs.exe ../run/unique.exe ../run/undrop.exe ../run/rar2john.exe ../run/zip2john.exe ../run/genmkvpwd.exe ../run/mkvcalcproba.exe ../run/calc_stat.exe ../run/tgtsnarf.exe ../run/racf2john.exe ../run/hccap2john.exe ../run/raw2dyna.exe ../run/keepass2john.exe ../run/dmg2john.exe ../run/putty2john.exe ../run/uaf2john.exe ../run/wpapcap2john.exe ../run/gpg2john.exe ../run/cprepair.exe ../run/base64conv.exe
rm -f john-macosx-* *.o escrypt/*.o *.bak core
rm -f ../run/kernels/*
rm -f detect bench generic.h tmp.s
rm -f cuda/*.o cuda/*~ *~
cp /dev/null Makefile.dep
make[1]: Entering directory '/mnt/c/build/JohnTheRipper-CUDA/src/aes'
/usr/bin/find . -name \*.a -exec /bin/rm -f {} \;
/usr/bin/find . -name \*.o -exec /bin/rm -f {} \;
make[1]: Leaving directory '/mnt/c/build/JohnTheRipper-CUDA/src/aes'
make[1]: Entering directory '/mnt/c/build/JohnTheRipper-CUDA/src/escrypt'
/bin/rm -f tests crypto_scrypt-best.o crypto_scrypt-common.o sha256.o tests.o crypto_scrypt-*.o
make[1]: Leaving directory '/mnt/c/build/JohnTheRipper-CUDA/src/escrypt'
In file included from /mnt/c/build/openssl/include/openssl/macros.h:10:0,
                 from /mnt/c/build/openssl/include/openssl/md5.h:14,
                 from md5.h:25,
                 from md5.c:25:
/mnt/c/build/openssl/include/openssl/opensslconf.h:13:10: fatal error: openssl/configuration.h: No such file or directory
 #include <openssl/configuration.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:1593: recipe for target 'md5.o' failed
make[1]: *** [md5.o] Error 1
Makefile:195: recipe for target 'default' failed
make: *** [default] Error 2

im really trying but nothing as worked for me yet..

help and guidance is welcome (and needed :) )

kolet commented 4 years ago

last update after wasting hours on this.

i've read https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/doc/INSTALL-WINDOWS installed cygwin , installed all the needed packages.

problem is "make" did not work.

encfs_common_plug.c: In function ‘encfs_common_streamDecode’:
encfs_common_plug.c:212:17: error: storage size of ‘stream_dec’ isn’t known
  212 |  EVP_CIPHER_CTX stream_dec;
      |                 ^~~~~~~~~~
encfs_common_plug.c:212:17: warning: unused variable ‘stream_dec’ [-Wunused-variable]
make[1]: *** [Makefile:1593: encfs_common_plug.o] Error 1
make[1]: ***
make: *** [Makefile:196: default] Error 2
claudioandre-br commented 4 years ago

From doc/README-CUDA: CUDA support has been dropped two years ago. Anyway, I tried to compile it:

git checkout aa3602b
git checkout -b CUDA
./configure --enable-cuda
make -s clean && make -sj8

It gave me lots of CUDA deprecated warnings. Then, it bailed out with errors.

That said, if you really need CUDA, I'm afraid you will have to handle it yourself.

kolet commented 4 years ago

From doc/README-CUDA: CUDA support has been dropped two years ago. Anyway, I tried to compile it:

git checkout aa3602b
git checkout -b CUDA
./configure --enable-cuda
make -s clean && make -sj8

It gave me lots of CUDA deprecated warnings. Then, it bailed out with errors.

  • the errors I'm seeing are fixable. From ld, missing library. Unfortunately, I'm using a remote machine, no root.
  • I'm not aware of people that used CUDA on Windows. So, it might be IMpossible to compile it.

That said, if you really need CUDA, I'm afraid you will have to handle it yourself.

it is however the latest release in the repo..

mind explaining me and the others how to compile the repo(not cuda) for windows (from WSL) because i was not able to compile it either . i tried with cygwin and wsl , no good as u see the tries above.

please advice what to download where to download and all the steps for a windows machine so that windows users will be able to compile it and run it.

because the "/doc/INSTALL-WINDOWS" does not work at all. i mean i am 15h just on it and tried many things, i dont know what i am doing wrong and where i ak fcking up , so i'd like to follow a guide that way i will be able to compile it successfully .

claudioandre-br commented 4 years ago

I, myself, bult using WSL a year ago. I don't know how it behaves now. It should be easy, but, who knows?

What you can read inside doc/INSTALL-WINDOWS is, basically, what I do to test and deploy JtR's Windows package. Well, since I use chocolatey, it is more like this:

choco install -y cygwin cyg-get
cyg-get libssl-devel libbz2-devel libgmp-devel zlib-devel gcc-core libOpenCL-devel libcrypt-devel make wget rebase perl

[1]

appveyor DownloadFile "http://www.cygwin.com/setup-$env:Arch.exe" -FileName "C:\$env:Location\setup-$env:Arch.exe"
cmd /c "C:\$env:Location\setup-$env:Arch.exe -q --no-desktop --no-shortcuts --no-startmenu --upgrade-also"

At this right moment, I can't help further. Anyway:

The GitHub issues are primarily to keep track of bugs or other shortcomings of our software, and fix those. It is not to help individual users with their specific tasks. To receive user support from the community, please use the john-users mailing list instead.

solardiz commented 4 years ago

I think there's a lot of confusion here. Returning to:

i'd like to be able to compile jtr cuda (to use my gpu cards) for windows.

If the reason for all of this is to use GPUs, then:

  1. You don't need CUDA for that. You need OpenCL. (Edit: you do need to have NVIDIA's CUDA toolkit installed, but we use the OpenCL support that it provides, not the CUDA language.)

  2. You don't have to build from source for that. You can use our Windows binary build of 1.9.0-jumbo-1 available off JtR homepage.

If you want to build from source for some reason (what reason?), then you can either build for Windows from the Cygwin shell (not from WSL) or you can build for Linux from WSL (and actually use the resulting builds from WSL as well). Trying to build for Windows while being on Linux (even if in WSL) is trickier, and getting your GPUs working in this way is trickier yet. Why would you?

kolet commented 4 years ago

I think there's a lot of confusion here. Returning to:

i'd like to be able to compile jtr cuda (to use my gpu cards) for windows.

If the reason for all of this is to use GPUs, then:

  1. You don't need CUDA for that. You need OpenCL. (Edit: you do need to have NVIDIA's CUDA toolkit installed, but we use the OpenCL support that it provides, not the CUDA language.)
  2. You don't have to build from source for that. You can use our Windows binary build of 1.9.0-jumbo-1 available off JtR homepage.

If you want to build from source for some reason (what reason?), then you can either build for Windows from the Cygwin shell (not from WSL) or you can build for Linux from WSL (and actually use the resulting builds from WSL as well). Trying to build for Windows while being on Linux (even if in WSL) is trickier, and getting your GPUs working in this way is trickier yet. Why would you?

well, here the thing, i have used zip2john from the jumbo release and it was showing me one thing, then i downloaded the latest github repo (not from the release) compiled it for WSL (via WSL) , and the result from zip2john was different. first i wanted to use hashcat to crack the PKZIP hash, first try did not work because the hash was off and hashcat did not recognize the hash. (with the old zip2john) second try did not work because the hash of the PKZIP was huge (like 8mil chars , a 8mb+- hash file), resulting a token length in hashcat (with the newer zip2john compiled from WSL to WSL) third try was the only other option i had to use hashcat and it was zip2john with -c enable, however this resulting in a huge ammount of false positives hundreds to thousands on top of that there is no Certainty that the mode i am using in hashcat (17200) is the right one.

i do have the jumbo release , from openwall. working on this hash is super crucial for me, i want to speed up the process instead of using only CPUs , i want to be able to use my GPUs for this task from a windows machine.

are u telling me there is an option to use the jumbo release with the windows binaries (exe) with GPUs ? if yes i will be so disappointed of myself for wasting this amount of hours for not getting any results :)

all i want in the end is be able to crack the PKZIP hash, hashcat resulting in huge ammount of false positive and with out knowing if the hash is even supported. and as far as i knew i didnt know i could use JTR jumbo from openwall to crack hashes with my gpus (1080 and 1080ti)

so basically maybe to summon up the question is how do i use my gpus with JTR jumbo? (as far as i know from openwall, if there is another link, please link it:) )

claudioandre-br commented 4 years ago

Off the top of my head:

are u telling me there is an option to use the jumbo release with the windows binaries (exe) with GPUs?

Yes. From the repo, click the "download" seen below:

image


Follow the instructions and download the "endorsed" 7zip file:

Keep in mind that you need to install GPU drivers and/or OpenCL runtime. I really don't know if you already have the necessary stuff installed.

claudioandre-br commented 4 years ago

Just to be clear:

kolet commented 4 years ago

i want to kill myself right now for not seeing it earlier xD thanks alot !

i've downloaded https://github.com/claudioandre-br/packages/releases/download/jumbo-dev/winX64_1_JtR-endorsed.7z

does it use the gpus automatically ? or there is a flag for it ?

edit:

does the opencl should be downloaded from the intel website the (the sdk one?) https://software.intel.com/en-us/opencl-sdk/choose-download

or nvidia site https://developer.nvidia.com/opencl

claudioandre-br commented 4 years ago

does it use the gpus automatically ? or there is a flag for it ?

If you have all pieces installed, you should pick the OpenCL format (I mean, skip the CPU format):

john _parameters_ --format=opencl

But, only when you are sure everything else is ok.

kolet commented 4 years ago

does it use the gpus automatically ? or there is a flag for it ?

If you have all pieces installed, you should pick the OpenCL format (I mean, skip the CPU format):

john _parameters_ --format=opencl

But, only when you are sure everything else is ok.

not sure what is "everything" :) ur everything is not elses everything , mind to elaborate ?

(well thats fcked up apparently to install opencl u have to download a windows graphic driver , and mind says . "Sorry, we didn't find any supported Intel drivers or software." )

second edit: apparently it says in the nvidia website that the opencl is already included in the nvidia latest driver. i will download that and update the thread here.

solardiz commented 4 years ago

@kolet zip2john supports two very different kinds of ZIP archives: PKZIP (ancient "non-cryptographic" encryption, no proper KDF) and WinZip (AES, PBKDF2). Out of these two, we only support use of GPUs (via OpenCL) for WinZip archives. For PKZIP archives, we only have a CPU implementation. hashcat supports PKZIP archives on GPUs, but I don't know the detail.

So if what you have is a PKZIP archive (not WinZip), and that's your only use case, then you're wasting time trying to get JtR to use your GPUs.

solardiz commented 4 years ago

@kolet For PKZIP, you could also try bkcrack, which I mentioned here: https://www.openwall.com/lists/john-users/2019/05/20/3

kolet commented 4 years ago

@kolet For PKZIP, you could also try bkcrack, which I mentioned here: https://www.openwall.com/lists/john-users/2019/05/20/3

thanks.

so a lil update. i downloaded the latest nvidia drivers.

and JTR dont seems to find any openCL devices.

JtR windows binary endorsed\run>john.exe --list=opencl-devices
Error: No OpenCL-capable platforms were detected by the installed OpenCL driver.
Error: No OpenCL-capable devices were detected by the installed OpenCL driver.

from here https://developer.nvidia.com/opencl it seems that opencl should be included in the nvidia driver " OpenCL support is included in the latest NVIDIA GPU drivers, available at "

but JTR cant find it :o

claudioandre-br commented 4 years ago

I never tested it, anyway, there are some binaries to help you check if you have OpenCL working: https://ci.appveyor.com/api/projects/oblomov/clinfo/artifacts/clinfo.exe?job=platform%3a+x64

kolet commented 4 years ago

I never tested it, anyway, there are some binaries to help you check if you have OpenCL working: https://ci.appveyor.com/api/projects/oblomov/clinfo/artifacts/clinfo.exe?job=platform%3a+x64

clinfo shows all of my gpus .

  Device Name                                     GeForce GTX 1080 Ti
  Device Vendor                                   NVIDIA Corporation
  Device Vendor ID                                0x10de
  Device Version                                  OpenCL 1.2 CUDA
  Driver Version                                  445.75
  Device OpenCL C Version                         OpenCL C 1.2

full list

  Device Name                                     GeForce GTX 1080 Ti
  Device Vendor                                   NVIDIA Corporation
  Device Vendor ID                                0x10de
  Device Version                                  OpenCL 1.2 CUDA
  Driver Version                                  445.75
  Device OpenCL C Version                         OpenCL C 1.2
  Device Type                                     GPU
  Device Topology (NV)                            PCI-E, 88:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               28
  Max clock frequency                             1582MHz
  Compute Capability (NV)                         6.1
  Device Partition                                (core)
    Max number of sub-devices                     1
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x64
  Max work group size                             1024
  Preferred work group size multiple              32
  Warp size (NV)                                  32
  Preferred / native vector sizes
    char                                                 1 / 1
    short                                                1 / 1
    int                                                  1 / 1
    long                                                 1 / 1
    half                                                 0 / 0        (n/a)
    float                                                1 / 1
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              11811160064 (11GiB)
  Error Correction support                        No
  Max memory allocation                           2952790016 (2.75GiB)
  Unified memory for Host and Device              No
  Integrated memory (NV)                          No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       4096 bits (512 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        1376256 (1.313MiB)
  Global Memory cache line size                   128 bytes
  Image support                                   Yes
    Max number of samplers per kernel             32
    Max size for 1D images from buffer            268435456 pixels
    Max 1D or 2D image array size                 2048 images
    Max 2D image size                             16384x32768 pixels
    Max 3D image size                             16384x16384x16384 pixels
    Max number of read image args                 256
    Max number of write image args                16
  Local memory type                               Local
  Local memory size                               49152 (48KiB)
  Registers per block (NV)                        65536
  Max number of constant args                     9
  Max constant buffer size                        65536 (64KiB)
  Max size of kernel argument                     4352 (4.25KiB)
  Queue properties
    Out-of-order execution                        Yes
    Profiling                                     Yes
  Prefer user sync for interop                    No
  Profiling timer resolution                      1000ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Kernel execution timeout (NV)                 No
  Concurrent copy and kernel execution (NV)       Yes
    Number of async copy engines                  2
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics

in the end after it went through all my gpus

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [NV]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  Invalid device type for platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No platform
claudioandre-br commented 4 years ago

Ok. Please, find a file named OpenCL.dllinside your Windows folder and replace the file cygOpenCL-1.dll inside the JtR run folder

solardiz commented 4 years ago

@claudioandre-br Shouldn't our inclusion of a etc/OpenCL/vendors/nvidia.icd have worked around that issue? I don't recall what reads that file, though. It's relative to our tree, so it feels weird any library would look there. Can you remind me?

@kolet While it'd be curious to investigate this further, please be aware that this won't help you crack your PKZIP archive with JtR, nor with bkcrack - both of these can only use CPUs for PKZIP. (And bkcrack completes quickly enough for this not to matter. What you need for it is some known plaintext, and not so much computing performance.)

kolet commented 4 years ago

OpenCL.dll

they are couple of OpenCL.dll

C:\Windows\SysWOW64\OpenCL.dll C:\Windows\System32\OpenCL.dll C:\Program Files\NVIDIA Corporation\OpenCL\OpenCL.dll

and there is already a filename cygOpenCL-1.dll in the run folder .

@solardiz i know, i just wana help out right now since we are already on it, so why not... i've spent over 15h on this , so alil more wont be a problem to help out the rest of the community.

UPDATE: named the cygOpenCL-1.dll to cygOpenCL-1.dll.old and put the SysWOW64\OpenCL.dll inside (renamed to cygOpenCL-1.dll) and NVIDIA Corporation\OpenCL\OpenCL.dll (renamed to cygOpenCL-1.dll)

both printed nothing with john.exe --list=opencl-devices

claudioandre-br commented 4 years ago

Try C:\Windows\System32\OpenCL.dll

kolet commented 4 years ago

Try C:\Windows\System32\OpenCL.dll

with this same result

Error: No OpenCL-capable platforms were detected by the installed OpenCL driver.
Error: No OpenCL-capable devices were detected by the installed OpenCL driver.
kolet commented 4 years ago

ouraii so i found another opencl file in

C:\Windows\LastGood.Tmp\system32\OpenCL.dll
C:\Windows\LastGood.Tmp\SysWow64\OpenCL.dll

took this one C:\Windows\LastGood.Tmp\system32\OpenCL.dll and now it print out all the gpus. hmm wtf xD

claudioandre-br commented 4 years ago

Shouldn't our inclusion of a etc/OpenCL/vendors/nvidia.icd have worked around that issue?

Sometimes it doesn't work. It uses and loades the file System32\nvopencl.dll. But, it seems some computers don't have this file.

C:\Windows\LastGood.Tmp\system32\OpenCL.dll and now it print out all the gpus

Very goood. My final statement, I can't explain why some Windows .dlls are not working. If are installed, they have to work.

kolet commented 4 years ago

will it matter if i share these dlls here ?

(do they show sensitive info inside of them ? / or they are randomized in every pc so it wont help at all others)

but what would happen if these dll havent been found? what then ?

Shouldn't our inclusion of a etc/OpenCL/vendors/nvidia.icd have worked around that issue?

Sometimes it doesn't work. It uses and loades the file System32\nvopencl.dll. But, it seems some computers don't have this file.

C:\Windows\LastGood.Tmp\system32\OpenCL.dll and now it print out all the gpus

Very goood. My final statement, I can't explain why some Windows .dlls are not working. If are installed, they have to work.

claudioandre-br commented 4 years ago

will it matter if i share these dlls here ?

No.

These problems are support issues. They need to be solved on a case-by-case basis, basically, by the end user.

kolet commented 4 years ago

hmm, i have 2 machines . one with 1080 gpus and the second one with 1080ti gpus.

i can upload these if u want

solardiz commented 4 years ago

@claudioandre-br Why are the files etc/OpenCL/vendors/*.icd read at all? These are pathnames relative to our tree, why does any library (which one?) look in there? I would understand for absolute paths such as /etc/..., but these relative ones puzzle me.

solardiz commented 4 years ago

@kolet Does your system have other *.icd files? If so, which ones and what's in those? Thanks!

claudioandre-br commented 4 years ago

Why are the files etc/OpenCL/vendors/*.icd read at all? These are pathnames relative to our tree, why does any library (which one?) look in there?

The file cygOpenCL-1.dll (located in ./run) reads and uses the etc/OpenCL/vendors/*.icd files.

This is the cygwin approach. Not the best one, but, since we saw above a lot of installed native .dll files failing to work properly. What else they can do if Windows packagers can't do it properly.

For example: ./run/cygOpenCL-1.dll reads (tries) etc/OpenCL/vendors/nvidia.icd loads (tries) c:\Windows\System32\nvopencl.dll and make some OpenCL calls.


It is easy to test the *.icd files. Just edit it/them and point it/them to the proper NVIDIA/Intel/AMD .dll file. I have no reasons to expect it to fail (when pointing to the right folder/file).

I used them myself, a few times.

solardiz commented 4 years ago

The file cygOpenCL-1.dll (located in ./run) reads and uses the etc/OpenCL/vendors/*.icd files.

But how? If it uses that relative pathname, then success or failure to read that file will depend on what the current directory is. Moreover, it'd be a security issue if the current directory is untrusted.

Besides, normally we suggest to run the programs while the current directory is run. When this is the case, then a working relative pathname would be like ../etc/OpenCL/vendors/*.icd, but I doubt that's what the library uses.

This is why I feel I don't grasp the full puzzle here.

claudioandre-br commented 4 years ago

Someone using an OpenCL enabled machine have to test this. Off the top of my head:

To be sure, we need to test it in a Windows machine. Can you test it @kolet?

solardiz commented 4 years ago

running JtR using CMD results in the JohntheRipper folder becoming root / directory for cygwin.

This would explain the (presumed) behavior, but I don't see why that would be the case.

I find it more likely that either this doesn't work and never worked (but this contradicts previous success reports?), or there's some magic in cygOpenCL's searching for these files (we can check this library's source code to find out).

claudioandre-br commented 4 years ago

Testing is mandatory. I used the package in a Lenovo notebook and I saw exactly this behavior.

claudioandre-br commented 4 years ago

In fact, I tested this in 2 differente notebooks.

solardiz commented 4 years ago

If I understand correctly, Cygwin uses this project's code:

https://github.com/OCL-dev/ocl-icd

patching and packaging it as specified in:

https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/ocl-icd.git;a=tree

I see nothing in there to check relative or multiple paths.

$ fgrep -r OCL_ICD_VENDORDIR .
./configure.ac:    [yes], [OCL_ICD_VENDORDIR="$sysconfdir/OpenCL/vendors"],
./configure.ac:    [no], [OCL_ICD_VENDORDIR='/etc/OpenCL/vendors'],
./configure.ac:    [OCL_ICD_VENDORDIR=$enableval])],
./configure.ac:  [OCL_ICD_VENDORDIR=/etc/OpenCL/vendors])
./configure.ac:AC_SUBST([OCL_ICD_VENDORDIR])
./configure.ac:AS_IF([test x"$OCL_ICD_VENDORDIR" = x"/etc/OpenCL/vendors" ], [
./configure.ac:  AC_MSG_NOTICE([using the official default vendors directory ($OCL_ICD_VENDORDIR)])
./configure.ac:  AC_MSG_NOTICE([using an unofficial custom default vendors directory ($OCL_ICD_VENDORDIR)])
./Makefile.am:  -DETC_OPENCL_VENDORS=\"@OCL_ICD_VENDORDIR@\"
./doc/Makefile.am:      $(AM_V_GEN)if [ "${OCL_ICD_VENDORDIR}" = '/etc/OpenCL/vendors' ]; then \
./doc/Makefile.am:          -e 's|[@]OCL_ICD_VENDORDIR@|@OCL_ICD_VENDORDIR@|g' \
./doc/libOpenCL.7.txt.in:ICD Loader looks for files into '`@OCL_ICD_VENDORDIR@`' directory
./doc/libOpenCL.7.txt.in:This variable allows one to modify the default '`@OCL_ICD_VENDORDIR@`' path.
./doc/libOpenCL.7.txt.in:  "@OCL_ICD_VENDORDIR@" path in the standard behavior: the loader will use the
./doc/libOpenCL.7.txt.in:  '`@OCL_ICD_VENDORDIR@/`'*$OCL_ICD_VENDORS* (or

Some env vars are checked, but I see no reason why they would happen to be set the way we'd have needed them for our provided ICD files directory to be found:

./ocl_icd_loader.c:             char* ocl_sort=getenv("OCL_ICD_PLATFORM_SORT");
./ocl_icd_loader.c:             const char* str=getenv("OCL_ICD_ASSUME_ICD_EXTENSION");
./ocl_icd_loader.c:  const char* dir_path=getenv("OCL_ICD_VENDORS");
./ocl_icd_loader.c:  const char* vendor_path=getenv("OPENCL_VENDOR_PATH");
./ocl_icd_loader.c:      const char *default_platform = getenv("OCL_ICD_DEFAULT_PLATFORM");

I also see no reason why a Cygwin's library's view of filesystem root directory would magically happen to be the directory one level into our extracted archive.

So we still have no explanation.

claudioandre-br commented 4 years ago

I added that to path.c (because I was this file opened).

puts("------------------------------------------------------------------------");
{
  DIR *d;
  struct dirent *dir;
  d = opendir("/");
  if (d) {
    while ((dir = readdir(d)) != NULL) {
      printf("%s\n", dir->d_name);
    }
    closedir(d);
  }
}
    puts("I did");

Then, inside CI:

------------------------------------------------------------------------
.
..
.azure
.ci
.editorconfig
.git
.gitattributes
.github
.gitignore
.mailmap
.pre-commit.sh
.travis
appveyor.yml
checksums.txt
CONTRIBUTING.md
doc
etc
lib
README.md
run
src
proc
dev
cygdrive
I did

So, that is it. JtR root folder is the root folder. Notice:

And the virtual folder (it is not a real folder).

claudioandre-br commented 4 years ago

I also tested the current folder. As expect, It is src.:

  d = opendir(".");

https://ci.appveyor.com/project/claudioandre-br/johntheripper#L1784

solardiz commented 4 years ago

Thanks, Claudio! I'm not surprised we have it like that on CI - placing our files in filesystem root - but I wonder whether/how the etc/OpenCL/vendors path would also be accessed after extracting our binary build's archive on a Windows system.

claudioandre-br commented 4 years ago

I'm not surprised we have it like that on CI - placing our files in filesystem root

It is Windows (Microsoft Windows Server 2016 Datacenter OS Version: 10.0.14393 N/A Build 14393). Windows filesystem root must have:

Where are they? Anyway, we can run all these tests as soon as we get a Windows test machine.

[edited] They are in /cygdrive/C/Windows or /cygdrive/C/Program Files.


Now:

  d = opendir("/cygdrive/C/Windows");
.
..
ADFS
appcompat
AppPatch
AppReadiness
assembly
bcastdvr
bfsvc.exe
Boot
bootstat.dat
Branding
CbsTemp
Cluster
CSC
Cursors
debug
DfsrAdmin.exe
DfsrAdmin.exe.config
diagnostics
DigitalLocker
DirectX.log
Downloaded Program Files
drivers
DtcInstall.log
dxsdkuninst.exe
ELAMBKUP
en-US
explorer.exe
Fonts
GameBarPresenceWriter
Globalization
Help
HelpPane.exe
hh.exe
iis.log
IME
ImmersiveControlPanel
INF
InfusedApps
InputMethod
Installer
L2Schemas
LiveKernelReports
Logs
lsasetup.log
Media
mib.bin
Microsoft.NET
Migration
MiracastView
ModemLogs
NetworkController
notepad.exe
OCR
ODBCINST.INI
Offline Web Pages
Panther
PCHEALTH
Performance
PFRO.log
PLA
PolicyDefinitions
prefetch
PrintDialog
Provisioning
py.exe
pyshellext.amd64.dll
pyw.exe
regedit.exe
Registration
RemotePackages
rescache
Resources
SchCache
schemas
security
ServerDataCenter.xml
ServiceProfiles
servicing
Setup
setuperr.log
ShellExperiences
SKB
SoftwareDistribution
Speech
Speech_OneCore
splwow64.exe
symbols
System
system.ini
System32
SystemApps
SystemResources
SysWOW64
TAPI
Tasks
Temp
tracing
twain_32
twain_32.dll
Vss
Web
win.ini
WindowsShell.Manifest
WindowsUpdate.log
winhlp32.exe
WinSxS
WMSysPr9.prx
write.exe
------------------------------------------------------------------------

And Now:

  d = opendir("/cygdrive/C");
$Recycle.Bin
avvm
bootmgr
BOOTNXT
cygwin
cygwin64
Documents and Settings
go
go-x86
go110
go110-x86
go111
go111-x86
go112
go112-x86
go113
go113-x86
go14
go14-x86
go15
go15-x86
go16
go16-x86
go17
go17-x86
go18
go18-x86
go19
go19-x86
inetpub
Libraries
Microsoft
mingw-w64
Miniconda
Miniconda-x64
Miniconda3
Miniconda3-x64
Miniconda34
Miniconda34-x64
Miniconda35
Miniconda35-x64
Miniconda36
Miniconda36-x64
Miniconda37
Miniconda37-x64
MongoDB
msys64
OpenSSL-v11-Win32
OpenSSL-v11-Win64
OpenSSL-v111-Win32
OpenSSL-v111-Win64
OpenSSL-Win32
OpenSSL-Win64
pagefile.sys
PerfLogs
Perl
Program Files
Program Files (x86)
ProgramData
projects
Python26
Python26-x64
Python27
Python27-x64
Python33
Python33-x64
Python34
Python34-x64
Python35
Python35-x64
Python36
Python36-x64
Python37
Python37-x64
Python38
Python38-x64
Qt
Recovery
Ruby193
Ruby200
Ruby200-x64
Ruby21
Ruby21-x64
Ruby22
Ruby22-x64
Ruby23
Ruby23-x64
Ruby24
Ruby24-x64
Ruby25
Ruby25-x64
Ruby26
Ruby26-x64
System Volume Information
Tools
Users
Windows
.
..
------------------------------------------------------------------------