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