forked from lwakefield/libgpucrypto
-
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.
- Loading branch information
lawrence
authored and
lawrence
committed
May 13, 2015
0 parents
commit 0b97f28
Showing
49 changed files
with
12,158 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
GeForce GT 415M 0x0dee | ||
GeForce GT 420 0x0de2 | ||
GeForce GT 420M 0x0df1 | ||
GeForce GT 420M 0x0df3 | ||
GeForce GT 425M 0x0df0 | ||
GeForce GT 430 0x0de1 | ||
GeForce GT 435M 0x0df2 | ||
GeForce GT 440 0x0dc0 | ||
GeForce GT 440 0x0de0 | ||
GeForce GT 445M 0x0dd2 | ||
GeForce GT 520 0x1040 | ||
GeForce GT 520M 0x0df7 | ||
GeForce GT 520M 0x1050 | ||
GeForce GT 525M 0x0dec | ||
GeForce GT 525M 0x0df5 | ||
GeForce GT 530 0x0de5 | ||
GeForce GT 550M 0x0dd6 | ||
GeForce GT 550M 0x0df6 | ||
GeForce GT 555M 0x0dcd | ||
GeForce GTS 450 0x0dc4 | ||
GeForce GTS 450 0x1245 | ||
GeForce GTX 460 0x0e22 | ||
GeForce GTX 460 0x0e24 | ||
GeForce GTX 460 SE 0x0e23 | ||
GeForce GTX 460M 0x0dd1 | ||
GeForce GTX 465 0x06c4 | ||
GeForce GTX 470 0x06cd | ||
GeForce GTX 470M 0x0e30 | ||
GeForce GTX 480 0x06c0 | ||
GeForce GTX 480M 0x06ca | ||
GeForce GTX 485M 0x0e31 | ||
GeForce GTX 550 Ti 0x1244 | ||
GeForce GTX 560 Ti 0x1082 | ||
GeForce GTX 560 Ti 0x1200 | ||
GeForce GTX 570 0x1081 | ||
GeForce GTX 580 0x1080 | ||
GeForce GTX 590 0x1088 | ||
Tesla C2050 / C2070 0x06d1 | ||
Tesla C2070 0x0772 | ||
Tesla C2070 0x0772 | ||
Tesla C2075 0x1096 | ||
Tesla M2050 0x06de | ||
Tesla M2050 0x077a | ||
Tesla M2050 0x082f | ||
Tesla M2050 0x0843 | ||
Tesla M2050 0x0846 | ||
Tesla M2070 0x06d2 | ||
Tesla M2070-Q 0x06df | ||
Tesla M2075 0x1094 | ||
Tesla M2090 0x1091 |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
SSLShader has been developed at the Computer Science and | ||
Electrical Engineering Departments at KAIST by | ||
Keon Jang <keonjang@an.kaist.ac.kr>, Sangjin Han <sangjin@an.kaist.ac.kr>, | ||
Seungyeop Han <syhan@cs.washington.edu>, Sue Moon<sbmoon@kaist.edu>, | ||
and KyoungSoo Park<kyoungsoo@ee.kaist.ac.kr>. | ||
|
||
|
||
Copyright (c) 2011, KAIST All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. All advertising materials mentioning features or use of this software | ||
must display the following acknowledgement: | ||
This product includes software developed by the KAIST. | ||
4. Neither the name of the KAIST nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY KAIST ''AS IS'' AND ANY | ||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL KAIST BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
Unless otherwise noted, all codes are licensed under the above License. | ||
you may not use this file except in compliance with the License. | ||
you may obtain copy of the License at | ||
|
||
http://shader.kaist.edu/sslshader/LICENSE | ||
|
||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on as "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language govnerning permissions and | ||
limitations under the License. |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
GPUCRYPTO_DIR = ./ | ||
|
||
include Makefile.in | ||
|
||
OBJS_DIR = objs | ||
TARGET_DIR = lib | ||
TARGET_FILE = libgpucrypto.a | ||
TARGET = $(addprefix $(TARGET_DIR)/, $(TARGET_FILE)) | ||
|
||
.SUFFIXES : .cu .cc .o | ||
|
||
CU_SRC_FILES = $(wildcard *.cu) | ||
CC_SRC_FILES = $(wildcard *.cc) | ||
HEADER_FILES = $(wildcard *.hh) $(wildcard *.h) | ||
|
||
SRC_FILES = $(CU_SRC_FILES) $(CC_SRC_FILES) | ||
OBJS_FILE = $(CU_SRC_FILES:.cu=.o) $(CC_SRC_FILES:.cc=.o) | ||
|
||
OBJS = $(addprefix $(OBJS_DIR)/, $(OBJS_FILE)) | ||
DEPS = Makefile.dep | ||
|
||
all: $(TARGET) test | ||
|
||
$(TARGET): $(DEPS) $(OBJS) | $(TARGET_DIR) $(OBJS_DIR) | ||
ar rcs $@ $(OBJS) | ||
|
||
$(TARGET_DIR): | ||
mkdir $(TARGET_DIR) | ||
|
||
$(OBJS_DIR): | ||
mkdir $(OBJS_DIR) | ||
|
||
$(DEPS): $(SRC_FILES) $(HEADER_FILES) | ||
$(CC) -MM -MP -x c++ $(CU_SRC_FILES) $(CC_SRC_FILES) | sed 's![^:]*.o:!objs/&!g' > Makefile.dep | ||
|
||
$(OBJS_DIR)/%.o : %.cc | ||
$(CC) $(CFLAGS) $(INC) $(NVINC) -c $< -o $@ | ||
|
||
$(OBJS_DIR)/%.o : %.cu | ||
$(NVCC) $(NVCFLAGS) $(NVINC) -c $< -o $@ | ||
|
||
.PHONY : test clean doc | ||
|
||
test: $(TARGET) | ||
make -C ./test | ||
|
||
clean: | ||
rm -f $(TARGET) $(OBJS) $(DEPS) | ||
make clean -C ./test | ||
|
||
doc: $(SRC_FILES) doxygen.config | ||
doxygen doxygen.config | ||
|
||
ifneq ($(MAKECMDGOALS), clean) | ||
-include $(DEPS) | ||
endif |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
objs/rsa_context.o: rsa_context.cc rsa_context.hh | ||
|
||
rsa_context.hh: | ||
objs/rsa_context_rns.o: rsa_context_rns.cc rsa_context_rns.hh rsa_context.hh \ | ||
rsa_cuda.h bn_kn.h | ||
|
||
rsa_context_rns.hh: | ||
|
||
rsa_context.hh: | ||
|
||
rsa_cuda.h: | ||
|
||
bn_kn.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#modify directory configuration below to match your configuration \ | ||
if you want use system default openssl-dev installation then comment out the OPENSSL_DIR line | ||
OPENSSL_DIR = /usr/local/ssl | ||
CUDA_TOOLKIT_DIR = /usr/local/cuda | ||
CUDA_SDK_DIR = /home/$(USER)/NVIDIA_GPU_Computing_SDK | ||
|
||
#openssl config | ||
ifneq ($(OPENSSL_DIR), ) | ||
OPENSSL_LIBDIR = -L$(OPENSSL_DIR)/lib64 | ||
OPENSSL_INCDIR = -I$(OPENSSL_DIR)/include | ||
endif | ||
OPENSSL_LIB = -lcrypto | ||
|
||
#generic config | ||
CC = g++ | ||
CFLAGS = -O2 -g -Wall | ||
INC = $(OPENSSL_INCDIR) | ||
|
||
#CUDA related config | ||
NVCC = nvcc | ||
NVCFLAGS= --ptxas-options=-v -O2 --use_fast_math | ||
NVINC = -I/usr/local/cuda/include -I$(CUDA_SDK_DIR)/C/common/inc | ||
|
||
CUDA_LIBDIR = -L$(CUDA_TOOLKIT_DIR)/lib64 -L$(CUDA_SDK_DIR)/C/lib | ||
CUDA_LIBS = -lcudart | ||
|
||
#below lines automatically detects the fermi devices using lspci command | ||
#if any CUDA device that supports architecture 2.x is detected, | ||
#then it enables use of 64-bit integer for RSA and generate compute_20 code. | ||
#you can manually set IS_FERMI value below if it does not automatically detect your fermi device. | ||
#read FERMI_DEVICES file for supported cards list. | ||
CUDA_DEVICE_IDS = $(shell cat $(GPUCRYPTO_DIR)FERMI_DEVICES | sed "s/^.*0x//g" | awk '{print "10de:"$$1}') | ||
IS_FERMI = $(foreach DEVID, $(CUDA_DEVICE_IDS), $(shell lspci -nn | grep -q $(DEVID) && echo "1")) | ||
|
||
ifneq (,$(findstring 1,$(IS_FERMI))) | ||
NVCFLAGS += -DMP_USE_64BIT=1 -gencode arch=compute_20,code=sm_20 | ||
CFLAGS += -DMP_USE_64BIT=1 | ||
else | ||
NVCFLAGS += -DMP_USE_64BIT=0 -gencode arch=compute_12,code=sm_12 | ||
CFLAGS += -DMP_USE_64BIT=0 | ||
endif | ||
|
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 |
---|---|---|
@@ -0,0 +1,117 @@ | ||
GENERAL | ||
======= | ||
libgpucrypto is subset of SSLShader software that implements | ||
few cryptographic algorithms: AES, SHA1, RSA using CUDA. | ||
This code is distributed under BSD-style license. | ||
Read LICENSE for more details. | ||
|
||
It requires CUDA 1.2 or above capable devices. | ||
We have tested our code on GTX285, GTX480, and GTX580. | ||
|
||
Below is the machine specification we used for the test. | ||
|
||
CPU: Intel X5650 2.66Ghz x 2 | ||
M/B: Super Micro X8DAH | ||
RAM: DDR3 4GB x 6 | ||
|
||
libgpucrypto is developed under Linux environment, | ||
and it is dependent on CUDA and OpenSSL. | ||
We have tesed our code on CUDA 3.2 and 4.0 | ||
along with OpenSSL 1.0.0 (Mar 29, 2010). | ||
Below, we list versions of software that we have tested. | ||
|
||
* CUDA 4.0 | ||
CUDA driver : 270.41.19 | ||
CUDA toolkit : 4.0.17 | ||
CUDA SDK : 4.0.17 | ||
|
||
* CUDA 3.2 | ||
CUDA driver : 260.19.26 | ||
CUDA toolkit : 3.2.16 | ||
CUDA SDK : 3.2.16 | ||
|
||
* O/S | ||
Ubuntu 10.04 LTS 64bit | ||
|
||
We never tested our code on other Linux distributions nor 32 bit systems. | ||
Please do not ask for help on distribution specific issues. | ||
|
||
|
||
SETUP | ||
===== | ||
|
||
1) install required libraries | ||
you can download CUDA stuff at | ||
http://developer.nvidia.com/cuda-toolkit-40 | ||
|
||
2) install OpenSSL libraries and headers | ||
you can download OpenSSL at | ||
http://openssl.org/source/ | ||
|
||
3) configure following variables in Makefile.in | ||
OPENSSL_DIR | ||
CUDA_TOOLKIT_DIR | ||
CUDA_SDK_DIR | ||
|
||
if you're using system default opeenssl development library, | ||
then you can leave it as blank. | ||
|
||
4) build libgpucrypto | ||
make | ||
|
||
5) try running test code | ||
|
||
examples) | ||
#./bin/aes_test -m ENC | ||
#./bin/rsa_test -m MP | ||
#./bin/sha_test | ||
|
||
you can see more detailed usage by running program w/o arguments or w/ incorrect one :). | ||
|
||
|
||
HOW TO USE | ||
========== | ||
Please see test folder for example codes that uses libgpucrypto. | ||
Using this code requires some prior knowledge on CUDA programming and | ||
GPU codes are written in a way to optimize performance rather than usability, | ||
and the data structure it's API receives is quite complex to document. | ||
Please see below functions and codes for how to use GPU library. | ||
|
||
RSA: rsa_test.cc: test_latency_rsa | ||
AES: aes_test.cc: test_latency_ase_cbc_encrypt, test_latency_aes_cbc_decrypt | ||
SHA1: sha_test.cc: test_latency_hmac_sha1 | ||
|
||
AES and SHA1 test codes have a function to transform | ||
somewhat human friendly data structure to GPU code's structure. | ||
See aes_cbc_encrypt_prepare, aes_cbc_decrypt_prepare, and hmac_sha1_prepare | ||
to better understand the exact data structure used for GPU code. | ||
|
||
|
||
NOTE | ||
==== | ||
* Support for multi-threaded applications | ||
Sharing a device context between threads does not work | ||
CUDA 3.2 or earlier versions. | ||
CUDA 4.0 supports sharing GPU context among multiple threads, | ||
but we have not tested this capability with our code. | ||
|
||
* 64-bit native integer arithmetic for RSA | ||
RSA codes exploits 64-bit native integer support in CUDA 2.x devices. | ||
Use of 64-bit native integer or not is decided during build process. | ||
If you have CUDA 2.x device, and our codes does not utilize it correctly, | ||
then you may fix it by modifying IS_FERMI variable in Makefile.in file. | ||
|
||
* Alignment issue | ||
AES and SHA1 GPU codes can handle non multiple of 16 bytes data, | ||
however input data should be aligned before passed into GPU. | ||
The current test code that we provide do not deal with it, | ||
and will not work correctly if you try non-multiple of 16 bytes. | ||
|
||
|
||
CONTACTS | ||
======== | ||
More information about the project is available at | ||
http://shader.kaist.edu/sslshader | ||
|
||
If you have trouble using the library | ||
please contact us at tengig@an.kaist.ac.kr. |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# libgpucrypto | ||
|
||
I did not write this, nor do I maintain a fork of this code. | ||
|
||
It took me a long time to find this code, as the original authors no longer share the source-code, however the license explicitly allows redistribution. | ||
|
||
As a result of the above, I ham placing this code back in the public domain, in hopes that others can benefit. |
Oops, something went wrong.