Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ftpm #7054

Closed
wants to merge 27 commits into from
Closed

Ftpm #7054

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c4c22f0
tee_api_types.h: default alignment for TEE_BigIntFMMContext
jenswi-linaro Oct 16, 2024
9e9a472
libmbedtls: mbedtls_config_uta.h: enable SHA-384 and SHA-512 support
jenswi-linaro Sep 26, 2024
472fcb2
mk/subdir.mk: refactor process-subdir-{srcs-y,gensrcs-helper}
jenswi-linaro Sep 19, 2024
f9f61da
ta_dev_kit.mk: use spec-srcs and spec-out-dir
jenswi-linaro Sep 19, 2024
d9517f8
mk: introduce global-incdirs_ext-y
jenswi-linaro Sep 19, 2024
2d6d835
mk/subdir.mk: introduce srcs_ext-y and srcs_ext_base-y
jenswi-linaro Sep 19, 2024
bace052
ta: ftpm: import initial source
jenswi-linaro Sep 18, 2024
e282593
ftpm: import TEE crypto API wrappers
jenswi-linaro Sep 18, 2024
aaf5a95
ftpm: fixup TEE crypto API wrappers
jenswi-linaro Oct 15, 2024
9fa7212
ftpm: implement hashlib using mbedtls
jenswi-linaro Sep 26, 2024
67d099e
ftpm: build the in-tree TA
jenswi-linaro Sep 19, 2024
aed2671
ftpm: add secure storage TA flag
jenswi-linaro Sep 20, 2024
2d8527f
ftpm: PlatformData: remove redundant s_NV*
jenswi-linaro Sep 24, 2024
fd99d4a
ftpm: _plat__Fail() fix __noreturn
jenswi-linaro Sep 24, 2024
6b902d4
ftpm: fix conflicting types for _plat__NvMemoryWrite()
jenswi-linaro Sep 24, 2024
b0dfcf8
ftpm: remove _plat__Signal_PowerOn() from fTPM.h
jenswi-linaro Sep 24, 2024
d0dcb63
ftpm: remove TA_ALL_PARAM_TYPE() from fTPM.c
jenswi-linaro Sep 24, 2024
d5f77af
ftpm: move user_ta_header_defines.h to include
jenswi-linaro Sep 24, 2024
10a516e
ftpm: remove redundant to{upp,low}er() declarations
jenswi-linaro Sep 24, 2024
ab498ff
ftpm: provide and use ftpm_ta.h
jenswi-linaro Sep 25, 2024
fee31fc
ftpm: remove TpmProfile.h
jenswi-linaro Sep 25, 2024
052109c
ftpm: update sub.mk to make it compile
jenswi-linaro Sep 24, 2024
d6bdcf5
ftpm: remove unused RuntimeSupport.c
jenswi-linaro Sep 24, 2024
85d1819
ftpm: remove unused wolfssl crypto wrappers
jenswi-linaro Sep 19, 2024
4b7e1e6
ftpm: remove unused sub.mk files
jenswi-linaro Sep 24, 2024
b0a3d15
ftpm: Makefile: update for building externally
jenswi-linaro Oct 1, 2024
6b5c2d0
ftpm: disable PPI emulation by default
jenswi-linaro Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ include ta/mk/build-user-ta.mk
endef
$(foreach t, $(sort $(wildcard ta/*/user_ta.mk)), $(eval $(call build-user-ta,$(t))))
endif
ifneq ($(CFG_MS_TPM_20_REF),)
ta-mk-file := ta/ftpm/ftpm_user_ta.mk
include ta/mk/build-user-ta.mk
endif
endif

include mk/cleandirs.mk
Expand Down
2 changes: 2 additions & 0 deletions lib/libmbedtls/include/mbedtls_config_uta.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#define MBEDTLS_SHA1_C
#define MBEDTLS_SHA256_C
#define MBEDTLS_SHA384_C
#define MBEDTLS_SHA512_C
#define MBEDTLS_MD_C
#define MBEDTLS_MD5_C

Expand Down
2 changes: 1 addition & 1 deletion lib/libutee/include/tee_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ typedef uint32_t TEE_BigInt;

typedef uint32_t TEE_BigIntFMM;

typedef uint32_t TEE_BigIntFMMContext __aligned(__alignof__(void *));
typedef uint32_t TEE_BigIntFMMContext;

/* Tee Secure Element APIs */

Expand Down
3 changes: 1 addition & 2 deletions mk/compile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ $2: $1 FORCE-GENSRC$(sm)

endef

$(foreach f, $(srcs), $(eval $(call \
process_srcs,$(f),$(out-dir)/$(base-prefix)$$(basename $f).o)))
$(foreach f, $(srcs), $(eval $(call process_srcs,$(f),$$(oname-$(sm)-$(f)))))

# Handle generated source files, that is, files that are compiled from out-dir
$(foreach f, $(gen-srcs), $(eval $(call process_srcs,$(f),$$(basename $f).o)))
Expand Down
117 changes: 57 additions & 60 deletions mk/subdir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,18 @@ asm-defines-files :=

uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))

define process-subdir-srcs-y
ifeq ($$(sub-dir),.)
srcs += $1
oname := $(out-dir)/$(base-prefix)$(basename $1).o
else
ifneq ($(filter /%,$(1)),)
# $1 is an absolute path - start with "/"
srcs += $1
oname := $(out-dir)/$(base-prefix)$(basename $1).o
else
srcs += $(sub-dir)/$1
oname := $(out-dir)/$(base-prefix)$(basename $$(sub-dir)/$1).o
endif
endif
cflags-$$(oname) := $$(cflags-y) $$(cflags-$(1)-y)
cflags-remove-$$(oname) := $$(cflags-remove-y) \
$$(cflags-remove-$(1)-y)
cxxflags-$$(oname) := $$(cxxflags-y) $$(cxxflags-$(1)-y)
cxxflags-remove-$$(oname) := $$(cxxflags-remove-y) \
$$(cxxflags-remove-$(1)-y)
cppflags-$$(oname) := $$(cppflags-y) $$(cppflags-$(1)-y)
cppflags-remove-$$(oname) := $$(cppflags-remove-y) \
$$(cppflags-remove-$(1)-y)
aflags-$$(oname) := $$(aflags-y) $$(aflags-$(1)-y)
aflags-remove-$$(oname) := $$(aflags-remove-y) \
$$(aflags-remove-$(1)-y)
incdirs-$$(oname) := $$(thissubdir-incdirs) $$(addprefix $(sub-dir)/,$$(incdirs-$(1)-y))
define process-file-vars-helper
# $1 is local source file name
# $2 is output file name
cflags-$(2) := $$(cflags-y) $$(cflags-$(1)-y)
cflags-remove-$(2) := $$(cflags-remove-y) $$(cflags-remove-$(1)-y)
cxxflags-$(2) := $$(cxxflags-y) $$(cxxflags-$(1)-y)
cxxflags-remove-$(2) := $$(cxxflags-remove-y) $$(cxxflags-remove-$(1)-y)
cppflags-$(2) := $$(cppflags-y) $$(cppflags-$(1)-y)
cppflags-remove-$(2) := $$(cppflags-remove-y) $$(cppflags-remove-$(1)-y)
aflags-$(2) := $$(aflags-y) $$(aflags-$(1)-y)
aflags-remove-$(2) := $$(aflags-remove-y) $$(aflags-remove-$(1)-y)
incdirs-$(2) := $$(thissubdir-incdirs) $$(addprefix $(sub-dir)/,$$(incdirs-$(1)-y))
# Clear local filename specific variables to avoid accidental reuse
# in another subdirectory
cflags-$(1)-y :=
Expand All @@ -64,8 +49,44 @@ cppflags-lib-y :=
aflags-$(1)-y :=
aflags-remove-$(1)-y :=
incdirs-$(1)-y :=
fname :=
oname :=
endef #process-file-vars-helper

define process-file-vars
# $1 is local source file name
# $2 is output file name
# $3 is tree source file name
oname-$(sm)-$3 := $$(if $$(oname-$1-y),$(out-dir)/$(base-prefix)/$$(oname-$1-y),$2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is oname-<file-name>-y defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's supposed to be set in the sub.mk file if used.

Copy link
Contributor

@etienne-lms etienne-lms Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easy to guess. If there was an example in the inline description above, it could maybe help.
(edited)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discard my last comment. I missed to look at the commit message that defines how oname-<filename>-y should be used.

$$(eval $$(call process-file-vars-helper,$1,$$(oname-$(sm)-$3)))
endef

define process-subdir-srcs-y
ifeq ($$(sub-dir),.)
srcs += $1
fname := $1
oname := $(out-dir)/$(base-prefix)$(basename $1).o
else
ifneq ($(filter /%,$(1)),)
# $1 is an absolute path - start with "/"
srcs += $1
fname := $1
oname := $(out-dir)/$(base-prefix)$(basename $1).o
else
srcs += $(sub-dir)/$1
fname := $(sub-dir)/$1
oname := $(out-dir)/$(base-prefix)$(basename $$(sub-dir)/$1).o
endif
endif
$$(eval $$(call process-file-vars,$1,$$(oname),$$(fname)))
endef #process-subdir-srcs-y

define process-subdir-srcs_ext-y
ifneq ($(filter /%,$(1)),)
$$(error Absolute path not supported for srcs_ext-y: $(1))
endif
srcs += $2/$1
fname := $2/$1
oname := $(out-dir)/$(base-prefix)$(basename $$(sub-dir)/$1).o
$$(eval $$(call process-file-vars,$1,$$(oname),$$(fname)))
endef #process-subdir-srcs-y

define process-subdir-gensrcs-helper
Expand All @@ -90,36 +111,7 @@ $2: $$(depends-$1)
$(q)mkdir -p $4
$(q)$$(recipe-$2)

cflags-$$(oname) := $$(cflags-y) $$(cflags-$(1)-y)
cflags-remove-$$(oname) := $$(cflags-remove-y) \
$$(cflags-remove-$(1)-y)
cxxflags-$$(oname) := $$(cxxflags-y) $$(cxxflags-$(1)-y)
cxxflags-remove-$$(oname) := $$(cxxflags-remove-y) \
$$(cxxflags-remove-$(1)-y)
cppflags-$$(oname) := $$(cppflags-y) $$(cppflags-$(1)-y)
cppflags-remove-$$(oname) := $$(cppflags-remove-y) \
$$(cppflags-remove-$(1)-y)
aflags-$$(oname) := $$(aflags-y) $$(aflags-$(1)-y)
aflags-remove-$$(oname) := $$(aflags-remove-y) \
$$(aflags-remove-$(1)-y)
incdirs-$$(oname) := $$(thissubdir-incdirs) $$(addprefix $(sub-dir)/,$$(incdirs-$(1)-y))
# Clear local filename specific variables to avoid accidental reuse
# in another subdirectory
cflags-$(1)-y :=
cflags-remove-$(1)-y :=
cflags-lib-y :=
cxxflags-$(1)-y :=
cxxflags-remove-$(1)-y :=
cxxflags-lib-y :=
cppflags-$(1)-y :=
cppflags-remove-$(1)-y :=
cppflags-lib-y :=
aflags-$(1)-y :=
aflags-remove-$(1)-y :=
incdirs-$(1)-y :=
fname :=
oname :=

jforissier marked this conversation as resolved.
Show resolved Hide resolved
$$(eval $$(call process-file-vars,$1,$$(oname)))
endef #process-subdir-gensrcs-helper

define process-subdir-gensrcs-y
Expand All @@ -140,7 +132,7 @@ endif

include $1/sub.mk
sub-subdirs := $$(addprefix $1/,$$(subdirs-y)) $$(subdirs_ext-y)
incdirs$(sm) := $(incdirs$(sm)) $$(addprefix $1/,$$(global-incdirs-y))
incdirs$(sm) := $(incdirs$(sm)) $$(addprefix $1/,$$(global-incdirs-y)) $$(global-incdirs_ext-y)
thissubdir-incdirs := $(out-dir)/$(base-prefix)$1 $$(addprefix $1/,$$(incdirs-y)) $$(incdirs_ext-y)
ifneq ($$(libname),)
incdirs-lib$$(libname)-$$(sm) := $$(incdirs-lib$$(libname)-$$(sm)) $$(addprefix $1/,$$(incdirs-lib-y))
Expand All @@ -152,9 +144,13 @@ endif
# Process files in current directory
$$(foreach g, $$(gensrcs-y), $$(eval $$(call process-subdir-gensrcs-y,$$(g))))
$$(foreach s, $$(srcs-y), $$(eval $$(call process-subdir-srcs-y,$$(s))))
$$(foreach s, $$(srcs_ext-y), $$(eval $$(call \
process-subdir-srcs_ext-y,$$(s),$$(firstword $$(srcs_ext_base-y)))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use firstword on external source base directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the best action if srcs_ext_base-y has more than one word? Error out or ignore it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder. It would be a programming error, indeed, and expended sources would not be build likely leading to some linkage error.
I guess ignoring it here is enough.

$$(foreach a, $$(asm-defines-y), $$(eval $$(call process-subdir-asm-defines-y,$$(a))))
# Clear flags used when processing current directory
srcs-y :=
srcs_ext-y :=
srcs_ext_base-y :=
cflags-y :=
cflags-lib-y :=
cxxflags-y :=
Expand All @@ -168,6 +164,7 @@ aflags-remove-y :=
subdirs-y :=
subdirs_ext-y :=
global-incdirs-y :=
global-incdirs_ext-y :=
incdirs-lib-y :=
incdirs-y :=
incdirs_ext-y :=
Expand Down
8 changes: 8 additions & 0 deletions ta/ftpm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BINARY=bc50d971-d4c9-42c4-82cb-343fb7f37896

-include $(TA_DEV_KIT_DIR)/mk/ta_dev_kit.mk

ifeq ($(wildcard $(TA_DEV_KIT_DIR)/mk/ta_dev_kit.mk), )
clean:
@echo 'Note: $$(TA_DEV_KIT_DIR)/mk/ta_dev_kit.mk not found, cannot clean TA'
endif
Loading
Loading