1# 2# This file and its contents are supplied under the terms of the 3# Common Development and Distribution License ("CDDL"), version 1.0. 4# You may only use this file in accordance with the terms of version 5# 1.0 of the CDDL. 6# 7# A full copy of the text of the CDDL should have accompanied this 8# source. A copy of the CDDL is also available via the Internet at 9# http://www.illumos.org/license/CDDL. 10# 11 12# 13# Copyright (c) 2012 by Delphix. All rights reserved. 14# Copyright 2015 Nexenta Systems, Inc. All rights reserved. 15# Copyright 2019 Joyent, Inc. 16# Copyright 2020 Oxide Computer Company 17# 18 19include $(SRC)/cmd/Makefile.cmd 20include $(SRC)/test/Makefile.com 21include $(SRC)/cmd/Makefile.ctf 22 23PROGS_32 = $(CRYPTO:%=$(BASEPROG)_32_%) 24PROGS_64 = $(CRYPTO:%=$(BASEPROG)_64_%) 25PROGS = $(PROGS_32) $(PROGS_64) 26 27COMMON_OBJS_32 = $(COMMON_OBJS:%.o=%.32.o) 28COMMON_OBJS_64 = $(COMMON_OBJS:%.o=%.64.o) 29 30# Some tests may only be relevant for PKCS#11 or KCF. One can use 31# a statement like 'CRYPTO_kcf = $(POUND_SIGN)' in a test's Makefile to 32# disable creation of tests for a given framework. For an example, see 33# modes/aes/cbc_pad/Makefile 34$(CRYPTO_pkcs)PROGS_pkcs = $(BASEPROG:%=%_32_pkcs) $(BASEPROG:%=%_64_pkcs) 35$(CRYPTO_kcf)PROGS_kcf = $(BASEPROG:%=%_32_kcf) $(BASEPROG:%=%_64_kcf) 36 37# $(TESTROOT) must be set by whatever includes this file 38$(CRYPTO_pkcs)TESTDIR_pkcs = $(TESTROOT)/pkcs 39$(CRYPTO_kcf)TESTDIR_kcf = $(TESTROOT)/kcf 40 41COMMONDIR = $(SRC)/test/crypto-tests/tests/common 42$(PROGS_32) := OBJS += $(BASEPROG:%=%.32.o) $(COMMON_OBJS_32) 43$(PROGS_64) := OBJS += $(BASEPROG:%=%.64.o) $(COMMON_OBJS_64) 44$(PROGS_32) := OBJS += $(COMMONDIR)/testfuncs.32.o 45$(PROGS_64) := OBJS += $(COMMONDIR)/testfuncs.64.o 46$(CRYPTO_pkcs)$(BASEPROG)_32_pkcs := OBJS += $(COMMONDIR)/cryptotest_pkcs.32.o 47$(CRYPTO_pkcs)$(BASEPROG)_64_pkcs := OBJS += $(COMMONDIR)/cryptotest_pkcs.64.o 48$(CRYPTO_kcf)$(BASEPROG)_32_kcf := OBJS += $(COMMONDIR)/cryptotest_kcf.32.o 49$(CRYPTO_kcf)$(BASEPROG)_64_kcf := OBJS += $(COMMONDIR)/cryptotest_kcf.64.o 50 51$(CRYPTO_pkcs)$(PROGS_pkcs) := LDLIBS += -lpkcs11 -lcryptoutil 52 53CSTD = $(CSTD_GNU99) 54 55$(CRYPTO_pkcs)CMDS_pkcs = $(PROGS_pkcs:%_pkcs=$(TESTDIR_pkcs)/%) 56$(CRYPTO_kcf)CMDS_kcf = $(PROGS_kcf:%_kcf=$(TESTDIR_kcf)/%) 57CMDS = $(CMDS_pkcs) $(CMDS_kcf) 58 59$(CMDS) := FILEMODE = 0555 60 61CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 62CPPFLAGS += -I$(COMMONDIR) -I$(SRC)/common/crypto/ 63 64all: $(PROGS) 65 66%_32_pkcs: %.32.o $(COMMON_OBJS_32) 67 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 68 $(POST_PROCESS) 69 70%_64_pkcs: %.64.o $(COMMON_OBJS_64) 71 $(LINK64.c) $(OBJS) -o $@ $(LDLIBS) 72 $(POST_PROCESS) 73 74%_32_kcf: %.32.o $(COMMON_OBJS_32) 75 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 76 $(POST_PROCESS) 77 78%_64_kcf: %.64.o $(COMMON_OBJS_64) 79 $(LINK64.c) $(OBJS) -o $@ $(LDLIBS) 80 $(POST_PROCESS) 81 82%.32.o: %.c 83 $(COMPILE.c) -o $@ $< 84 $(POST_PROCESS_O) 85 86%.64.o: %.c 87 $(COMPILE64.c) -o $@ $< 88 $(POST_PROCESS_O) 89 90install: all $(CMDS) 91 92clobber: clean 93 -$(RM) $(PROGS) 94 95clean: 96 -$(RM) *.o $(COMMON_OBJS_32) $(COMMON_OBJS_64) $(PROGS) 97 98$(CMDS): $(TESTDIR_pkcs) $(TESTDIR_kcf) $(PROGS) 99 100$(TESTDIR_pkcs) $(TESTDIR_kcf): 101 $(INS.dir) 102 103$(TESTDIR_pkcs)/%_32: %_32_pkcs 104 $(INS.rename) 105 106$(TESTDIR_pkcs)/%_64: %_64_pkcs 107 $(INS.rename) 108 109$(TESTDIR_kcf)/%_32: %_32_kcf 110 $(INS.rename) 111 112$(TESTDIR_kcf)/%_64: %_64_kcf 113 $(INS.rename) 114