xref: /titanic_50/usr/src/lib/pkcs11/pkcs11_softtoken/Makefile.com (revision 492887eea95d0c0640c3c97d4e8be8bd9e0b422a)
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_impl.o
74ARCFOUR_COBJECTS = arcfour_crypt.o
75BLOWFISH_COBJECTS = blowfish_impl.o
76DES_COBJECTS = 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
85MODES_COBJECTS = modes.o ecb.o cbc.o ctr.o
86MPI_COBJECTS = mp_gf2m.o mpi.o mplogic.o mpmontg.o mpprime.o
87
88RSA_COBJECTS = rsa_impl.o
89BIGNUM_COBJECTS = bignumimpl.o
90
91AES_OBJECTS = $(AES_COBJECTS) $(AES_PSR_OBJECTS)
92ARCFOUR_OBJECTS = $(ARCFOUR_COBJECTS) $(ARCFOUR_PSR_OBJECTS)
93BLOWFISH_OBJECTS = $(BLOWFISH_COBJECTS) $(BLOWFISH_PSR_OBJECTS)
94DES_OBJECTS = $(DES_COBJECTS) $(DES_PSR_OBJECTS)
95ECC_OBJECTS = $(ECC_COBJECTS) $(ECC_PSR_OBJECTS)
96MODES_OBJECTS = $(MODES_COBJECTS) $(MODES_PSR_OBJECTS)
97MPI_OBJECTS = $(MPI_COBJECTS) $(MPI_PSR_OBJECTS)
98RSA_OBJECTS = $(RSA_COBJECTS) $(RSA_PSR_OBJECTS)
99BIGNUM_OBJECTS = $(BIGNUM_COBJECTS) $(BIGNUM_PSR_OBJECTS)
100
101BER_OBJECTS = bprint.o decode.o encode.o io.o
102
103# Sparc userland uses a floating-point implementation of
104# Montgomery multiply.  So, USE_FLOATING_POINT is defined here
105# for Sparc targets.
106#
107# x86 does not use floating-point for the kernel or userland.
108#
109# Sparc has only one integer implementation of big_mul_add_vec()
110# and friends, so these functions are called directly.
111# So, HWCAP (HardWare CAPabilities) is not defined for Sparc.
112#
113# x86 has multiple integer implementations to choose from.
114# Hardware features are tested at run time, just once,
115# on first use.  So, big_mul_add_vec() and friends must be
116# called through a function pointer.
117#
118# AMD64 has a 64x64->128 bit multiply instruction, which makes
119# things even faster than i386 SSE2 instructions.  Since there
120# is no run-time testing of features, as there is for SSE2,
121# there is no need to call big_mul_add_vec() and friends through
122# functions pointers, and so HWCAP is not defined.
123#
124# For now i386 and amd64 use the C code version of mont_mulf
125
126OBJECTS = \
127	$(LCL_OBJECTS)		\
128	$(AES_OBJECTS)		\
129	$(BLOWFISH_OBJECTS)	\
130	$(ARCFOUR_OBJECTS)	\
131	$(DES_OBJECTS)		\
132	$(MODES_OBJECTS)	\
133	$(MPI_OBJECTS)		\
134	$(RSA_OBJECTS)		\
135	$(BIGNUM_OBJECTS)	\
136	$(BER_OBJECTS)		\
137	$(ECC_OBJECTS)
138
139AESDIR=		$(SRC)/common/crypto/aes
140BLOWFISHDIR=	$(SRC)/common/crypto/blowfish
141ARCFOURDIR=	$(SRC)/common/crypto/arcfour
142DESDIR=		$(SRC)/common/crypto/des
143ECCDIR=		$(SRC)/common/crypto/ecc
144MODESDIR=	$(SRC)/common/crypto/modes
145MPIDIR=		$(SRC)/common/mpi
146RSADIR=		$(SRC)/common/crypto/rsa
147BIGNUMDIR=	$(SRC)/common/bignum
148BERDIR=		../../../libldap5/sources/ldap/ber
149
150include $(SRC)/lib/Makefile.lib
151
152#	set signing mode
153POST_PROCESS_SO +=	; $(ELFSIGN_CRYPTO)
154
155SRCDIR= ../common
156
157SRCS =	\
158	$(LCL_OBJECTS:%.o=$(SRCDIR)/%.c) \
159	$(AES_COBJECTS:%.o=$(AESDIR)/%.c) \
160	$(BLOWFISH_COBJECTS:%.o=$(BLOWFISHDIR)/%.c) \
161	$(ARCFOUR_COBJECTS:%.o=$(ARCFOURDIR)/%.c) \
162	$(DES_COBJECTS:%.o=$(DESDIR)/%.c) \
163	$(MODES_COBJECTS:%.o=$(MODESDIR)/%.c) \
164	$(MPI_COBJECTS:%.o=$(MPIDIR)/%.c) \
165	$(RSA_COBJECTS:%.o=$(RSADIR)/%.c) \
166	$(BIGNUM_COBJECTS:%.o=$(BIGNUMDIR)/%.c) \
167	$(BIGNUM_PSR_SRCS) \
168	$(ECC_COBJECTS:%.o=$(ECCDIR)/%.c)
169
170# libelfsign needs a static pkcs11_softtoken
171LIBS    =       $(DYNLIB)
172LDLIBS  +=      -lc -lmd -lcryptoutil
173
174CFLAGS 	+=      $(CCVERBOSE)
175CPPFLAGS += -I$(AESDIR) -I$(BLOWFISHDIR) -I$(ARCFOURDIR) -I$(DESDIR) \
176	    -I$(ECCDIR) -I$(SRC)/common/crypto -I$(MPIDIR) -I$(RSADIR) \
177	    -I$(SRCDIR) -I$(BIGNUMDIR) -D_POSIX_PTHREAD_SEMANTICS \
178	    -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B
179
180LINTFLAGS64 += -errchk=longptr64
181
182ROOTLIBDIR=     $(ROOT)/usr/lib/security
183ROOTLIBDIR64=   $(ROOT)/usr/lib/security/$(MACH64)
184
185LINTSRC = \
186	$(AES_COBJECTS:%.o=$(AESDIR)/%.c) \
187	$(ARCFOUR_COBJECTS:%.o=$(ARCFOURDIR)/%.c) \
188	$(BIGNUM_COBJECTS:%.o=$(BIGNUMDIR)/%.c) \
189	$(BIGNUM_PSR_SRCS) \
190	$(BLOWFISH_COBJECTS:%.o=$(BLOWFISHDIR)/%.c) \
191	$(DES_COBJECTS:%.o=$(DESDIR)/%.c) \
192	$(LCL_OBJECTS:%.o=$(SRCDIR)/%.c) \
193	$(MODES_COBJECTS:%.o=$(MODESDIR)/%.c) \
194	$(RSA_COBJECTS:%.o=$(RSADIR)/%.c)
195
196.KEEP_STATE:
197
198all:	$(LIBS)
199
200lint:	$$(LINTSRC)
201	$(LINT.c) $(LINTCHECKFLAGS) $(LINTSRC) $(LDLIBS)
202
203pics/%.o:	$(AESDIR)/%.c
204	$(COMPILE.c) -o $@ $<
205	$(POST_PROCESS_O)
206
207pics/%.o:	$(ARCFOURDIR)/%.c
208	$(COMPILE.c) -o $@ $<
209	$(POST_PROCESS_O)
210
211pics/%.o:	$(BERDIR)/%.c
212	$(COMPILE.c) -o $@ $< -D_SOLARIS_SDK -I$(BERDIR) \
213		-I../../../libldap5/include/ldap
214	$(POST_PROCESS_O)
215
216pics/%.o:	$(BIGNUMDIR)/%.c
217	$(COMPILE.c) -o $@ $(BIGNUM_CFG) $<
218	$(POST_PROCESS_O)
219
220pics/%.o:	$(BLOWFISHDIR)/%.c
221	$(COMPILE.c) -o $@ $<
222	$(POST_PROCESS_O)
223
224pics/%.o:	$(DESDIR)/%.c
225	$(COMPILE.c) -o $@ $<
226	$(POST_PROCESS_O)
227
228pics/%.o:	$(ECCDIR)/%.c
229	$(COMPILE.c) -o $@ $<
230	$(POST_PROCESS_O)
231
232pics/%.o:	$(MODESDIR)/%.c
233	$(COMPILE.c) -o $@ $<
234	$(POST_PROCESS_O)
235
236pics/%.o:	$(MPIDIR)/%.c
237	$(COMPILE.c) -o $@ $<
238	$(POST_PROCESS_O)
239
240pics/%.o:	$(RSADIR)/%.c
241	$(COMPILE.c) -o $@ $<
242	$(POST_PROCESS_O)
243
244include $(SRC)/lib/Makefile.targ
245