forked from zoogie/bfCL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changes to code and build system for Linux support. - Makefile was altered to support the dynamic OpenCL lib with the default path for Ubuntu's ocl-icd-opencl-dev apt package. - Various changes in the source code to resolve -Wall -Werror build errors using cc 7.2.0. * Remove beginning newlines from affected .c and .cl source files * Include stdlib.h instead of malloc.h in ocl_util.c This allows compilation on macOS * Implement full macOS support * Include better compiling instructions and add some comments to the Makefile * Forgot to add an extra newline in the README * Fix two comments inside of the Makefile * Edit comments in Makefile * Edit comments in Makefile... again * Edit Makefile to provide proper static linking instructions * Minor edits to utils.c * Match wording in README * Better comments in Makefile * Small fix-ups in Makefile * Spelling correction * Update README.md * Edit some Makefile comments * Oops * Improve compiling instructions * Simple fix * Make sure output buffers are flushed
- Loading branch information
Showing
25 changed files
with
94 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
# only tested in mingw | ||
PNAME = bfcl | ||
OBJS = $(PNAME).o ocl_util.o utils.o sha1_16.o aes_128.o ocl_test.o ocl_brute.o | ||
CFLAGS += -std=c11 -Wall -Werror -O2 -mrdrnd -I$(INTELOCLSDKROOT)/include | ||
LDFLAGS += -L$(INTELOCLSDKROOT)/lib/x64 | ||
ifdef SYSTEMROOT | ||
# Intel's OpenCL SDK installer sets an environmental variable on Windows. | ||
CFLAGS += -std=c11 -Wall -Werror -O2 -mrdrnd -I$(INTELOCLSDKROOT)\include | ||
LDFLAGS += -L$(INTELOCLSDKROOT)\lib\x64 | ||
else | ||
ifeq ($(shell uname), Linux) | ||
# Intel's OpenCL SDK installer doesn't set an environmenr variable on Linux, so we'll have to specify its default installation location instead. | ||
CFLAGS += -std=c11 -Wall -Werror -O2 -mrdrnd -I/opt/intel/opencl-sdk/include | ||
LDFLAGS += -L/opt/intel/opencl-sdk/lib64 | ||
endif | ||
ifeq ($(shell uname), Darwin) | ||
# macOS's "ld" likes to warn you about library dirs not being found. That being said, macOS includes its own implementation of OpenCL. | ||
CFLAGS += -std=c11 -Wall -Werror -O2 -mrdrnd | ||
endif | ||
endif | ||
|
||
all : $(PNAME) | ||
all: $(PNAME) | ||
|
||
$(PNAME) : $(OBJS) | ||
$(CC) $(LDFLAGS) -o $@ $^ -lOpenCL -static -lmbedcrypto | ||
|
||
clean : | ||
rm $(PNAME) *.o | ||
$(PNAME): $(OBJS) | ||
ifeq ($(shell uname), Darwin) | ||
$(CC) -o $@ $^ -framework OpenCL -lmbedcrypto | ||
# If you want to use the mbedcrypto static library instead (on macOS), change "-lmbedcrypto" to "/usr/local/lib/libmbedcrypto.a" (or wherever else it may be) with the quotes. | ||
else | ||
$(CC) $(LDFLAGS) -o $@ $^ -lOpenCL -lmbedcrypto | ||
# If you want to use the mbedcrypto static library instead (whether you're using MSYS2 or are on Linux), change "-lmbedcrypto" to "-l:libmbedcrypto.a" without the quotes. | ||
# Note: Ubuntu (probably Debian as well) doesn't install "libmbedcrypto.a" through apt-get, thus you would have to compile mbedtls yourself. | ||
endif | ||
|
||
clean: | ||
rm -f $(PNAME) *.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,42 @@ | ||
# bfCL | ||
This is an experimental port of [TWLbf](https://github.com/Jimmy-Z/TWLbf) to OpenCL. | ||
This is an experimental port of [TWLbf](https://github.com/Jimmy-Z/TWLbf/) to OpenCL. | ||
|
||
### Compile | ||
Only tested with [mingw-w64-x86_64](https://mingw-w64.org/) | ||
/[MSYS2](http://www.msys2.org/) | ||
(and occasionally Visual Studio 2017 Community) and Intel OpenCL SDK. | ||
## Compile | ||
### Windows | ||
Note: If you really want to use Virtual Studio 2017, you're going to probably have to change the Makefile a bit and compile [mbedtls](https://github.com/ARMmbed/mbedtls/) from source. | ||
#### Requirements for compiling with MSYS2 | ||
* **A 64-bit computer** | ||
* [MSYS2](http://www.msys2.org/) (the x86_64 executable; **read its instructions on installing and setting up**) | ||
* An `OpenCL.dll` or `OpenCL.lib` 64-bit library | ||
|
||
### License | ||
Note: `OpenCL.dll` can be found inside of your `C:\Windows\System32\` folder, but you may have to install your graphics card's drivers from your graphics card's vendor if it's not there. | ||
You can alternatively install [Intel's OpenCL SDK](https://software.intel.com/intel-opencl/), but this requires you to agree to their TOS and takes up more space on your computer. | ||
#### Instructions for compiling with MSYS2 | ||
1. Close any open instances of MSYS2 (if applicable), then launch the `MSYS2 MinGW 64-bit` shortcut from the Windows Start Menu. | ||
1. In the MSYS2 bash shell that appears, execute `pacman -Syu --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-mbedtls git` to download and install required packages. | ||
1. If you're going to use the `OpenCL.dll` 64-bit library from your `C:\Windows\System32\` folder (in contrast to installing Intel's OpenCL SDK), copy it into your `msys64/mingw64/lib/` folder (your `msys64` folder is by default installed onto the root of your "C:" drive during the installation of MSYS2). Additionally, if you're going to use `OpenCL.dll`, in MSYS2, execute `git clone https://github.com/KhronosGroup/OpenCL-Headers.git && mv OpenCL-Headers/CL /mingw64/include/` to download and move the required OpenCL C headers folder. | ||
1. In MSYS2, execute `git clone https://github.com/zoogie/bfCL.git && cd bfCL` to download bfCL and change your current directory to it. | ||
1. In MSYS2, execute `mingw32-make` to compile bfCL (**OpenCL and mbedcrypto will both be dynamically linked!** Refer to the Makefile if you want to statically link mbedcrypto instead). | ||
### Linux | ||
#### Requirements for compiling on all Linux distros | ||
* **A 64-bit computer** | ||
#### Instructions for compiling on Debian-based Linux distros | ||
Note: the **concept** is still applicable for all other Linux distros; e.g., some packages may have different names. | ||
1. Open up the "Terminal" application. | ||
1. In "Terminal", execute `sudo apt-get update && sudo apt-get install gcc git libmbedtls-dev make ocl-icd-opencl-dev` to download and install required packages (note that the "ocl-icd-opencl-dev" package includes both the OpenCL C headers and the OpenCL ICD Loader library). | ||
1. After all of the packages have finished installing, in "Terminal", execute `git clone https://github.com/zoogie/bfCL.git && cd bfCL` to download bfCL and change your current directory to it. | ||
1. In "Terminal", execute `make` to compile bfCL (**OpenCL and mbedcrypto will both be dynamically linked!** Refer to the Makefile if you want to statically link mbedcrypto instead). | ||
### macOS | ||
#### Requirements for compiling on macOS | ||
* **An Intel-based 64-bit computer** | ||
* [Homebrew](https://brew.sh/) (**Read its instructions on installing**; installing Homebrew also installs Xcode command-line tools, which is also needed) | ||
#### Instructions for compiling on macOS | ||
1. Open up the "Terminal" application through Launchpad. | ||
1. In "Terminal", execute `brew update && brew install git mbedtls` to download and install required packages. | ||
1. In "Terminal", execute `git clone https://github.com/zoogie/bfCL.git && cd bfCL` to download bfCL and change your current directory to it. | ||
1. In "Terminal", execute `make` to compile bfCL (**OpenCL and mbedcrypto will both be dynamically linked!** Refer to the Makefile if you want to statically link mbedcrypto instead). | ||
|
||
## License | ||
AES and SHA1 code from [mbed TLS](https://github.com/ARMmbed/mbedtls/) which is Apache 2.0 license, | ||
so I guess this project becomes Apache 2.0 licensed automatically? | ||
or only related files are Apache 2.0? I'm not sure. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include "utils.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#ifdef BCD | ||
|
||
inline u64 to_dsi_bcd(u64 i) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#pragma once | ||
|
||
// definition in sha1_16.c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.