171269a22SAnthony Scarpino#
271269a22SAnthony Scarpino# CDDL HEADER START
371269a22SAnthony Scarpino#
471269a22SAnthony Scarpino# The contents of this file are subject to the terms of the
571269a22SAnthony Scarpino# Common Development and Distribution License (the "License").
671269a22SAnthony Scarpino# You may not use this file except in compliance with the License.
771269a22SAnthony Scarpino#
871269a22SAnthony Scarpino# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
971269a22SAnthony Scarpino# or http://www.opensolaris.org/os/licensing.
1071269a22SAnthony Scarpino# See the License for the specific language governing permissions
1171269a22SAnthony Scarpino# and limitations under the License.
1271269a22SAnthony Scarpino#
1371269a22SAnthony Scarpino# When distributing Covered Code, include this CDDL HEADER in each
1471269a22SAnthony Scarpino# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1571269a22SAnthony Scarpino# If applicable, add the following below this CDDL HEADER, with the
1671269a22SAnthony Scarpino# fields enclosed by brackets "[]" replaced with your own identifying
1771269a22SAnthony Scarpino# information: Portions Copyright [yyyy] [name of copyright owner]
1871269a22SAnthony Scarpino#
1971269a22SAnthony Scarpino# CDDL HEADER END
2071269a22SAnthony Scarpino#
21726fad2aSDina K Nimeh
22726fad2aSDina K Nimeh#
23726fad2aSDina K Nimeh# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24fb261280SJason King# Copyright 2017 Jason King
253eca6103SJohn Levon# Copyright (c) 2019, Joyent, Inc.
2671269a22SAnthony Scarpino#
27726fad2aSDina K Nimeh
281e49577aSRod EvansLIBRARY =	libsoftcrypto.a
291e49577aSRod EvansVERS =		.1
3071269a22SAnthony Scarpino
311e49577aSRod Evansinclude		../Makefile.com
3271269a22SAnthony Scarpino
33fb261280SJason KingAES_PSM_OBJS =	aes_amd64.o aes_intel.o aeskey.o
341e49577aSRod EvansARCFOUR_PSM_OBJS = arcfour-x86_64.o
351e49577aSRod EvansBIGNUM_PSM_OBJS = bignum_amd64.o bignum_amd64_asm.o
36fb261280SJason KingMODES_PSM_OBJS = gcm_intel.o
3771269a22SAnthony Scarpino
381e49577aSRod Evansinclude		$(SRC)/lib/Makefile.lib
391e49577aSRod Evansinclude		$(SRC)/lib/Makefile.lib.64
4071269a22SAnthony Scarpino
417014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-type-limits
427014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
43d3b5f563SJohn LevonCERRWARN +=	$(CNOWARN_UNINIT)
447014882cSRichard Lowe
4505ede3dbSJohn Levon# not linted
4605ede3dbSJohn LevonSMATCH=off
4705ede3dbSJohn Levon
485d9d9091SRichard LoweAES_PSM_SRC =	$(AES_DIR)/$(MACH64)/aes_amd64.S \
495d9d9091SRichard Lowe		$(AES_DIR)/$(MACH64)/aes_intel.S \
501e49577aSRod Evans		$(AES_DIR)/$(MACH64)/aeskey.c
515d9d9091SRichard LoweARCFOUR_PSM_SRC = arcfour-x86_64.S
521e49577aSRod EvansBIGNUM_PSM_SRC = $(BIGNUM_DIR)/$(MACH64)/bignum_amd64.c \
535d9d9091SRichard Lowe		$(BIGNUM_DIR)/$(MACH64)/bignum_amd64_asm.S
5471269a22SAnthony Scarpino
555d9d9091SRichard LoweMODES_PSM_SRC = $(MODES_DIR)/$(MACH64)/gcm_intel.S
56fb261280SJason King
571e49577aSRod Evans# Sources need to be redefined after Makefile.lib inclusion.
581e49577aSRod EvansSRCS =		$(AES_SRC) $(ARCFOUR_SRC) $(BIGNUM_SRC) $(BLOWFISH_SRC) \
591e49577aSRod Evans		$(DES_SRC) $(MODES_SRC) $(DH_SRC) $(DSA_SRC) $(RSA_SRC) \
601e49577aSRod Evans		$(PAD_SRC)
611e49577aSRod Evans
621e49577aSRod EvansSRCDIR =	$(SRC)/lib/pkcs11/libsoftcrypto/common
631e49577aSRod Evans
64241c90a0SRichard LoweLIBS =		$(DYNLIB)
651e49577aSRod EvansMAPFILEDIR =	../common
661e49577aSRod Evans
67*d17be682SRichard LoweCFLAGS +=	-xO4
681e49577aSRod EvansCPPFLAGS +=	-I$(CRYPTODIR) -I$(UTSDIR) -D_POSIX_PTHREAD_SEMANTICS
695d9d9091SRichard LoweASFLAGS64 +=	$(AS_PICFLAGS) -D_ASM
701e49577aSRod EvansBIGNUM_FLAGS +=	-DPSR_MUL
715d9d9091SRichard LoweCLEANFILES +=	arcfour-x86_64.S arcfour-x86_64.s
721e49577aSRod EvansLDLIBS +=	-lcryptoutil -lc
731e49577aSRod Evans
741e49577aSRod Evans.KEEP_STATE:
751e49577aSRod Evans
761e49577aSRod Evansall:		$(LIBS)
7771269a22SAnthony Scarpino
78241c90a0SRichard Loweinstall:	all $(ROOTLIBS64) $(ROOTLINKS64)
7971269a22SAnthony Scarpino
801e49577aSRod Evanspics/%.o: $(AES_DIR)/$(MACH64)/%.c
811e49577aSRod Evans		$(COMPILE.c) $(AES_FLAGS) -o $@ $<
821e49577aSRod Evans		$(POST_PROCESS_O)
8371269a22SAnthony Scarpino
845d9d9091SRichard Lowepics/%.o: $(AES_DIR)/$(MACH64)/%.S
851e49577aSRod Evans		$(COMPILE.s) $(AES_FLAGS) -o $@ $<
863eca6103SJohn Levon		$(POST_PROCESS_S_O)
8771269a22SAnthony Scarpino
881e49577aSRod Evanspics/%.o: $(BIGNUM_DIR)/$(MACH64)/%.c
891e49577aSRod Evans		$(COMPILE.c) $(BIGNUM_FLAGS) -o $@ $<
901e49577aSRod Evans		$(POST_PROCESS_O)
9171269a22SAnthony Scarpino
925d9d9091SRichard Lowepics/%.o: $(BIGNUM_DIR)/$(MACH64)/%.S
931e49577aSRod Evans		$(COMPILE64.s) $(BIGNUM_FLAGS) -o $@ $<
943eca6103SJohn Levon		$(POST_PROCESS_S_O)
9571269a22SAnthony Scarpino
965d9d9091SRichard Lowepics/%.o: $(MODES_DIR)/$(MACH64)/%.S
97fb261280SJason King		$(COMPILE64.s) $(MODES_FLAGS) -o $@ $<
983eca6103SJohn Levon		$(POST_PROCESS_S_O)
99fb261280SJason King
1001e49577aSRod Evansinclude		../Makefile.targ
10171269a22SAnthony Scarpino
1025d9d9091SRichard Lowearcfour-x86_64.S: $(ARCFOUR_DIR)/amd64/arcfour-x86_64.pl
1031e49577aSRod Evans		$(PERL) $? $@
10471269a22SAnthony Scarpino
1055d9d9091SRichard Lowepics/%.o: arcfour-x86_64.S
1061e49577aSRod Evans		$(COMPILE64.s) $(ARCFOUR_FLAGS) -o $@ $<
1073eca6103SJohn Levon		$(POST_PROCESS_S_O)
108