GPU (CUDA powered) supprt for OpenSSL Depends on: Nvidia Driver (CUDA compatible, tested on 195.36.24) CUDA Toolkit CUDA SDK ############################## OPENSSL_ROOT/crypto/engine/eng_all.c at the end of function "void ENGINE_load_builtin_engines(void)" (starts at line 62) add #----------[ ADD ]---------- ENGINE_load_gpu(); #----------[ /ADD ]---------- ############################## OPENSSL_ROOT/crypto/engine/Makefile add "eng_gpu.c" to LIBSRC and "eng_gpu.o eng_gpu.cu.o" to LIBOBJ #----------[ CHANGE ]---------- LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \ eng_table.c eng_pkey.c eng_fat.c eng_all.c \ tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \ tb_cipher.c tb_digest.c \ eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c eng_padlock.c LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \ eng_table.o eng_pkey.o eng_fat.o eng_all.o \ tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \ tb_cipher.o tb_digest.o \ eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o eng_padlock.o #----------[ TO ]---------- LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \ eng_table.c eng_pkey.c eng_fat.c eng_all.c \ tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \ tb_cipher.c tb_digest.c \ eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c eng_padlock.c eng_gpu.c LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \ eng_table.o eng_pkey.o eng_fat.o eng_all.o \ tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \ tb_cipher.o tb_digest.o \ eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o eng_padlock.o eng_gpu.o eng_gpu.cu.o #----------[ /CHANGE ]---------- Add new target. Note that "-I/opt/cuda/sdk/common/inc" should point to NVIDIAs SDK installation. NOTE! line 'nvcc -c ....' must begin with NOTE! 'cuda' MUST be before 'lib' #----------[ CHANGE ]---------- all: lib #----------[ TO ]---------- all: cuda lib cuda: nvcc -c -o eng_gpu.cu.o eng_gpu.cu -I/opt/cuda/sdk/common/inc -DUNIX -O3 --host-compilation C #----------[ /CHANGE ]---------- ############################## Copy eng_gpu.c and eng_gpu.cu files to OPENSSL_ROOT/crypto/engine ############################## OPENSSL_ROOT/crypto/evp/bio_enc.c NOTE! ENC_BLOCK_SIZE must be same as according values in eng_gpu.cu file: NUM_BLOCKS, NUM_THREADS and ROUNDS_IN_THREAD #----------[ CHANGE ]---------- #define ENC_BLOCK_SIZE (1024*4) #----------[ TO ]---------- #define ENC_BLOCK_SIZE (360 * 512 * 10 * 16) #----------[ /CHANGE ]---------- ############################## Final steps goto OPENSSL_ROOT directory For testing author suggests make non-system install, therefore is needed to define new install directory and needed libraries NOTE: change --openssldir value as you need, openssl will be installed there $ ./config -L/usr/local/cuda/lib -lcuda -lcudart --openssldir=~/gpu/openssl/install $ make depend $ make $ make install # example run ~/gpu/openssl/install/bin/openssl aes-128-ecb -bufsize 29491200 -engine gpu -in generated.dat -out data.gpu -k abcd -nosalt