1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright (c) 2018, Joyent, Inc.
26
27LIBRARY= pkcs11_kernel.a
28VERS= .1
29
30CORE_OBJECTS= \
31	kernelGeneral.o 	\
32	kernelSlottable.o 	\
33	kernelSlotToken.o 	\
34	kernelObject.o 		\
35	kernelDigest.o	 	\
36	kernelSign.o 		\
37	kernelVerify.o 		\
38	kernelDualCrypt.o 	\
39	kernelKeys.o 		\
40	kernelRand.o		\
41	kernelSession.o		\
42	kernelSessionUtil.o	\
43	kernelUtil.o		\
44	kernelEncrypt.o		\
45	kernelDecrypt.o		\
46	kernelObjectUtil.o	\
47	kernelAttributeUtil.o	\
48	kernelEmulate.o
49
50OTHER_OBJECTS = kernelSoftCommon.o
51ST_OBJECTS = softDigestUtil.o softMAC.o
52
53OBJECTS= \
54	$(CORE_OBJECTS)		\
55	$(OTHER_OBJECTS)	\
56	$(ST_OBJECTS)
57
58AESDIR=		$(SRC)/common/crypto/aes
59ARCFOURDIR=	$(SRC)/common/crypto/arcfour
60BLOWFISHDIR=	$(SRC)/common/crypto/blowfish
61DESDIR=		$(SRC)/common/crypto/des
62ECCDIR=		$(SRC)/common/crypto/ecc
63CRYPTDIR=	$(SRC)/common/crypto
64ST_DIR=		$(SRC)/lib/pkcs11/pkcs11_softtoken/common
65
66lint \
67pics/kernelAttributeUtil.o := \
68	CPPFLAGS += -I$(AESDIR) -I$(BLOWFISHDIR) -I$(ARCFOURDIR) -I$(DESDIR) \
69	-I$(ECCDIR) -I$(CRYPTDIR)
70pics/kernelKeys.o := \
71	CPPFLAGS += -I$(ECCDIR)
72pics/kernelSoftCommon.o := \
73	CPPFLAGS = -I$(ST_DIR) $(CPPFLAGS.master)
74
75include $(SRC)/lib/Makefile.lib
76
77#	set signing mode
78POST_PROCESS_SO	+=	; $(ELFSIGN_CRYPTO)
79
80SRCDIR=		../common
81CORESRCS =  \
82	$(CORE_OBJECTS:%.o=$(SRCDIR)/%.c)
83
84LIBS	=	$(DYNLIB)
85LDLIBS  +=      -lc -lcryptoutil -lmd
86
87CFLAGS  +=      $(CCVERBOSE)
88
89CERRWARN +=	$(CNOWARN_UNINIT)
90CERRWARN +=	-_gcc=-Wno-unused-label
91
92# not linted
93SMATCH=off
94
95ROOTLIBDIR=     $(ROOT)/usr/lib/security
96ROOTLIBDIR64=   $(ROOT)/usr/lib/security/$(MACH64)
97
98.KEEP_STATE:
99
100all:    $(LIBS)
101
102# we don't need to lint ST_OBJECTS since they are linted elsewhere.
103lintcheck := SRCS = $(CORESRCS)
104lintother := OSRCS = ../common/kernelSoftCommon.c
105lintother := CPPFLAGS = -I$(ST_DIR) $(CPPFLAGS.master)
106
107lintother: $$(OSRCS)
108	$(LINT.c) $(LINTCHECKFLAGS) $(OSRCS) $(LDLIBS)
109
110lint: lintcheck lintother
111
112pics/%.o:	$(ST_DIR)/%.c
113	$(COMPILE.c) -o $@ $< -I$(ST_DIR)
114	$(POST_PROCESS_O)
115
116include $(SRC)/lib/Makefile.targ
117