Skip to content

Commit

Permalink
Initial commit of Intel* QuickAssist Technology engine for OpenSSL-1.1.0
Browse files Browse the repository at this point in the history
supporting the asynchronous JOB infrastructure.

*Intel is a trademark registered in the US Patent and Trademark office
  • Loading branch information
agrandi committed May 13, 2016
1 parent e00dfa9 commit fa130f9
Show file tree
Hide file tree
Showing 46 changed files with 16,200 additions and 1 deletion.
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Object files
*.o
*.obj

# editor artefacts
*.swp
.#*
\#*#
*~
/.dir-locals.el

# Top level excludes
/Makefile.bak
/Makefile
/MINFO
/TABLE
/*.a
/*.pc
/inc.*
/makefile.*
/out.*
/tmp.*

# Certificate symbolic links
*.0

# Auto generated assembly language source files
*.s
!/crypto/*/asm/*.s
/crypto/arm*.S
/crypto/*/*.S
*.asm
!/crypto/*/asm/*.asm

*.so*
*.dylib*
*.dll*
*.exe


# Misc auto generated files
lib
Makefile.save
*.bak
tags
TAGS
cscope.out
*.d

# Windows
/tmp32
/tmp32.dbg
/tmp32dll
/tmp32dll.dbg
/out32
/out32.dbg
/out32dll
/out32dll.dbg
/inc32
/MINFO
ms/bcb.mak
ms/libeay32.def
ms/nt.mak
ms/ntdll.mak
ms/ssleay32.def
ms/version32.rc

31 changes: 31 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

BSD LICENSE

Copyright(c) 2016 Intel Corporation.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Intel Corporation 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"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 THE COPYRIGHT
OWNER OR CONTRIBUTORS 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.
257 changes: 257 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
# CC contains the current compiler
CC = cc

# ICP_ROOT (mandatory) contains the path of the QAT package
ifndef ICP_ROOT
$(error Env variable ICP_ROOT must be set)
endif

# OPENSSL_ENGINES (mandatory) contains the path of where
# OpenSSL engines were installed to
ifndef OPENSSL_ENGINES
$(error Env variable OPENSSL_ENGINES must be set)
endif

# OPENSSL_ROOT (optional) contains the path of OpenSSL
# If the variable is not set, we assume the QAT engine is built
# from ./engines/qat_engine
ifdef OPENSSL_ROOT
TOP = $(OPENSSL_ROOT)
else
TOP = ../..
endif

INCLUDES = -I$(TOP)/include -I$(TOP)

# -fPIC is required to build as shared lib
CFLAG = -fPIC

ifeq ($(MAKEFILE),)
MAKEFILE := Makefile
endif

# CFLAGS contains flags and include paths for the compiler
CFLAGS += $(INCLUDES) $(CFLAG)


# QAT_FLAGS is an optional variable used for QAT specific build flags
ifdef QAT_FLAGS
CFLAGS += $(QAT_FLAGS)
endif


ifdef CMN_ROOT
CRYPTO_MEMORY_DRIVER = qae_mem
else
ifdef MULTI_THREAD_MEMUTILS
CRYPTO_MEMORY_DRIVER = multi_thread
else
CRYPTO_MEMORY_DRIVER = qat_contig_mem
endif
endif

ifeq ($(CRYPTO_MEMORY_DRIVER),qat_contig_mem)
CFLAGS += -DUSE_QAT_CONTIG_MEM -Iqat_contig_mem
endif
ifeq ($(CRYPTO_MEMORY_DRIVER),multi_thread)
CFLAGS += -DUSE_QAT_CONTIG_MEM -Iqat_contig_mem
endif
ifeq ($(CRYPTO_MEMORY_DRIVER),qae_mem)
CFLAGS += -DUSE_QAE_MEM
INCLUDES += -I./
INCLUDES += -I$(CMN_ROOT)
endif

# Include path for Intel QAT API
ifdef ICP_API_PATH
ICP_API_DIR = $(ICP_API_PATH)
else
ICP_API_DIR = ${ICP_ROOT}/quickassist/include
endif

ifdef ICP_SAL_API_PATH
ICP_SAL_API_DIR = $(ICP_SAL_API_PATH)
else
ICP_SAL_API_DIR = $(ICP_ROOT)/quickassist/lookaside/access_layer/include
endif

ICP_LAC_API_DIR = $(ICP_API_DIR)/lac

# QAT Driver
INCLUDES += -I$(ICP_API_DIR) -I$(ICP_LAC_API_DIR) -I$(ICP_SAL_API_DIR)
DRIVER = icp_qa_al
ifdef WITH_CPA_MUX
ICP_MUX_DIR = $(ICP_ROOT)/../QAT1.5/quickassist/include
ICP_DC_DIR = $(ICP_API_DIR)/dc
CFLAGS += -DWITH_CPA_MUX
INCLUDES += -I$(ICP_MUX_DIR) -I$(ICP_DC_DIR)
DRIVER = qat_mux
endif

# Source files that are shared between the 2 mem drivers
QAT_LIB_SRC_COMMON = e_qat.c\
qat_utils.c\
qat_ciphers.c\
qat_rsa.c\
qat_dsa.c\
qat_dh.c\
qat_ec.c\
qat_asym_common.c\
e_qat_err.c\
qat_parseconf.c\
qat_prf.c

QAT_LIB_OBJ_COMMON = e_qat.o\
qat_utils.o\
qat_ciphers.o\
qat_rsa.o\
qat_dsa.o\
qat_dh.o\
qat_ec.o\
qat_asym_common.o\
e_qat_err.o\
qat_parseconf.o\
qat_prf.o

ifeq ($(CRYPTO_MEMORY_DRIVER),qat_contig_mem)
QAT_LIB_SRC = $(QAT_LIB_SRC_COMMON) qae_mem_utils.c
QAT_LIB_OBJ = $(QAT_LIB_OBJ_COMMON) qae_mem_utils.o
QAT_MEMLIB_OBJ = qae_mem_utils.o
QAT_MEMLIB_NAME = libqae_mem_utils
QAT_MEMLIB_DEPS =
endif
ifeq ($(CRYPTO_MEMORY_DRIVER),multi_thread)
QAT_LIB_SRC = $(QAT_LIB_SRC_COMMON) multi_thread_qaememutils.c
QAT_LIB_OBJ = $(QAT_LIB_OBJ_COMMON) multi_thread_qaememutils.o
QAT_MEMLIB_OBJ = multi_thread_qaememutils.o
QAT_MEMLIB_NAME = libmulti_thread_qaememutils
QAT_MEMLIB_DEPS =
endif
ifeq ($(CRYPTO_MEMORY_DRIVER),qae_mem)
QAT_LIB_SRC = $(QAT_LIB_SRC_COMMON) cmn_mem_drv_inf.c
QAT_LIB_OBJ = $(QAT_LIB_OBJ_COMMON) cmn_mem_drv_inf.o
QAT_MEMLIB_OBJ = cmn_mem_drv_inf.o
QAT_MEMLIB_NAME = libcmn_mem_drv_inf
QAT_MEMLIB_DEPS =
endif

SRC = $(QAT_LIB_SRC)
QAT_LIB_TARGET = $(TOP)/libcrypto.a

ifdef ICP_BUILD_OUTPUT
QAT_SHARED_LIB_DEPS = -Wl,-rpath,$(ICP_BUILD_OUTPUT) -L$(ICP_BUILD_OUTPUT) -l$(DRIVER)_s
else
QAT_SHARED_LIB_DEPS = -l$(DRIVER)_s
endif

ifeq ($(CRYPTO_MEMORY_DRIVER),qat_contig_mem)
QAT_SHARED_LIB_DEPS += -L. -lqae_mem_utils
endif
ifeq ($(CRYPTO_MEMORY_DRIVER),multi_thread)
QAT_SHARED_LIB_DEPS += -L. -lmulti_thread_qaememutils
endif
ifeq ($(CRYPTO_MEMORY_DRIVER),qae_mem)
QAT_SHARED_LIB_DEPS += -Wl,-rpath,$(CMN_ROOT) -L$(CMN_ROOT) -lqae_mem_s
QAT_SHARED_LIB_DEPS += -L. -lcmn_mem_drv_inf
endif

QAT_LIB_NAME = qat

.PHONEY: all lib


all: errors lib

tags:
ctags $(SRC)

errors:
perl $(TOP)/util/mkerr.pl -conf e_qat.ec -nostatic -write $(SRC)


SHLIB_TARGET = gnu

lib: $(QAT_LIB_OBJ) $(QAT_MEMLIB_OBJ)
$(MAKE) -f $(TOP)/Makefile.shared -e \
LIBNAME=$(QAT_MEMLIB_NAME) \
LIBEXTRAS='$(QAT_MEMLIB_OBJ)' \
LIBDEPS='$(QAT_MEMLIB_DEPS)' \
link_dso.$(SHLIB_TARGET); \
$(MAKE) -f $(TOP)/Makefile.shared -e \
LIBNAME=$(QAT_LIB_NAME) \
LIBEXTRAS='$(QAT_LIB_OBJ_COMMON)' \
LIBDEPS='$(QAT_SHARED_LIB_DEPS)' \
link_dso.$(SHLIB_TARGET); \



install:
set -e; \
echo Installing $(QAT_LIB_NAME); \
cp $(QAT_LIB_NAME).so $(OPENSSL_ENGINES)/$(QAT_LIB_NAME).so; \
cp $(QAT_MEMLIB_NAME).so $(OPENSSL_ENGINES)/../$(QAT_MEMLIB_NAME).so; \
chmod 555 $(OPENSSL_ENGINES)/$(QAT_LIB_NAME).so; \
chmod 555 $(OPENSSL_ENGINES)/../$(QAT_MEMLIB_NAME).so

qae_mem_utils.o: qae_mem_utils.c
$(CC) $(CFLAGS) -c -o qae_mem_utils.o qae_mem_utils.c

cmn_mem_drv_inf.o: cmn_mem_drv_inf.c
$(CC) $(CFLAGS) -c -o cmn_mem_drv_inf.o cmn_mem_drv_inf.c


links:


tests:


# This variables are copied from the Makefile of OpenSSL
MAKEDEPPROG = gcc
MAKEDEPEND = $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
DEPFLAG =

# The script /util/domd requires a valid value for the env variable PERL
depend: errors
export PERL=perl; \
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(QAT_LIB_SRC);


files:



lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff


dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)

clean:
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff *.so *.sl *.dll e_qat_err.*

# DO NOT DELETE THIS LINE -- make depend depends on it.

e_qat.o: e_qat.c e_qat.h e_qat_err.h qat_ciphers.h qat_dh.h
e_qat.o: qat_dsa.h qat_ec.h qat_parseconf.h qat_rsa.h qat_prf.h
e_qat.o: qat_utils.h
e_qat_err.o: e_qat_err.c e_qat_err.h
qae_mem_utils.o: qae_mem_utils.c qae_mem_utils.h
qat_asym_common.o: e_qat.h qat_asym_common.c qat_asym_common.h qat_ciphers.h
qat_asym_common.o: qat_utils.h
qat_ciphers.o: e_qat.h e_qat_err.h qat_ciphers.c qat_ciphers.h
qat_ciphers.o: qat_utils.h
qat_dh.o: e_qat.h e_qat_err.h qat_asym_common.h qat_ciphers.h qat_dh.c qat_dh.h
qat_dh.o: qat_utils.h
qat_dsa.o: e_qat.h e_qat_err.h qat_asym_common.h qat_ciphers.h qat_dsa.c
qat_dsa.o: qat_dsa.h qat_utils.h
qat_ec.o: e_qat.h e_qat_err.h qat_asym_common.h qat_ciphers.h qat_ec.c qat_ec.h
qat_ec.o: qat_utils.h
qat_parseconf.o: qat_parseconf.c qat_parseconf.h qat_utils.h
qat_rsa.o: e_qat.h e_qat_err.h qat_asym_common.h qat_ciphers.h qat_rsa.c
qat_rsa.o: qat_rsa.h qat_utils.h
qat_prf.o: e_qat.h e_qat_err.h qat_asym_common.h qat_prf.c
qat_prf.o: qat_prf.h qat_utils.h
qat_utils.o: e_qat.h qat_ciphers.h qat_utils.c qat_utils.h
Loading

0 comments on commit fa130f9

Please sign in to comment.