# $Id: Makefile.kmk 101211 2023-09-21 06:43:35Z vboxsync $ ## @file # Sub-Makefile for OpenSSL providers. # # # Copyright (C) 2022-2023 Oracle and/or its affiliates. # # This file is part of VirtualBox base platform packages, as # available from https://www.virtualbox.org. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, in version 3 of the # License. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # SPDX-License-Identifier: GPL-3.0-only # SUB_DEPTH = ../../../.. include $(KBUILD_PATH)/subheader.kmk # # Include sub-makefiles. # # Note! For joining the sub libraries into a single lib, we do some trickery to # collect the sub-library names here. # VBOX_LIBRARIES_BEFORE_CRYPTO_PROVIDERS_SUBDIRS := $(LIBRARIES) include $(VBOX_PATH_CRYPTO_PROVIDERS)/common/Makefile.kmk include $(sort $(wildcard $(VBOX_PATH_CRYPTO_PROVIDERS)/implementations/*/Makefile.kmk)) VBOX_CRYPTO_PROVIDERS_SUBLIBS := $(filter-out $(VBOX_LIBRARIES_BEFORE_CRYPTO_PROVIDERS_SUBDIRS), $(LIBRARIES)) VBOX_CRYPTO_PROVIDERS_SUBLIBS_X86 := $(filter %-x86, $(VBOX_CRYPTO_PROVIDERS_SUBLIBS)) VBOX_CRYPTO_PROVIDERS_SUBLIBS := $(filter-out %-x86, $(VBOX_CRYPTO_PROVIDERS_SUBLIBS)) #if defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS) # $(eval LIBRARIES = $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS) crypto_sha) #else if "$(SDK_VBoxOpenSslStatic_INCS)" != "$(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS)" $(eval LIBRARIES = $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS)) endif VBOX_LIBRARIES_BEFORE_CRYPTO_PROVIDERS_SUBDIRS := # # The main target: libproviders. # if "$(SDK_VBoxOpenSslStatic_INCS)" == "$(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS)" LIBRARIES += VBox-libproviders endif VBox-libproviders_TEMPLATE = LibCrypto VBox-libproviders_DEFS = OPENSSL_NO_DEPRECATED VBox-libproviders_SOURCES = \ baseprov.c \ defltprov.c \ legacyprov.c \ nullprov.c \ prov_running.c VBox-libproviders_SOURCES += $(foreach sublib,$(VBOX_CRYPTO_PROVIDERS_SUBLIBS), $($(sublib)_1_TARGET)) ifdef VBOX_WITH_32_ON_64_MAIN_API # 32-bit edition. LIBRARIES += VBox-libproviders-x86 VBox-libproviders-x86_TEMPLATE = VBoxLibCrypto-x86 VBox-libproviders-x86_EXTENDS = VBox-libproviders VBox-libproviders-x86_SOURCES = $(filter %.c %.cpp,$(VBox-libproviders_SOURCES)) \ $(foreach sublib,$(VBOX_CRYPTO_PROVIDERS_SUBLIBS_X86), $($(sublib)_1_TARGET)) endif ifdef VBOX_NEED_EXTPACK_OPENSSL # # For the extension pack. # LIBRARIES += VBoxExtPack-libproviders VBoxExtPack-libproviders_EXTENDS = VBox-libproviders VBoxExtPack-libproviders_DEFS = VBOX_IN_EXTPACK endif ifdef VBOX_WITH_BLD_RTSIGNTOOL_SIGNING # # The build program libproviders version. # LIBRARIES += VBoxBldProg-libproviders VBoxBldProg-libproviders = For bldRTSignTool VBoxBldProg-libproviders_EXTENDS = VBox-libproviders VBoxBldProg-libproviders_TEMPLATE = VBoxLibCryptoBldProg VBoxBldProg-libproviders_SOURCES = \ $(filter %.c,$(VBox-libproviders_SOURCES)) \ $(foreach sublib,$(VBOX_CRYPTO_PROVIDERS_SUBLIBS), $(VBoxBldProg-$(sublib)_1_TARGET)) define def_VBoxBldProg_libproviders_inherit LIBRARIES += VBoxBldProg-$(sublib) VBoxBldProg-$(sublib) = bldRTSignTool version of $(sublib) VBoxBldProg-$(sublib)_EXTENDS = $(sublib) VBoxBldProg-$(sublib)_EXTENDS_BY = appending VBoxBldProg-$(sublib)_TEMPLATE = VBoxSubLibCryptoBldProg VBoxBldProg-$(sublib)_DEFPATH = $($(sublib)_DEFPATH) ## @todo kBuild: DEFPATH isn't inherited! FIXME! endef $(foreach sublib,$(VBOX_CRYPTO_PROVIDERS_SUBLIBS), $(eval $(def_VBoxBldProg_libproviders_inherit))) endif # VBOX_WITH_BLD_RTSIGNTOOL_SIGNING include $(FILE_KBUILD_SUB_FOOTER) # # Re-creates certain openssl headers which exist as templates. # OSSL_PROVIDERS_HDR_TEMPLATES := \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_digests.h.in \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_dsa.h.in \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_ec.h.in \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_ecx.h.in \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_rsa.h.in \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_sm2.h.in \ $(VBOX_PATH_CRYPTO_PROVIDERS)/common/include/prov/der_wrap.h.in # # Big fat @todo: # I'm too stupid atm to figure out how to get this executed sequentially # instead of getting it expanded and executed at once... # recreate-providers-headers: $(VBOX_PATH_OPENSSL)/util/dofile.pl \ $(OSSL_PROVIDERS_HDR_TEMPLATES) \ recreate-providers-der-sources $(foreach header, $(OSSL_PROVIDERS_HDR_TEMPLATES), \ perl \ -I$(VBOX_PATH_OPENSSL) \ -I$(VBOX_PATH_OPENSSL)/util/perl \ -I$(VBOX_PATH_CRYPTO_PROVIDERS)/common/der \ -Mconfigdata -Moids_to_c $(VBOX_PATH_OPENSSL)/util/dofile.pl -oMakefile \ $(header) > $(VBOX_PATH_OPENSSL)/gen-includes/prov/$(basename $(notdir $(header)));))