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