On Fri, Aug 16, 2024 at 01:34:18PM +0800, Gary Lin wrote: > On Wed, Aug 14, 2024 at 05:34:52PM +0200, Daniel Kiper wrote: > > On Fri, Jun 28, 2024 at 04:18:43PM +0800, Gary Lin via Grub-devel wrote: > > > GIT repo for v18: https://github.com/lcp/grub2/tree/tpm2-unlock-v18 > > > > > > This patch series is based on "Automatic TPM Disk Unlock"(*1) posted by > > > Hernan Gatta to introduce the key protector framework and TPM2 stack > > > to GRUB2, and this could be a useful feature for the systems to > > > implement full disk encryption. > > > > > > To support TPM 2.0 Key File format(*2), patch 1~6,8-10 are grabbed from > > > Daniel Axtens's "appended signature secure boot support" (*3) to import > > > libtasn1 into grub2. Besides, the libtasn1 version is upgraded to > > > 4.19.0 instead of 4.16.0 in the original patch. > > > > Build of this version fails in the following way: > > > > arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W > > -DGRUB_MACHINE_EFI=1 -DGRUB_MACHINE=ARM_EFI -mword-relocations -nostdinc > > -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/6/include -I../include > > -I../include -DGRUB_FILE=\"commands/tpm2_key_protector/args.c\" -I. -I. > > -I.. -I.. -I../include -I../include -I../grub-core/lib/libgcrypt-grub/src/ > > -I./lib/tss2 -I./lib/libtasn1-grub -D_FILE_OFFSET_BITS=64 -std=gnu99 > > -fno-common -Os -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts > > -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero > > -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit > > -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces > > -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type > > -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs > > -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label > > -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings > > -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls > > -Wmissing-prototypes -Wmissing-declarations -Wcast-align -Wextra > > -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch > > -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla > > -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros > > -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs > > -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -freg-struct-return > > -msoft-float -fno-omit-frame-pointer -fno-dwarf2-cfi-asm > > -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-ident > > -mthumb-interwork -fno-PIE -fno-pie -fno-stack-protector > > -mno-unaligned-access -Wtrampolines -Werror -ffreestanding -MT > > commands/tpm2_key_protector/tpm2_key_protector_module-args.o -MD -MP -MF > > commands/tpm2_key_protector/.deps-core/tpm2_key_protector_module-args.Tpo > > -c -o commands/tpm2_key_protector/tpm2_key_protector_module-args.o `test -f > > 'commands/tpm2_key_protector/args.c' || echo > > './'`commands/tpm2_key_protector/args.c > > In file included from ../include/grub/misc.h:27:0, > > from commands/tpm2_key_protector/args.c:22: > > commands/tpm2_key_protector/args.c: In function > > ‘grub_tpm2_protector_parse_pcrs’: > > commands/tpm2_key_protector/args.c:54:47: error: format ‘%lu’ expects > > argument of type ‘long unsigned int’, but argument 3 has type > > ‘grub_uint64_t {aka long long unsigned int}’ [-Werror=format=] > > return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Entry %lu in PCR list is > > too large to be a PCR number, PCR numbers range from 0 to %u"), pcr, > > TPM_MAX_PCRS); > > ^ > > ../include/grub/i18n.h:66:17: note: in definition of macro ‘N_’ > > #define N_(str) str > > ^~~ > > commands/tpm2_key_protector/args.c: In function > > ‘grub_tpm2_protector_parse_tpm_handle’: > > commands/tpm2_key_protector/args.c:125:50: error: format ‘%lu’ expects > > argument of type ‘long unsigned int’, but argument 3 has type > > ‘grub_uint64_t {aka long long unsigned int}’ [-Werror=format=] > > return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Value %lu is too large > > to be a TPM handle, TPM handles are unsigned 32-bit integers"), num); > > ^ > > ../include/grub/i18n.h:66:17: note: in definition of macro ‘N_’ > > #define N_(str) str > > ^~~ > > > > I think you can drop N_() macros here and use PRIuGRUB_UINT64_T instead of > > "%lu". > > The N_() marcors are dropped in my WIP branch per Vladimir's comment. > I'll fix the type error in the next version.
One thing, you should drop N_()/_() macros only from very technical messages which can be difficult to translate and to understand by average user. Daniel PS Please do not post next version of patches until I finish reviewing this version. I hope I will be able to do it by the end of next week. _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel