xref: /titanic_51/usr/src/lib/pkcs11/pkcs11_softtoken/Makefile.com (revision b6c3f7863936abeae522e48a13887dddeb691a45)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
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	softRandUtil.o		\
58	softKeysUtil.o		\
59	softARCFourCrypt.o	\
60	softDSA.o		\
61	softDH.o		\
62	softAESCrypt.o		\
63	softCrypt.o		\
64	softKeystore.o		\
65	softKeystoreUtil.o	\
66	softSSL.o		\
67	softASN1.o		\
68	softBlowfishCrypt.o	\
69	softEC.o
70
71ASFLAGS = $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS)
72
73AES_COBJECTS = aes_cbc_crypt.o  aes_impl.o
74BLOWFISH_COBJECTS = blowfish_cbc_crypt.o blowfish_impl.o
75ARCFOUR_COBJECTS = arcfour_crypt.o
76DES_COBJECTS = des_cbc_crypt.o des_impl.o des_ks.o
77
78ECC_COBJECTS = \
79	ec.o ec2_163.o ec2_mont.o ecdecode.o ecl_mult.o ecp_384.o \
80	ecp_jac.o ec2_193.o ecl.o ecp_192.o ecp_521.o \
81	ecp_jm.o ec2_233.o ecl_curve.o ecp_224.o ecp_aff.o ecp_mont.o \
82	ec2_aff.o ec_naf.o ecl_gf.o ecp_256.o oid.o secitem.o \
83	ec2_test.o ecp_test.o
84
85MPI_COBJECTS = mp_gf2m.o mpi.o mplogic.o mpmontg.o mpprime.o
86
87RSA_COBJECTS = rsa_impl.o
88BIGNUM_COBJECTS = bignumimpl.o
89
90AES_OBJECTS = $(AES_COBJECTS) $(AES_PSR_OBJECTS)
91BLOWFISH_OBJECTS = $(BLOWFISH_COBJECTS) $(BLOWFISH_PSR_OBJECTS)
92ARCFOUR_OBJECTS = $(ARCFOUR_COBJECTS) $(ARCFOUR_PSR_OBJECTS)
93DES_OBJECTS = $(DES_COBJECTS) $(DES_PSR_OBJECTS)
94
95ECC_OBJECTS = $(ECC_COBJECTS) $(ECC_PSR_OBJECTS)
96MPI_OBJECTS = $(MPI_COBJECTS) $(MPI_PSR_OBJECTS)
97RSA_OBJECTS = $(RSA_COBJECTS) $(RSA_PSR_OBJECTS)
98SHA1_OBJECTS = $(SHA1_COBJECTS) $(SHA1_PSR_OBJECTS)
99SHA2_OBJECTS = $(SHA2_COBJECTS) $(SHA2_PSR_OBJECTS)
100BIGNUM_OBJECTS = $(BIGNUM_COBJECTS) $(BIGNUM_PSR_OBJECTS)
101
102BER_OBJECTS = bprint.o decode.o encode.o io.o
103
104# Sparc userland uses a floating-point implementation of
105# Montgomery multiply.  So, USE_FLOATING_POINT is defined here
106# for Sparc targets.
107#
108# x86 does not use floating-point for the kernel or userland.
109#
110# Sparc has only one integer implementation of big_mul_add_vec()
111# and friends, so these functions are called directly.
112# So, HWCAP (HardWare CAPabilities) is not defined for Sparc.
113#
114# x86 has multiple integer implementations to choose from.
115# Hardware features are tested at run time, just once,
116# on first use.  So, big_mul_add_vec() and friends must be
117# called through a function pointer.
118#
119# AMD64 has a 64x64->128 bit multiply instruction, which makes
120# things even faster than i386 SSE2 instructions.  Since there
121# is no run-time testing of features, as there is for SSE2,
122# there is no need to call big_mul_add_vec() and friends through
123# functions pointers, and so HWCAP is not defined.
124#
125# For now i386 and amd64 use the C code version of mont_mulf
126
127OBJECTS = \
128	$(LCL_OBJECTS)		\
129	$(AES_OBJECTS)		\
130	$(BLOWFISH_OBJECTS)	\
131	$(ARCFOUR_OBJECTS)	\
132	$(DES_OBJECTS)		\
133	$(MPI_OBJECTS)		\
134	$(RSA_OBJECTS)		\
135	$(SHA1_OBJECTS)		\
136	$(SHA2_OBJECTS)		\
137	$(BIGNUM_OBJECTS)	\
138	$(BER_OBJECTS)		\
139	$(ECC_OBJECTS)
140
141AESDIR=		$(SRC)/common/crypto/aes
142BLOWFISHDIR=	$(SRC)/common/crypto/blowfish
143ARCFOURDIR=	$(SRC)/common/crypto/arcfour
144DESDIR=		$(SRC)/common/crypto/des
145ECCDIR=		$(SRC)/common/crypto/ecc
146MPIDIR=		$(SRC)/common/mpi
147RSADIR=		$(SRC)/common/crypto/rsa
148BIGNUMDIR=	$(SRC)/common/bignum
149BERDIR=		../../../libldap5/sources/ldap/ber
150
151include $(SRC)/lib/Makefile.lib
152
153#	set signing mode
154POST_PROCESS_SO +=	; $(ELFSIGN_CRYPTO)
155
156SRCDIR= ../common
157
158SRCS =	\
159	$(LCL_OBJECTS:%.o=$(SRCDIR)/%.c) \
160	$(AES_COBJECTS:%.o=$(AESDIR)/%.c) \
161	$(BLOWFISH_COBJECTS:%.o=$(BLOWFISHDIR)/%.c) \
162	$(ARCFOUR_COBJECTS:%.o=$(ARCFOURDIR)/%.c) \
163	$(DES_COBJECTS:%.o=$(DESDIR)/%.c) \
164	$(MPI_COBJECTS:%.o=$(MPIDIR)/%.c) \
165	$(RSA_COBJECTS:%.o=$(RSADIR)/%.c) \
166	$(SHA1_COBJECTS:%.o=$(SHA1DIR)/%.c) \
167	$(SHA2_COBJECTS:%.o=$(SHA2DIR)/%.c) \
168	$(BIGNUM_COBJECTS:%.o=$(BIGNUMDIR)/%.c) \
169	$(BIGNUM_PSR_SRCS) \
170	$(ECC_COBJECTS:%.o=$(ECCDIR)/%.c)
171
172# libelfsign needs a static pkcs11_softtoken
173LIBS    =       $(DYNLIB)
174LDLIBS  +=      -lc -lmd -lcryptoutil
175
176CFLAGS 	+=      $(CCVERBOSE)
177CPPFLAGS += -I$(AESDIR) -I$(BLOWFISHDIR) -I$(ARCFOURDIR) -I$(DESDIR) \
178	    -I$(ECCDIR) -I$(MPIDIR) -I$(RSADIR) -I$(SRCDIR) -I$(BIGNUMDIR) \
179	    -D_POSIX_PTHREAD_SEMANTICS -DMP_API_COMPATIBLE \
180	    -DNSS_ECC_MORE_THAN_SUITE_B
181
182LINTFLAGS64 += -errchk=longptr64
183
184ROOTLIBDIR=     $(ROOT)/usr/lib/security
185ROOTLIBDIR64=   $(ROOT)/usr/lib/security/$(MACH64)
186
187LINTSRC = \
188	$(LCL_OBJECTS:%.o=$(SRCDIR)/%.c) \
189	$(AES_COBJECTS:%.o=$(AESDIR)/%.c) \
190	$(BLOWFISH_COBJECTS:%.o=$(BLOWFISHDIR)/%.c) \
191	$(ARCFOUR_COBJECTS:%.o=$(ARCFOURDIR)/%.c) \
192	$(DES_COBJECTS:%.o=$(DESDIR)/%.c) \
193	$(RSA_COBJECTS:%.o=$(RSADIR)/%.c) \
194	$(SHA1_COBJECTS:%.o=$(SHA1DIR)/%.c) \
195	$(SHA2_COBJECTS:%.o=$(SHA2DIR)/%.c) \
196	$(BIGNUM_COBJECTS:%.o=$(BIGNUMDIR)/%.c) \
197	$(BIGNUM_PSR_SRCS)
198
199.KEEP_STATE:
200
201all:	$(LIBS)
202
203lint:	$$(LINTSRC)
204	$(LINT.c) $(LINTCHECKFLAGS) $(LINTSRC) $(LDLIBS)
205
206pics/%.o:	$(AESDIR)/%.c
207	$(COMPILE.c) -o $@ $<
208	$(POST_PROCESS_O)
209
210pics/%.o:	$(BLOWFISHDIR)/%.c
211	$(COMPILE.c) -o $@ $<
212	$(POST_PROCESS_O)
213
214pics/%.o:	$(ARCFOURDIR)/%.c
215	$(COMPILE.c) -o $@ $<
216	$(POST_PROCESS_O)
217
218pics/%.o:	$(DESDIR)/%.c
219	$(COMPILE.c) -o $@ $<
220	$(POST_PROCESS_O)
221
222pics/%.o:	$(ECCDIR)/%.c
223	$(COMPILE.c) -o $@ $<
224	$(POST_PROCESS_O)
225
226pics/%.o:	$(MPIDIR)/%.c
227	$(COMPILE.c) -o $@ $<
228	$(POST_PROCESS_O)
229
230pics/%.o:	$(RSADIR)/%.c
231	$(COMPILE.c) -o $@ $<
232	$(POST_PROCESS_O)
233
234pics/%.o:	$(SHA1DIR)/%.c
235	$(COMPILE.c) -o $@ $<
236	$(POST_PROCESS_O)
237
238pics/%.o:	$(SHA2DIR)/%.c
239	$(COMPILE.c) -o $@ $<
240	$(POST_PROCESS_O)
241
242pics/%.o:	$(BIGNUMDIR)/%.c
243	$(COMPILE.c) -o $@ $(BIGNUM_CFG) $<
244	$(POST_PROCESS_O)
245
246pics/%.o:	$(BERDIR)/%.c
247	$(COMPILE.c) -o $@ $< -D_SOLARIS_SDK -I$(BERDIR) \
248		-I../../../libldap5/include/ldap
249	$(POST_PROCESS_O)
250
251include $(SRC)/lib/Makefile.targ
252