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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24# Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
25# Copyright 2018, Joyent, Inc.
26#
27# lib/pkcs11/pkcs11_softtoken/Makefile.com
28#
29
30LIBRARY = pkcs11_softtoken.a
31VERS= .1
32
33LCL_OBJECTS = \
34	softGeneral.o		\
35	softSlotToken.o	\
36	softSession.o		\
37	softObject.o		\
38	softDigest.o		\
39	softSign.o		\
40	softVerify.o		\
41	softDualCrypt.o	\
42	softKeys.o		\
43	softRand.o		\
44	softSessionUtil.o	\
45	softDigestUtil.o	\
46	softAttributeUtil.o	\
47	softObjectUtil.o	\
48	softDESCrypt.o		\
49	softEncrypt.o		\
50	softDecrypt.o		\
51	softEncryptUtil.o	\
52	softDecryptUtil.o	\
53	softSignUtil.o		\
54	softVerifyUtil.o	\
55	softMAC.o		\
56	softRSA.o		\
57	softKeysUtil.o		\
58	softARCFourCrypt.o	\
59	softDSA.o		\
60	softDH.o		\
61	softAESCrypt.o		\
62	softKeystore.o		\
63	softKeystoreUtil.o	\
64	softSSL.o		\
65	softASN1.o		\
66	softBlowfishCrypt.o	\
67	softEC.o
68
69ASFLAGS = $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS)
70
71ECC_COBJECTS = \
72	ec.o ec2_163.o ec2_mont.o ecdecode.o ecl_mult.o ecp_384.o \
73	ecp_jac.o ec2_193.o ecl.o ecp_192.o ecp_521.o \
74	ecp_jm.o ec2_233.o ecl_curve.o ecp_224.o ecp_aff.o ecp_mont.o \
75	ec2_aff.o ec_naf.o ecl_gf.o ecp_256.o oid.o secitem.o \
76	ec2_test.o ecp_test.o
77
78MPI_COBJECTS = mp_gf2m.o mpi.o mplogic.o mpmontg.o mpprime.o
79RNG_COBJECTS = fips_random.o
80
81ECC_OBJECTS = $(ECC_COBJECTS) $(ECC_PSR_OBJECTS)
82MPI_OBJECTS = $(MPI_COBJECTS) $(MPI_PSR_OBJECTS)
83RNG_OBJECTS = $(RNG_COBJECTS)
84BER_OBJECTS = bprint.o decode.o encode.o io.o
85
86OBJECTS = \
87	$(LCL_OBJECTS)		\
88	$(MPI_OBJECTS)		\
89	$(RNG_OBJECTS)		\
90	$(BIGNUM_OBJECTS)       \
91	$(BER_OBJECTS)		\
92	$(ECC_OBJECTS)
93
94AESDIR=         $(SRC)/common/crypto/aes
95BLOWFISHDIR=    $(SRC)/common/crypto/blowfish
96ARCFOURDIR=     $(SRC)/common/crypto/arcfour
97DESDIR=         $(SRC)/common/crypto/des
98DHDIR=		$(SRC)/common/crypto/dh
99DSADIR=		$(SRC)/common/crypto/dsa
100ECCDIR=		$(SRC)/common/crypto/ecc
101MPIDIR=		$(SRC)/common/mpi
102RSADIR=		$(SRC)/common/crypto/rsa
103RNGDIR=		$(SRC)/common/crypto/rng
104SHA1DIR=	$(SRC)/common/crypto/sha1
105SHA2DIR=	$(SRC)/common/crypto/sha2
106BIGNUMDIR=	$(SRC)/common/bignum
107PADDIR=		$(SRC)/common/crypto/padding
108BERDIR=		../../../libldap5/sources/ldap/ber
109
110include $(SRC)/lib/Makefile.lib
111
112#	set signing mode
113POST_PROCESS_SO +=	; $(ELFSIGN_CRYPTO)
114
115SRCDIR= ../common
116
117SRCS =	\
118	$(LCL_OBJECTS:%.o=$(SRCDIR)/%.c) \
119	$(MPI_COBJECTS:%.o=$(MPIDIR)/%.c) \
120	$(ECC_COBJECTS:%.o=$(ECCDIR)/%.c) \
121	$(RNG_COBJECTS:%.o=$(RNGDIR)/%.c)
122
123# libelfsign needs a static pkcs11_softtoken
124LIBS    =       $(DYNLIB)
125LDLIBS  +=      -lc -lmd -lcryptoutil -lsoftcrypto -lgen
126
127CSTD =	$(CSTD_GNU99)
128C99LMODE = -Xc99=%all
129
130CFLAGS	+=      $(CCVERBOSE)
131
132CERRWARN +=	-_gcc=-Wno-unused-label
133CERRWARN +=	-_gcc=-Wno-parentheses
134CERRWARN +=	-_gcc=-Wno-uninitialized
135CERRWARN +=	-_gcc=-Wno-type-limits
136CERRWARN +=	-_gcc=-Wno-unused-variable
137CERRWARN +=	-_gcc=-Wno-empty-body
138
139CPPFLAGS += -I$(AESDIR) -I$(BLOWFISHDIR) -I$(ARCFOURDIR) -I$(DESDIR) \
140	    -I$(DHDIR) -I$(DSADIR) -I$(ECCDIR) -I$(SRC)/common/crypto \
141	    -I$(MPIDIR) -I$(RSADIR) -I$(RNGDIR) \
142	    -I$(SHA1DIR) -I$(SHA2DIR) -I$(SRCDIR) \
143	    -I$(BIGNUMDIR) -I$(PADDIR) -D_POSIX_PTHREAD_SEMANTICS \
144	    -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B
145
146LINTFLAGS64 += -errchk=longptr64
147
148ROOTLIBDIR=     $(ROOT)/usr/lib/security
149ROOTLIBDIR64=   $(ROOT)/usr/lib/security/$(MACH64)
150
151LINTSRC = \
152	$(LCL_OBJECTS:%.o=$(SRCDIR)/%.c) \
153	$(RNG_COBJECTS:%.o=$(RNGDIR)/%.c)
154
155.KEEP_STATE:
156
157all:	$(LIBS)
158
159lint:	$$(LINTSRC)
160	$(LINT.c) $(LINTCHECKFLAGS) $(LINTSRC) $(LDLIBS)
161
162pics/%.o:	$(BERDIR)/%.c
163	$(COMPILE.c) -o $@ $< -D_SOLARIS_SDK -I$(BERDIR) \
164		-I../../../libldap5/include/ldap
165	$(POST_PROCESS_O)
166
167pics/%.o:	$(ECCDIR)/%.c
168	$(COMPILE.c) -o $@ $<
169	$(POST_PROCESS_O)
170
171pics/%.o:	$(MPIDIR)/%.c
172	$(COMPILE.c) -o $@ $<
173	$(POST_PROCESS_O)
174
175pics/%.o:	$(RNGDIR)/%.c
176	$(COMPILE.c) -o $@ $<
177	$(POST_PROCESS_O)
178
179include $(SRC)/lib/Makefile.targ
180