├── VERSION ├── deb ├── debian │ ├── compat │ ├── source │ │ └── format │ ├── install │ ├── changelog │ ├── control │ ├── rules │ └── copyright ├── README └── Makefile ├── lsvmtool ├── somedir │ ├── file1 │ └── file2 ├── sample │ ├── dir0 │ │ └── dir0.txt │ ├── dir1 │ │ └── readme.txt │ ├── dir2 │ │ └── readme.txt │ └── readme.txt ├── cpiosplit │ ├── a.cpio │ ├── b.cpio │ ├── c.cpio.gz │ └── Makefile ├── dbxupdate.h ├── ext2tests.bat └── config.h ├── 3rdparty ├── gnuefi │ ├── sub.sed │ └── Makefile ├── Makefile ├── openssl │ ├── Makefile │ ├── efi │ │ ├── wrap │ │ └── include │ │ │ ├── sys │ │ │ └── types.h │ │ │ ├── math.h │ │ │ ├── memory.h │ │ │ ├── stdarg.h │ │ │ ├── strings.h │ │ │ ├── limits.h │ │ │ ├── assert.h │ │ │ ├── stddef.h │ │ │ └── errno.h │ └── linux │ │ └── Makefile ├── zlib │ ├── linux.mak │ ├── efi.mak │ ├── Makefile │ └── testzlib.c └── xz │ ├── testxz.c │ ├── lzmaextras.h │ └── Makefile ├── policy ├── final.policy ├── rootkey.policy ├── rootkeysb.policy ├── bootkey.policy ├── lsvmload.policy ├── bootkeysb.policy └── lsvmloadsb.policy ├── dbxupdate.bin ├── doc ├── LSVM_How_To.pdf ├── LSVM_How_To.docx ├── LSVM_Overview.pdf ├── LSVM_Overview.docx ├── howto │ ├── extendpcr4.txt │ ├── cpio.txt │ ├── efibootmgr.txt │ ├── vfatfs.txt │ ├── git.txt │ ├── preconfigure.txt │ ├── reinstall-shim-and-grub.txt │ ├── extendpcr7.txt │ ├── clonevm.txt │ ├── installing-ubuntu-16.04.txt │ ├── bootcrypt.txt │ ├── startup-script.txt │ └── cryptsetup.txt └── lsvm │ └── GNUmakefile ├── scripts ├── dev │ ├── distroname │ ├── gcc │ ├── sub │ ├── codereview │ ├── vimrc │ ├── kernelversion │ ├── chktabs │ ├── test_lsvmload │ ├── initenv │ └── bashrc ├── ubuntu │ ├── testlsvmaskpass │ ├── chown.hook │ ├── insmod.hook │ ├── lsvmaskpass.hook │ ├── lsvmaskpass │ └── patch_cryptroot.hook ├── rootdev ├── bootdev ├── centos │ ├── unpatch_initrd │ ├── patch_initrd │ └── update_grub_config ├── redhat │ ├── unpatch_initrd │ ├── patch_initrd │ └── update_grub_config ├── sles │ ├── unpatch_initrd │ └── patch_initrd ├── module-setup.sh ├── setuproot ├── prependlic ├── blkdev_utils └── install ├── binaries ├── lsvmtools-1.0.0-x86_64.tar.gz └── README.md ├── posix ├── readme.txt ├── Makefile ├── linux.mak ├── efi.mak ├── ctype.c ├── limits.c ├── include │ ├── math.h │ ├── memory.h │ ├── sys │ │ └── types.h │ ├── strings.h │ ├── fcntl.h │ ├── inttypes.h │ ├── assert.h │ ├── signal.h │ ├── stdbool.h │ ├── errno.h │ ├── limits.h │ ├── stdarg.h │ ├── stddef.h │ ├── stdint.h │ ├── dlfcn.h │ └── time.h ├── assert.c └── errno.c ├── lsvmutils ├── Makefile ├── linux.mak ├── efi.mak ├── alloc.c ├── inline.h ├── getopt.h ├── heap.c ├── efiblkdev.h ├── memblkdev.h ├── eficommon.h ├── chksum.h ├── cacheblkdev.h ├── dump.h ├── lsvmloadtrace.h ├── strlcpy.h ├── grubcfg.h ├── uefidbx.h ├── conf.h ├── exec.h ├── strlcat.h ├── pass.h ├── lsvmloadpolicy.h ├── error.h ├── error.c ├── efivarauth.h ├── vars.h ├── file.h ├── luksblkdev.h ├── heap.h └── print.h ├── lsvmload ├── LOGO ├── linkcheck ├── version.c ├── globals.c ├── config.h ├── efivfat.h ├── progress.h ├── espwrap.h ├── loadconf.h ├── kernel.h ├── image.h ├── dbxupdate.h ├── rootfs.h ├── shim.h ├── bootbio.h ├── luksbio.h ├── initrd.h ├── trace.h ├── progress.c ├── keys.h └── console.h ├── striplic ├── Makefile └── depend.mak ├── rpm ├── README ├── Makefile └── SPECS │ └── lsvmtools.spec ├── .gitignore └── LICENSE /VERSION: -------------------------------------------------------------------------------- 1 | 1.0.0 2 | -------------------------------------------------------------------------------- /deb/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /lsvmtool/somedir/file1: -------------------------------------------------------------------------------- 1 | 111111 -------------------------------------------------------------------------------- /lsvmtool/somedir/file2: -------------------------------------------------------------------------------- 1 | 222222 -------------------------------------------------------------------------------- /lsvmtool/sample/dir0/dir0.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deb/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /lsvmtool/sample/dir1/readme.txt: -------------------------------------------------------------------------------- 1 | This is dir1 2 | -------------------------------------------------------------------------------- /lsvmtool/sample/dir2/readme.txt: -------------------------------------------------------------------------------- 1 | This is dir2 2 | -------------------------------------------------------------------------------- /3rdparty/gnuefi/sub.sed: -------------------------------------------------------------------------------- 1 | s/\*(.reloc)/KEEP(&)/g 2 | -------------------------------------------------------------------------------- /deb/debian/install: -------------------------------------------------------------------------------- 1 | lsvmtools-1.0.0-x86_64 opt 2 | -------------------------------------------------------------------------------- /lsvmtool/sample/readme.txt: -------------------------------------------------------------------------------- 1 | This is my cpio archive. 2 | -------------------------------------------------------------------------------- /policy/final.policy: -------------------------------------------------------------------------------- 1 | #include "rootkey.policy" 2 | :CAP:11 3 | -------------------------------------------------------------------------------- /policy/rootkey.policy: -------------------------------------------------------------------------------- 1 | #include "bootkey.policy" 2 | :CAP:11 3 | -------------------------------------------------------------------------------- /policy/rootkeysb.policy: -------------------------------------------------------------------------------- 1 | #include "bootkeysb.policy" 2 | :CAP:11 3 | -------------------------------------------------------------------------------- /dbxupdate.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/dbxupdate.bin -------------------------------------------------------------------------------- /doc/LSVM_How_To.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/doc/LSVM_How_To.pdf -------------------------------------------------------------------------------- /doc/LSVM_How_To.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/doc/LSVM_How_To.docx -------------------------------------------------------------------------------- /doc/LSVM_Overview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/doc/LSVM_Overview.pdf -------------------------------------------------------------------------------- /doc/LSVM_Overview.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/doc/LSVM_Overview.docx -------------------------------------------------------------------------------- /scripts/dev/distroname: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep "^ID=" /etc/os-release | cut -d "=" -f2 | sed "s/\"//g" 3 | -------------------------------------------------------------------------------- /lsvmtool/cpiosplit/a.cpio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/lsvmtool/cpiosplit/a.cpio -------------------------------------------------------------------------------- /lsvmtool/cpiosplit/b.cpio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/lsvmtool/cpiosplit/b.cpio -------------------------------------------------------------------------------- /lsvmtool/cpiosplit/c.cpio.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/lsvmtool/cpiosplit/c.cpio.gz -------------------------------------------------------------------------------- /binaries/lsvmtools-1.0.0-x86_64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/lsvmtools/HEAD/binaries/lsvmtools-1.0.0-x86_64.tar.gz -------------------------------------------------------------------------------- /scripts/ubuntu/testlsvmaskpass: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export cryptsource=/dev/sda2 3 | export crypttarget=boot 4 | bash ./lsvmaskpass "" 5 | -------------------------------------------------------------------------------- /scripts/dev/gcc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -x /usr/bin/ccache ]; then 3 | /usr/bin/ccache /usr/bin/gcc $* 4 | else 5 | /usr/bin/gcc $* 6 | fi 7 | -------------------------------------------------------------------------------- /doc/howto/extendpcr4.txt: -------------------------------------------------------------------------------- 1 | UEFI extends PCR[4] as follows (from zeros): 2 | 3 | Extend(PCR4, SHA1(00000000)) 4 | Extend(PCR4, PEHASH(shimx64.efi) 5 | 6 | -------------------------------------------------------------------------------- /scripts/dev/sub: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i 3 | do 4 | tmpfile=$i.subbak 5 | cp $i ${tmpfile} 6 | sed -f /tmp/sub.sed ${tmpfile} > $i 7 | rm -f ${tmpfile} 8 | done 9 | -------------------------------------------------------------------------------- /deb/debian/changelog: -------------------------------------------------------------------------------- 1 | lsvmtools (1.0.0-1) unstable; urgency=medium 2 | 3 | * Initial release of lsvmtools 4 | 5 | -- Akash Gupta Wed, 18 Oct 2017 17:14:26 -0700 6 | -------------------------------------------------------------------------------- /scripts/dev/codereview: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i 3 | do 4 | cp $i $i.codereview 5 | echo "/*CODEREVIEW*/" >> $i.codereview 6 | cp $i.codereview $i 7 | rm -f $i.codereview 8 | done 9 | -------------------------------------------------------------------------------- /binaries/README.md: -------------------------------------------------------------------------------- 1 | LSVMTools Binary Distributions 2 | ============================== 3 | 4 | Binary Distributions 5 | -------------------- 6 | 7 | - [lsvmtools-1.0.0-x86_64.tar.gz](lsvmtools-1.0.0-x86_64.tar.gz) 8 | 9 | -------------------------------------------------------------------------------- /doc/howto/cpio.txt: -------------------------------------------------------------------------------- 1 | cp initrd initrd.gz 2 | 3 | gzip -d *.gz 4 | 5 | mkdir tmp 6 | 7 | cd tmp 8 | 9 | cpio -o < ../initrd 10 | 11 | # changes... 12 | 13 | find . | cpio --create --format='newc' > ../initrd.cpio 14 | -------------------------------------------------------------------------------- /posix/readme.txt: -------------------------------------------------------------------------------- 1 | posix 2 | 3 | Synopsis: 4 | POSIX implements various POSIX C interface to make it easier to port 5 | code that uses these interfaces. It was used to port OpenSSL, XZ, and 6 | ZLIB without requiring code changes. 7 | 8 | -------------------------------------------------------------------------------- /doc/howto/efibootmgr.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | efibootmgr 4 | 5 | # Delete the 0004 boot option. 6 | efibootmgr -b 4 -B 7 | 8 | # Add new boot entry: 9 | efibootmgr -c -g -d /dev/sda -p 1 -w -L lsvmload -l /EFI/boot/lsvmloadx64.efi 10 | -------------------------------------------------------------------------------- /scripts/dev/vimrc: -------------------------------------------------------------------------------- 1 | :highlight Comment ctermfg=green 2 | set shiftwidth=4 3 | set nowrapscan 4 | set autoindent 5 | set expandtab 6 | if has("autocmd") 7 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 8 | endif 9 | -------------------------------------------------------------------------------- /scripts/ubuntu/chown.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PREREQ="" 4 | 5 | prereqs() 6 | { 7 | echo "$PREREQ" 8 | } 9 | 10 | case $1 in 11 | prereqs) 12 | prereqs 13 | exit 0 14 | ;; 15 | esac 16 | 17 | . /usr/share/initramfs-tools/hook-functions 18 | 19 | copy_exec /bin/chown /bin 20 | -------------------------------------------------------------------------------- /scripts/ubuntu/insmod.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PREREQ="" 4 | 5 | prereqs() 6 | { 7 | echo "$PREREQ" 8 | } 9 | 10 | case $1 in 11 | prereqs) 12 | prereqs 13 | exit 0 14 | ;; 15 | esac 16 | 17 | . /usr/share/initramfs-tools/hook-functions 18 | 19 | copy_exec /sbin/insmod /sbin 20 | -------------------------------------------------------------------------------- /scripts/dev/kernelversion: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #kr1=`grep '\.*/vmlinuz-' /boot/grub/grub.cfg | head -n 1 | sed 's/.*vmlinuz-//g' | sed 's/-generic.*/-generic/g'` 3 | kernelrelease=`ls /boot/vmlinuz-* | sort | tail -1 | sed 's/.*vmlinuz-//g' | sed 's/-generic.*/-generic/g'` 4 | echo $kernelrelease 5 | -------------------------------------------------------------------------------- /3rdparty/Makefile: -------------------------------------------------------------------------------- 1 | 2 | define NL 3 | 4 | 5 | endef 6 | 7 | DIRS = gnuefi openssl xz zlib 8 | 9 | all: 10 | @ $(foreach i, $(DIRS), $(MAKE) -C $(i) $(NL) ) 11 | 12 | clean: 13 | @ $(foreach i, $(DIRS), $(MAKE) -C $(i) clean $(NL) ) 14 | 15 | distclean: 16 | @ $(foreach i, $(DIRS), $(MAKE) -C $(i) distclean $(NL) ) 17 | 18 | -------------------------------------------------------------------------------- /scripts/dev/chktabs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TAB=`echo -e '\t'` 4 | 5 | for i 6 | do 7 | MSG=`grep -H -n -m 1 "$TAB" $i | sed 's/:\([0-9][0-9]*\):.*/(\1)/g'` 8 | grep -q "$TAB" $i 9 | if [ "$?" == "0" ]; then 10 | echo "$MSG: illegal tab character" 11 | exit 1 12 | fi 13 | done 14 | 15 | exit 0 16 | -------------------------------------------------------------------------------- /posix/Makefile: -------------------------------------------------------------------------------- 1 | include ../defs.mak 2 | 3 | all: 4 | $(MAKE) -f efi.mak 5 | $(MAKE) -f linux.mak 6 | 7 | clean: 8 | $(MAKE) -f efi.mak clean 9 | $(MAKE) -f linux.mak clean 10 | 11 | distclean: clean 12 | rm -f depend.mak 13 | 14 | depend: 15 | $(MAKE) -f efi.mak depend 16 | $(MAKE) -f linux.mak depend 17 | 18 | install: 19 | -------------------------------------------------------------------------------- /lsvmutils/Makefile: -------------------------------------------------------------------------------- 1 | include ../defs.mak 2 | 3 | all: 4 | $(MAKE) -f linux.mak 5 | $(MAKE) -f efi.mak 6 | 7 | depend: 8 | $(MAKE) -f linux.mak depend 9 | $(MAKE) -f efi.mak depend 10 | 11 | clean: 12 | $(MAKE) -f linux.mak clean 13 | $(MAKE) -f efi.mak clean 14 | 15 | distclean: clean 16 | rm -f depend.mak 17 | 18 | install: 19 | -------------------------------------------------------------------------------- /lsvmload/LOGO: -------------------------------------------------------------------------------- 1 | _ ______ ____ __ _ _ 2 | | | / ___\ \ / / \/ | | | ___ __ _ __| | 3 | | | \___ \\ \ / /| |\/| | | | / _ \ / _` |/ _` | 4 | | |___ ___) |\ V / | | | | | |__| (_) | (_| | (_| | 5 | |_____|____/ \_/ |_| |_| |_____\___/ \__,_|\__,_| 6 | 7 | -------------------------------------------------------------------------------- /scripts/ubuntu/lsvmaskpass.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PREREQ="" 4 | 5 | prereqs() 6 | { 7 | echo "$PREREQ" 8 | } 9 | 10 | case $1 in 11 | prereqs) 12 | prereqs 13 | exit 0 14 | ;; 15 | esac 16 | 17 | . /usr/share/initramfs-tools/hook-functions 18 | 19 | copy_exec /lib/cryptsetup/scripts/lsvmaskpass /lib/cryptsetup/scripts/lsvmaskpass 20 | -------------------------------------------------------------------------------- /striplic/Makefile: -------------------------------------------------------------------------------- 1 | include ../defs.mak 2 | 3 | DIRECTORY=striplic 4 | 5 | DEFINES += 6 | 7 | INCLUDES += 8 | 9 | CFLAGS = -c -Wall -g -O3 10 | CFLAGS += -Werror 11 | CFLAGS += $(LINUX_CFLAGS) 12 | 13 | SOURCES += main.c 14 | 15 | OBJECTS = $(SOURCES:.c=.o) 16 | 17 | PROGRAM=striplic 18 | 19 | include ../rules.mak 20 | 21 | distclean: 22 | -------------------------------------------------------------------------------- /rpm/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a Makefile for creating an lsvmtools RPM package. 3 | 4 | There are two steps: 5 | 6 | (1) Copy a signed version of LSVMLOAD to: 7 | 8 | lsvmtools/lsvmload/lsvmload.signed.efi 9 | 10 | (2) Type "make" in this directory. 11 | 12 | The resulting RPM package will appear in this directory. 13 | 14 | -------------------------------------------------------------------------------- /deb/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a Makefile for creating an lsvmtools DEB package. 3 | 4 | There are two steps: 5 | 6 | (1) Copy a signed version of LSVMLOAD to: 7 | 8 | lsvmtools/lsvmload/lsvmload.signed.efi 9 | 10 | (2) Type "RELEASE=1 make" in this directory. 11 | 12 | The resulting DEB package will appear in this directory. 13 | 14 | -------------------------------------------------------------------------------- /lsvmload/linkcheck: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tmpfile=`/bin/mktemp` 4 | 5 | nm lsvmload.so | grep "\" | grep -v "vendor_dbx_size_priv" | grep -v "vendor_cert_size_priv" | sed 's/^[ \t]*\/unresolved reference:/g' > ${tmpfile} 6 | 7 | grep "unresolved reference" ${tmpfile} 8 | 9 | if [ "$?" == "0" ]; then 10 | rm -f ${tmpfile} 11 | exit 1 12 | fi 13 | 14 | rm -f ${tmpfile} 15 | -------------------------------------------------------------------------------- /doc/howto/vfatfs.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Creating a VFAT file system on a file: 4 | 5 | dd if=/dev/zero of=espimage bs=512 count=20000 6 | losetup /dev/loop0 espimage 7 | mkfs.vfat /dev/loop0 8 | mkdir /mnt/espimage 9 | mount /dev/loop0 /mnt/espimage 10 | ( cd /boot/efi; tar cf - EFI) | ( cd /mnt/espimage; tar xf - ) 11 | umount /mnt/espimage 12 | losetup -d /dev/loop0 13 | -------------------------------------------------------------------------------- /policy/bootkey.policy: -------------------------------------------------------------------------------- 1 | 8BE4DF6193CA11D2AA0D00E098032B8C-SecureBoot.False:EFIVAR:7 2 | 8BE4DF6193CA11D2AA0D00E098032B8C-PK:EFIVAR:7 3 | 8BE4DF6193CA11D2AA0D00E098032B8C-KEK:EFIVAR:7 4 | D719B2CB3D3A4596A3BCDAD00E67656F-db:EFIVAR:7 5 | D719B2CB3D3A4596A3BCDAD00E67656F-dbx:EFIVAR:7 6 | SEPARATOR:BINARY:7 7 | ALLOW_PREBOOT_SEALING:BINARY:11 8 | LINUX_SCENARIO_ID:BINARY:11 9 | LINUX_SCENARIO_VERSION:BINARY:11 10 | -------------------------------------------------------------------------------- /policy/lsvmload.policy: -------------------------------------------------------------------------------- 1 | 8BE4DF6193CA11D2AA0D00E098032B8C-SecureBoot.False:EFIVAR:7 2 | 8BE4DF6193CA11D2AA0D00E098032B8C-PK:EFIVAR:7 3 | 8BE4DF6193CA11D2AA0D00E098032B8C-KEK:EFIVAR:7 4 | D719B2CB3D3A4596A3BCDAD00E67656F-db:EFIVAR:7 5 | D719B2CB3D3A4596A3BCDAD00E67656F-dbx:EFIVAR:7 6 | SEPARATOR:BINARY:7 7 | ALLOW_PREBOOT_SEALING:BINARY:11 8 | LINUX_SCENARIO_ID:BINARY:11 9 | LINUX_SCENARIO_VERSION:BINARY:11 10 | -------------------------------------------------------------------------------- /doc/howto/git.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Setting your username: 4 | 5 | git config credential.https://github.com.username USERNAME 6 | 7 | Cache your creds next time you type them: 8 | 9 | git config --global credential.helper "cache --timeout=3600" 10 | 11 | Checking out by date (this was the day GRUB was removed) 12 | 13 | git checkout `git rev-list -n 1 --before="2016-07-07 24:00:00" master 14 | -------------------------------------------------------------------------------- /posix/linux.mak: -------------------------------------------------------------------------------- 1 | include ../defs.mak 2 | 3 | DIRECTORY = posixlinux 4 | 5 | ARCHIVE = libposixlinux.a 6 | 7 | CFLAGS = -Wall -Werror -Os $(LINUX_CFLAGS) 8 | 9 | DEFINES += 10 | 11 | INCLUDES += -Iinclude 12 | 13 | SOURCES = assert.c ctype.c dlfcn.c errno.c limits.c stdio.c stdlib.c string.c time.c unistd.c 14 | 15 | OBJECTS = $(SOURCES:.c=.o) 16 | 17 | include ../rules.mak 18 | -include depend.mak 19 | 20 | install: 21 | -------------------------------------------------------------------------------- /doc/howto/preconfigure.txt: -------------------------------------------------------------------------------- 1 | Install dependencies: 2 | 3 | # apt-get install unzip 4 | # apt-get install make 5 | # apt-get install gcc 6 | # apt-get install g++ 7 | # apt-get install bison 8 | # apt-get install flex 9 | # apt-get install openssl 10 | # apt-get install libssl-dev 11 | # apt-get install gnu-efi 12 | # apt-get install automake 13 | # apt-get install python 14 | # apt-get install libgcrypt11-dev 15 | -------------------------------------------------------------------------------- /doc/howto/reinstall-shim-and-grub.txt: -------------------------------------------------------------------------------- 1 | 2 | # apt-get remove shim 3 | # apt-get remove shim-signed 4 | # apt-get install shim-signed 5 | # grub-install 6 | 7 | # cp /usr/lib/shim/shim.efi.signed /boot/efi/EFI/ubuntu/shimx64.efi 8 | # cp /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed /boot/efi/EFI/ubuntu/grubx64.efi 9 | # grub-mkconfig > /boot/grub/grub.cfg 10 | 11 | sudo update-grub 12 | sudo grub-install /dev/sda 13 | -------------------------------------------------------------------------------- /policy/bootkeysb.policy: -------------------------------------------------------------------------------- 1 | 8BE4DF6193CA11D2AA0D00E098032B8C-SecureBoot.True:EFIVAR:7 2 | 8BE4DF6193CA11D2AA0D00E098032B8C-PK:EFIVAR:7 3 | 8BE4DF6193CA11D2AA0D00E098032B8C-KEK:EFIVAR:7 4 | D719B2CB3D3A4596A3BCDAD00E67656F-db:EFIVAR:7 5 | D719B2CB3D3A4596A3BCDAD00E67656F-dbx:EFIVAR:7 6 | SEPARATOR:BINARY:7 7 | D719B2CB3D3A4596A3BCDAD00E67656F-db.Entry:EFIVAR:7 8 | ALLOW_PREBOOT_SEALING:BINARY:11 9 | LINUX_SCENARIO_ID:BINARY:11 10 | LINUX_SCENARIO_VERSION:BINARY:11 11 | -------------------------------------------------------------------------------- /policy/lsvmloadsb.policy: -------------------------------------------------------------------------------- 1 | 8BE4DF6193CA11D2AA0D00E098032B8C-SecureBoot.True:EFIVAR:7 2 | 8BE4DF6193CA11D2AA0D00E098032B8C-PK:EFIVAR:7 3 | 8BE4DF6193CA11D2AA0D00E098032B8C-KEK:EFIVAR:7 4 | D719B2CB3D3A4596A3BCDAD00E67656F-db:EFIVAR:7 5 | D719B2CB3D3A4596A3BCDAD00E67656F-dbx:EFIVAR:7 6 | SEPARATOR:BINARY:7 7 | D719B2CB3D3A4596A3BCDAD00E67656F-db.Entry:EFIVAR:7 8 | ALLOW_PREBOOT_SEALING:BINARY:11 9 | LINUX_SCENARIO_ID:BINARY:11 10 | LINUX_SCENARIO_VERSION:BINARY:11 11 | -------------------------------------------------------------------------------- /posix/efi.mak: -------------------------------------------------------------------------------- 1 | include ../defs.mak 2 | 3 | DIRECTORY = posix 4 | 5 | ARCHIVE = libposixefi.a 6 | 7 | CFLAGS = -Wall -Werror -Os $(EFI_CFLAGS) 8 | 9 | DEFINES += $(EFI_DEFINES) -DBUILD_EFI -DBUILDEFI 10 | 11 | INCLUDES += $(EFI_INCLUDES) -Iinclude 12 | 13 | SOURCES = assert.c ctype.c dlfcn.c errno.c limits.c stdio.c stdlib.c string.c time.c unistd.c 14 | 15 | OBJECTS = $(SOURCES:.c=.o) 16 | 17 | include ../rules.mak 18 | -include depend.mak 19 | 20 | install: 21 | -------------------------------------------------------------------------------- /doc/lsvm/GNUmakefile: -------------------------------------------------------------------------------- 1 | all: 2 | texi2dvi lsvm.texi 3 | dvipdf lsvm.dvi lsvm.pdf 4 | makeinfo lsvm.texi 5 | makeinfo --no-split --html lsvm.texi 6 | 7 | CLEAN = \ 8 | lsvm.aux \ 9 | lsvm.cp \ 10 | lsvm.dvi \ 11 | lsvm.fn \ 12 | lsvm.ky \ 13 | lsvm.log \ 14 | lsvm.pg \ 15 | lsvm.toc \ 16 | lsvm.tp \ 17 | lsvm.pdf \ 18 | lsvm.vr \ 19 | lsvm.info \ 20 | lsvm.html 21 | 22 | clean: 23 | rm -f $(CLEAN) 24 | -------------------------------------------------------------------------------- /doc/howto/extendpcr7.txt: -------------------------------------------------------------------------------- 1 | 2 | - The contents of the SecureBoot variable 3 | - The contents of the PK variable 4 | - The contents of the KEK variable 5 | - The contents of the EFI_IMAGE_SECURITY_DATABASE (db) variable 6 | - The contents of the EFI_IMAGE_SECURITY_DATABASE1 (dbx) variable 7 | 8 | Did not see these as expected: 9 | - Separator 10 | - Entries in the EFI_IMAGE_SECURITY_DATABASE that are used to validate EFI Drivers or EFI Boot Applications in the boot path 11 | -------------------------------------------------------------------------------- /scripts/dev/test_lsvmload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" != "2" ]; then 4 | printf "Usage: $0 \n" 5 | exit 1 6 | fi 7 | 8 | DEST="$1" 9 | GITADDR="$2" 10 | 11 | rm -rf vmshield vmshield.tar.gz 12 | git clone $GITADDR 13 | tar czf vmshield.tar.gz vmshield 14 | scp vmshield.tar.gz $DEST:~ 15 | ssh -t $DEST 'rm -rf vmshield && tar xf vmshield.tar.gz && cd vmshield && sudo ./scripts/dev/getdeps && ./configure && make && sudo make install && cd /opt/lsvmtools-1.0.0 && sudo ./lsvmprep && sleep 3' 16 | -------------------------------------------------------------------------------- /3rdparty/openssl/Makefile: -------------------------------------------------------------------------------- 1 | include ../../defs.mak 2 | 3 | OPENSSLDISTRO=$(OPENSSLPACKAGE).tar.gz 4 | 5 | all: $(OPENSSLDISTRO) 6 | $(MAKE) -C efi 7 | $(MAKE) -C linux 8 | 9 | clean: 10 | $(MAKE) -C efi clean 11 | $(MAKE) -C linux clean 12 | 13 | distclean: clean 14 | $(MAKE) -C efi distclean 15 | $(MAKE) -C linux distclean 16 | rm -f $(OPENSSLDISTRO) 17 | 18 | install: all 19 | $(MAKE) -C efi install 20 | $(MAKE) -C linux install 21 | 22 | $(OPENSSLDISTRO): 23 | wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz 24 | -------------------------------------------------------------------------------- /deb/debian/control: -------------------------------------------------------------------------------- 1 | Source: lsvmtools 2 | Section: utils 3 | Priority: optional 4 | Maintainer: Akash Gupta 5 | Build-Depends: debhelper (>=9) 6 | Standards-Version: 3.9.7 7 | Homepage: https://github.com/Microsoft/lsvmtools 8 | #Vcs-Git: git://anonscm.debian.org/collab-maint/lsvmtools.git 9 | #Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/lsvmtools.git 10 | 11 | Package: lsvmtools 12 | Architecture: amd64 13 | Depends: ${shlibs:Depends}, ${misc:Depends} 14 | Description: The LSVMTools package is for shielding Hyper-V Linux VMs. 15 | -------------------------------------------------------------------------------- /doc/howto/clonevm.txt: -------------------------------------------------------------------------------- 1 | 2 | To clone a Hyper-V VM: 3 | 4 | (1) Rename VM to the name you would like your clone to have: 5 | 6 | PS> Rename-VM ubuntu.v1 -NewName ubuntu.v2 7 | 8 | (2) Export the VM by right clicking and selecting "Export" 9 | 10 | (3) Now rename VM back to original name: 11 | 12 | PS> Rename-VM ubuntu.v2 -NewName ubuntu.v1 13 | 14 | (4) Right-click on host machine in left panel and select "Import" 15 | 16 | (5) Import the VM (it will have the name "ubuntu.v2" 17 | 18 | *The step above are to get around not being able to rename of VM when it is 19 | exported or imported. 20 | -------------------------------------------------------------------------------- /doc/howto/installing-ubuntu-16.04.txt: -------------------------------------------------------------------------------- 1 | For Ubuntu 16.04 Server 2 | 3 | Installing the OS with hyper-v keyboard. 4 | 1. Use the Unbuntu installer and choose default options until you get to partition your hard drive. 5 | 2. Choose the "encryption with LVM" option and continue the installation with default options. 6 | 3. When the installation finishes, don't continue and instead choose to go back. Execute the shell. 7 | 4. Do nano /target/etc/initramfs-tools/modules and type hyperv-keyboard. 8 | 5. Exit the shell (exit) and finish the installation. 9 | 10 | After you've installed Ubuntu, run this script at base directory as root. 11 | -------------------------------------------------------------------------------- /scripts/rootdev: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 4 | ## Check arguments: 5 | ## 6 | 7 | if [ "$#" != 0 ]; then 8 | echo "Usage $0" 9 | exit 1 10 | fi 11 | 12 | ## 13 | ## Get the block device from /boot path: 14 | ## 15 | . $(dirname "$0")/blkdev_utils 16 | path=/ 17 | dev=$(mount_to_blkdev $path) 18 | 19 | ## 20 | ## If /dev/mapper path, then convert to underyling partition name: 21 | ## 22 | 23 | echo $dev | grep /dev/mapper > /dev/null 24 | 25 | if [ "$?" == "0" ]; then 26 | part=$(logical_dev_to_physical_dev "$dev") 27 | if [ "$?" != 0 ]; then 28 | exit 1 29 | fi 30 | else 31 | part=$dev 32 | fi 33 | 34 | echo $part 35 | -------------------------------------------------------------------------------- /scripts/bootdev: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 4 | ## Check arguments: 5 | ## 6 | 7 | if [ "$#" != 0 ]; then 8 | echo "Usage $0" 9 | exit 1 10 | fi 11 | 12 | ## 13 | ## Get the block device from /boot path: 14 | ## 15 | . $(dirname "$0")/blkdev_utils 16 | path=/boot 17 | dev=$(mount_to_blkdev $path) 18 | 19 | ## 20 | ## If /dev/mapper path, then convert to underyling partition name: 21 | ## 22 | 23 | echo $dev | grep /dev/mapper > /dev/null 24 | 25 | if [ "$?" == "0" ]; then 26 | part=$(logical_dev_to_physical_dev "$dev") 27 | if [ "$?" != 0 ]; then 28 | exit 1 29 | fi 30 | else 31 | part=$dev 32 | fi 33 | 34 | echo $part 35 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/wrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ##============================================================================== 4 | ## 5 | ## Put conditional EFIBUILD wrapper around the given source file 6 | ## 7 | ##============================================================================== 8 | 9 | if [ "$#" != "1" ]; then 10 | echo "Usage: $0 sourcefile" 11 | exit 1 12 | fi 13 | 14 | if [ ! -f "$1" ]; then 15 | echo "$0: no such file" 16 | exit 1 17 | fi 18 | 19 | grep EFIBUILD $1 2> /dev/null > /dev/null 20 | 21 | if [ "$?" != "0" ]; then 22 | cp $1 $1.bak 23 | rm -f $1 24 | echo "#if !defined(EFIBUILD)" >> $1 25 | cat $1.bak >> $1 26 | echo "#endif /* !defined(EFIBUILD) */" >> $1 27 | fi 28 | -------------------------------------------------------------------------------- /doc/howto/bootcrypt.txt: -------------------------------------------------------------------------------- 1 | Encrypting the boot drive on Ubuntu: 2 | ==================================== 3 | 4 | These steps (followed carefully) encrypt the boot drive and install the 5 | Linux Shielded Virtual Machine (LSVM) components. After completing them, 6 | you should be able to reboot into a system with an encrypted boot parition. 7 | 8 | (1) Use the 'bootcrypt' script to convert the /boot partition to an 9 | encrypted parition. Instructions on how to update /etc/crypttab and 10 | /etc/fstab are printed to standard output. 11 | 12 | (2) Build and install LSVM: 13 | 14 | # cd vmshield 15 | # make 16 | # make install 17 | 18 | (3) Reboot the system and hopefully it will boot from the encrypted drive. 19 | 20 | # reboot 21 | 22 | -------------------------------------------------------------------------------- /scripts/centos/unpatch_initrd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | top=../.. 4 | 5 | if [ "$#" != "0" ]; then 6 | echo "Usage: $0" 7 | exit 1 8 | fi 9 | 10 | ##============================================================================== 11 | ## 12 | ## remove lsvmtool: 13 | ## 14 | ##============================================================================== 15 | 16 | dest=/sbin/lsvmtool 17 | rm -rf ${dest} 18 | 19 | ##============================================================================== 20 | ## 21 | ## remove module-setup.sh: 22 | ## 23 | ##============================================================================== 24 | 25 | dracut_module=90lsvm 26 | dracut_module_path=/usr/lib/dracut/modules.d/${dracut_module} 27 | rm -rf ${dracut_module_path} 28 | -------------------------------------------------------------------------------- /scripts/redhat/unpatch_initrd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | top=../.. 4 | 5 | if [ "$#" != "0" ]; then 6 | echo "Usage: $0" 7 | exit 1 8 | fi 9 | 10 | ##============================================================================== 11 | ## 12 | ## remove lsvmtool: 13 | ## 14 | ##============================================================================== 15 | 16 | dest=/sbin/lsvmtool 17 | rm -rf ${dest} 18 | 19 | ##============================================================================== 20 | ## 21 | ## remove module-setup.sh: 22 | ## 23 | ##============================================================================== 24 | 25 | dracut_module=90lsvm 26 | dracut_module_path=/usr/lib/dracut/modules.d/${dracut_module} 27 | rm -rf ${dracut_module_path} 28 | -------------------------------------------------------------------------------- /scripts/sles/unpatch_initrd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | top=../.. 4 | 5 | if [ "$#" != "0" ]; then 6 | echo "Usage: $0" 7 | exit 1 8 | fi 9 | 10 | ##============================================================================== 11 | ## 12 | ## remove lsvmtool: 13 | ## 14 | ##============================================================================== 15 | 16 | dest=/sbin/lsvmtool 17 | rm -rf ${dest} 18 | 19 | ##============================================================================== 20 | ## 21 | ## remove module-setup.sh: 22 | ## 23 | ##============================================================================== 24 | 25 | dracut_module=90lsvm 26 | dracut_module_path=/usr/lib/dracut/modules.d/${dracut_module} 27 | rm -rf ${dracut_module_path} 28 | -------------------------------------------------------------------------------- /doc/howto/startup-script.txt: -------------------------------------------------------------------------------- 1 | 2 | To generate a script that is run at start, add a file like this to /etc/init.d: 3 | 4 | #! /bin/sh 5 | ### BEGIN INIT INFO 6 | # Provides: lsvmspecialize 7 | # Required-Start: 8 | # Required-Stop: 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 11 | # Short-Description: Apply LSVM specializations. 12 | ### END INIT INFO 13 | 14 | PATH=/sbin:/usr/sbin:/bin:/usr/bin 15 | 16 | case "$1" in 17 | start) 18 | touch /.lsvmspecialize 19 | ;; 20 | stop) 21 | ;; 22 | *) 23 | echo "Usage: $0 start|stop" >&2 24 | exit 1 25 | ;; 26 | esac 27 | 28 | Then run: 29 | 30 | update-rc.d defaults 31 | 32 | -------------------------------------------------------------------------------- /deb/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | #export DH_VERBOSE = 1 5 | 6 | 7 | # see FEATURE AREAS in dpkg-buildflags(1) 8 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all 9 | 10 | # see ENVIRONMENT in dpkg-buildflags(1) 11 | # package maintainers to append CFLAGS 12 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 13 | # package maintainers to append LDFLAGS 14 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 15 | 16 | 17 | %: 18 | dh $@ 19 | 20 | 21 | # dh_make generated override targets 22 | # This is example for Cmake (See https://bugs.debian.org/641051 ) 23 | #override_dh_auto_configure: 24 | # dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) 25 | 26 | -------------------------------------------------------------------------------- /scripts/dev/initenv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | root=../.. 3 | 4 | cp bashrc $HOME/.bashrclsvm 5 | 6 | grep bashrclsvm $HOME/.bashrc 7 | 8 | if [ "$?" != "0" ]; then 9 | echo "source $HOME/.bashrclsvm" >> $HOME/.bashrc 10 | fi 11 | 12 | source $HOME/.bashrclsvm 13 | 14 | cp vimrc $HOME/.vimrc 15 | mkdir -p $HOME/bin 16 | cp sub $HOME/bin/sub 17 | cp gcc $HOME/bin/gcc 18 | 19 | ( cd $root/lsvmtool; sd; sd tool ) 20 | ( cd $root/policy; sd; sd p ) 21 | ( cd $root/lsvmload; sd; sd load ) 22 | ( cd $root/lsvmutils; sd; sd ut ) 23 | ( cd $root/3rdparty/zlib; sd ) 24 | ( cd $root/3rdparty/xz; sd ) 25 | ( cd $root/scripts; sd; sd s ) 26 | ( cd $root/doc/howto; sd; sd h ) 27 | ( cd $root; sd; sd r ) 28 | ( cd /boot/efi/EFI/boot; sd ) 29 | 30 | git config --global push.default matching 31 | 32 | export LSVMPREP_SEAL=1 33 | export LSVMPREP_DBXUPDATE=1 34 | -------------------------------------------------------------------------------- /deb/Makefile: -------------------------------------------------------------------------------- 1 | -include ../config.mak 2 | -include ../defs.mak 3 | 4 | NAME=lsvmtools 5 | 6 | DEBDIR=$(NAME)-$(VERSION) 7 | TARBALL=/tmp/$(DEBDIR)-x86_64.tar.gz 8 | BUILDFILES=debian 9 | 10 | all: 11 | $(MAKE) -s clean 12 | $(MAKE) -s configure 13 | $(MAKE) -s sources 14 | $(MAKE) -s get-build-deps 15 | $(MAKE) -s build 16 | 17 | clean: 18 | rm -rf $(DEBDIR) 19 | rm -rf $(TARBALL) 20 | rm -rf lsvmtools_* 21 | 22 | configure: 23 | @( cd ..; ./configure > /dev/null ) 24 | 25 | sources: 26 | @$(MAKE) -s -C .. bindist > /dev/null 27 | @mkdir $(DEBDIR) 28 | @tar xf $(TARBALL) -C $(DEBDIR) 29 | @rm -rf $(DEBDIR)/$(NAME)-$(VERSION)-x86_64/install 30 | 31 | get-build-deps: 32 | @apt-get -qq -y install build-essential dh-make devscripts 33 | 34 | build: 35 | @cp -r $(BUILDFILES) $(DEBDIR) 36 | @(cd $(DEBDIR) && yes | debuild -us -uc) 37 | -------------------------------------------------------------------------------- /scripts/module-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | check() 4 | { 5 | # Check if module exists 6 | if [ ! -f /lib/modules/$(uname -r)/kernel/drivers/char/tpm/tpm_crb.ko ]; then 7 | return 1 8 | fi 9 | 10 | # Check if /boot and / are encrypted. 11 | require_binaries cryptsetup || return 1 12 | 13 | mounts=$(mount -l | grep -E " /(boot)? " | cut -d " " -f1) 14 | printf "%s\n" "$mounts" | while read -r line; do 15 | part=$(lsblk -P -p -s "$line" | grep "TYPE=\"part\"" | cut -d " " -f1 | cut -d "=" -f2 | sed "s/\"//g"1) 16 | cryptsetup isLuks "$part" 17 | if [[ "$?" != 0 ]]; then 18 | return 1 19 | fi 20 | done 21 | 22 | return 0 23 | } 24 | 25 | install() 26 | { 27 | inst "lsvmtool" 28 | } 29 | 30 | installkernel() 31 | { 32 | hostonly='' instmods tpm_crb hyperv-keyboard xts 33 | } 34 | -------------------------------------------------------------------------------- /lsvmutils/linux.mak: -------------------------------------------------------------------------------- 1 | ROOT=.. 2 | include $(ROOT)/defs.mak 3 | 4 | DIRECTORY = lsvmutils 5 | 6 | ARCHIVE = liblsvmutils.a 7 | 8 | CFLAGS = -Wall -Werror -Os -Wno-trigraphs $(LINUX_CFLAGS) 9 | 10 | DEFINES = 11 | 12 | INCLUDES += -I$(TOP) 13 | INCLUDES += -I. 14 | INCLUDES += $(EFI_INCLUDES) 15 | INCLUDES += -I$(TOP)/3rdparty 16 | INCLUDES += -I$(TOP)/3rdparty/openssl/linux/$(OPENSSLPACKAGE)/include 17 | 18 | SOURCES = alloc.c buf.c conf.c error.c ext2.c file.c getopt.c peimage.c print.c sha.c strarr.c strings.c tcg2.c tpm2.c tpmbuf.c utils.c blkdev.c linuxblkdev.c luks.c dump.c luksblkdev.c gpt.c guid.c vfat.c memblkdev.c luksopenssl.c uefidb.c cpio.c initrd.c cacheblkdev.c grubcfg.c exec.c pass.c heap.c tpm2crypt.c keys.c uefidbx.c policy.c measure.c vars.c lsvmloadpolicy.c specialize.c 19 | 20 | OBJECTS = $(SOURCES:.c=.o) 21 | 22 | include ../rules.mak 23 | -include depend.mak 24 | -------------------------------------------------------------------------------- /lsvmutils/efi.mak: -------------------------------------------------------------------------------- 1 | ROOT=.. 2 | include $(ROOT)/defs.mak 3 | 4 | DIRECTORY = lsvmutilsefi 5 | 6 | ARCHIVE = liblsvmutilsefi.a 7 | 8 | CFLAGS = -Wall -Werror -Os $(EFI_CFLAGS) 9 | 10 | DEFINES = $(EFI_DEFINES) -DBUILD_EFI 11 | 12 | INCLUDES += -I. 13 | INCLUDES += -I$(TOP) 14 | INCLUDES += -I../posix/include 15 | INCLUDES += $(EFI_INCLUDES) 16 | INCLUDES += -I$(TOP)/3rdparty 17 | INCLUDES += -I$(TOP)/3rdparty/openssl/efi/$(OPENSSLPACKAGE)/include 18 | 19 | SOURCES = alloc.c buf.c conf.c error.c ext2.c getopt.c peimage.c print.c sha.c strarr.c strings.c tpmbuf.c utils.c tpm2.c tcg2.c dump.c luks.c efifile.c blkdev.c efiblkdev.c efibio.c luksblkdev.c gpt.c guid.c vfat.c memblkdev.c luksopenssl.c cpio.c initrd.c cacheblkdev.c grubcfg.c pass.c heap.c tpm2crypt.c keys.c measure.c policy.c vars.c lsvmloadpolicy.c uefidb.c specialize.c 20 | 21 | OBJECTS = $(SOURCES:.c=.o) 22 | 23 | include ../rules.mak 24 | -include depend.mak 25 | -------------------------------------------------------------------------------- /rpm/Makefile: -------------------------------------------------------------------------------- 1 | -include ../config.mak 2 | -include ../defs.mak 3 | 4 | NAME=lsvmtools 5 | 6 | TARBALL=$(NAME)-$(VERSION).tar.gz 7 | 8 | all: 9 | $(MAKE) -s clean 10 | $(MAKE) -s create-directories 11 | $(MAKE) -s configure 12 | $(MAKE) -s sources 13 | $(MAKE) -s build 14 | 15 | create-directories: 16 | mkdir -p BUILD RPMS SOURCES SRPMS 17 | 18 | clean: 19 | rm -rf SOURCES/* 20 | rm -rf ./RPMS/x86_64 21 | rm -rf BUILD RPMS SOURCES SRPMS 22 | rm -f lsvmtools-1.0.0-1.x86_64.rpm 23 | 24 | configure: 25 | @ ( cd ..; ./configure > /dev/null ) 26 | 27 | sources: 28 | @ $(MAKE) -s -C .. dist > /dev/null 29 | @ cp ../$(TARBALL) SOURCES 30 | @ echo "Created SPECS/$(TARBALL)" 31 | 32 | build: 33 | rpmbuild -v -bb --clean SPECS/lsvmtools.spec 34 | @ cp RPMS/x86_64/lsvmtools-1.0.0-1.x86_64.rpm . 35 | @ echo "Created lsvmtools-1.0.0-1.x86_64.rpm" 36 | 37 | install: 38 | rpm -i --nodeps --force lsvmtools-1.0.0-1.x86_64.rpm 39 | 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | # Debug files 32 | *.dSYM/ 33 | *.su 34 | 35 | # Temporary files 36 | 3rdparty/gnuefi/depend.mak 37 | 3rdparty/gnuefi/elf_x86_64_efi.lds 38 | 3rdparty/gnuefi/gnu-efi-3.0.2/ 39 | 3rdparty/openssl/efi/openssl-1.0.2g/ 40 | 3rdparty/openssl/linux/openssl-1.0.2g/ 41 | 3rdparty/openssl/openssl-1.0.2g.tar.gz 42 | 3rdparty/xz/depend.mak 43 | 3rdparty/xz/xz/ 44 | 3rdparty/zlib/depend.mak 45 | 3rdparty/zlib/zlib/ 46 | build/ 47 | config.mak 48 | lsvmload/depend.mak 49 | lsvmload/lsvmload.efi 50 | lsvmload/timestamp.c 51 | lsvmtool/depend.mak 52 | lsvmutils/depend.mak 53 | posix/depend.mak 54 | -------------------------------------------------------------------------------- /lsvmtool/cpiosplit/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: a ab ac abc 2 | 3 | include ../../defs.mak 4 | 5 | all: 6 | 7 | a: 8 | @ $(BINDIR)/lsvmtool cpio split a.cpio 9 | @ cmp a.cpio a.cpio.1 10 | @ echo "=== Passed a" 11 | 12 | ab: 13 | @ cat a.cpio b.cpio > ab.0 14 | @ $(BINDIR)/lsvmtool cpio split ab.0 15 | @ cmp a.cpio ab.0.1 16 | @ cmp b.cpio ab.0.2 17 | @ echo "=== Passed ab" 18 | 19 | ac: 20 | @ cat a.cpio c.cpio.gz > ac.0 21 | @ $(BINDIR)/lsvmtool cpio split ac.0 22 | @ cmp a.cpio ac.0.1 23 | @ cmp c.cpio.gz ac.0.2 24 | @ echo "=== Passed ac" 25 | 26 | abc: 27 | @ cat a.cpio b.cpio c.cpio.gz > abc.0 28 | @ $(BINDIR)/lsvmtool cpio split abc.0 29 | @ cmp a.cpio abc.0.1 30 | @ cmp b.cpio abc.0.2 31 | @ cmp c.cpio.gz abc.0.3 32 | @ echo "=== Passed abc" 33 | 34 | tests-silent: 35 | $(MAKE) -s a 36 | $(MAKE) -s ab 37 | $(MAKE) -s ac 38 | $(MAKE) -s abc 39 | 40 | tests: 41 | $(MAKE) -s tests-silent 42 | @ rm -rf *.[0-9] 43 | 44 | clean: 45 | @ rm -rf *.[0-9] 46 | -------------------------------------------------------------------------------- /3rdparty/zlib/linux.mak: -------------------------------------------------------------------------------- 1 | ROOT=../.. 2 | include $(ROOT)/defs.mak 3 | 4 | DIRECTORY = zliblinux 5 | 6 | ARCHIVE = libzliblinux.a 7 | 8 | CFLAGS = -Wall -Werror -Os -nostdinc $(LINUX_CFLAGS) 9 | 10 | DEFINES = -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -DNO_snprintf -DNO_vsnprintf 11 | 12 | INCLUDES += -I. 13 | INCLUDES += -I$(TOP) 14 | INCLUDES += -I$(TOP)/posix/include 15 | INCLUDES += -I$(TOP)/3rdparty/zlib/zlib 16 | 17 | SOURCES += zlib/adler32.c 18 | SOURCES += zlib/compress.c 19 | SOURCES += zlib/crc32.c 20 | SOURCES += zlib/deflate.c 21 | SOURCES += zlib/gzclose.c 22 | SOURCES += zlib/gzlib.c 23 | SOURCES += zlib/gzread.c 24 | SOURCES += zlib/gzwrite.c 25 | SOURCES += zlib/infback.c 26 | SOURCES += zlib/inffast.c 27 | SOURCES += zlib/inflate.c 28 | SOURCES += zlib/inftrees.c 29 | SOURCES += zlib/trees.c 30 | SOURCES += zlib/uncompr.c 31 | SOURCES += zlib/zutil.c 32 | SOURCES += zlibextras.c 33 | 34 | OBJECTS=$(SOURCES:.c=.o) 35 | 36 | include $(ROOT)/rules.mak 37 | -include depend.mak 38 | -------------------------------------------------------------------------------- /3rdparty/zlib/efi.mak: -------------------------------------------------------------------------------- 1 | ROOT=../.. 2 | include $(ROOT)/defs.mak 3 | 4 | DIRECTORY = zlibefi 5 | 6 | ARCHIVE = libzlibefi.a 7 | 8 | CFLAGS = -Wall -Werror -Os $(EFI_CFLAGS) 9 | 10 | DEFINES = -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -DNO_snprintf -DNO_vsnprintf $(EFI_DEFINES) -DBUILD_EFI 11 | 12 | INCLUDES += -I. 13 | INCLUDES += -I$(TOP) 14 | INCLUDES += -I$(TOP)/posix/include 15 | INCLUDES += -I$(TOP)/3rdparty/zlib/zlib 16 | INCLUDES += $(EFI_INCLUDES) 17 | 18 | SOURCES += zlib/adler32.c 19 | SOURCES += zlib/compress.c 20 | SOURCES += zlib/crc32.c 21 | SOURCES += zlib/deflate.c 22 | SOURCES += zlib/gzclose.c 23 | SOURCES += zlib/gzlib.c 24 | SOURCES += zlib/gzread.c 25 | SOURCES += zlib/gzwrite.c 26 | SOURCES += zlib/infback.c 27 | SOURCES += zlib/inffast.c 28 | SOURCES += zlib/inflate.c 29 | SOURCES += zlib/inftrees.c 30 | SOURCES += zlib/trees.c 31 | SOURCES += zlib/uncompr.c 32 | SOURCES += zlib/zutil.c 33 | SOURCES += zlibextras.c 34 | 35 | OBJECTS=$(SOURCES:.c=.o) 36 | 37 | include $(ROOT)/rules.mak 38 | -include depend.mak 39 | -------------------------------------------------------------------------------- /scripts/setuproot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Patching /etc/crypttab" 4 | 5 | root=$($(dirname "$0")/rootdev) 6 | if [[ -z "$root" ]]; then 7 | echo "$0: no root device" 8 | exit 1 9 | fi 10 | 11 | cryptroot="" 12 | while read l; do 13 | id=$(echo $l | cut -f2 -d " ") 14 | path="$id" 15 | # Either it's a path or a UUID prefix 16 | if [[ "${path:0:1}" != "/" ]]; then 17 | # UUID prefix. R 18 | path=$(echo -n "$path" | sed 's/UUID=//g') 19 | path=$(blkid -U "$path") 20 | fi 21 | path=$(readlink -f "$path") 22 | if [[ "$path" == "$root" ]]; then 23 | cryptroot="$id" 24 | break 25 | fi 26 | done < /etc/crypttab 27 | 28 | if [[ -z "$cryptroot" ]]; then 29 | # did not find root device. Patch it to /etc/crypttab 30 | printf "rootdev %s /etc/lsvmload/rootkey luks,discard", "$root" >> /etc/crypttab 31 | exit 0 32 | fi 33 | 34 | awk -v targ="$cryptroot" '{ if ($2 == targ) { $3="/etc/lsvmload/rootkey" }; print }' /etc/crypttab > /etc/crypttab.new 35 | mv /etc/crypttab.new /etc/crypttab 36 | exit 0 37 | -------------------------------------------------------------------------------- /scripts/centos/patch_initrd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | top=../.. 4 | 5 | if [ "$#" != "0" ]; then 6 | echo "Usage: $0" 7 | exit 1 8 | fi 9 | 10 | ##============================================================================== 11 | ## 12 | ## install lsvmtool: 13 | ## 14 | ##============================================================================== 15 | 16 | src=${top}/build/bin/lsvmtool 17 | dest=/sbin/lsvmtool 18 | install -D ${src} ${dest} 19 | 20 | if [ "$?" != "0" ]; then 21 | echo "$0: install failed: ${src} => ${dest}" 22 | exit 1 23 | fi 24 | 25 | ##============================================================================== 26 | ## 27 | ## install module-setup.sh: 28 | ## 29 | ##============================================================================== 30 | 31 | dracut_module=90lsvm 32 | dracut_module_path=/usr/lib/dracut/modules.d/${dracut_module} 33 | 34 | src=${top}/scripts/module-setup.sh 35 | dest=${dracut_module_path}/module-setup.sh 36 | install -D ${src} ${dest} 37 | if [ "$?" != "0" ]; then 38 | echo "$0: install failed: ${src} => ${dest}" 39 | exit 1 40 | fi 41 | -------------------------------------------------------------------------------- /scripts/redhat/patch_initrd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | top=../.. 4 | 5 | if [ "$#" != "0" ]; then 6 | echo "Usage: $0" 7 | exit 1 8 | fi 9 | 10 | ##============================================================================== 11 | ## 12 | ## install lsvmtool: 13 | ## 14 | ##============================================================================== 15 | 16 | src=${top}/build/bin/lsvmtool 17 | dest=/sbin/lsvmtool 18 | install -D ${src} ${dest} 19 | 20 | if [ "$?" != "0" ]; then 21 | echo "$0: install failed: ${src} => ${dest}" 22 | exit 1 23 | fi 24 | 25 | ##============================================================================== 26 | ## 27 | ## install module-setup.sh: 28 | ## 29 | ##============================================================================== 30 | 31 | dracut_module=90lsvm 32 | dracut_module_path=/usr/lib/dracut/modules.d/${dracut_module} 33 | 34 | src=${top}/scripts/module-setup.sh 35 | dest=${dracut_module_path}/module-setup.sh 36 | install -D ${src} ${dest} 37 | if [ "$?" != "0" ]; then 38 | echo "$0: install failed: ${src} => ${dest}" 39 | exit 1 40 | fi 41 | -------------------------------------------------------------------------------- /scripts/sles/patch_initrd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | top=../.. 4 | 5 | if [ "$#" != "0" ]; then 6 | echo "Usage: $0" 7 | exit 1 8 | fi 9 | 10 | ##============================================================================== 11 | ## 12 | ## install lsvmtool: 13 | ## 14 | ##============================================================================== 15 | 16 | src=${top}/build/bin/lsvmtool 17 | dest=/sbin/lsvmtool 18 | install -D ${src} ${dest} 19 | 20 | if [ "$?" != "0" ]; then 21 | echo "$0: install failed: ${src} => ${dest}" 22 | exit 1 23 | fi 24 | 25 | ##============================================================================== 26 | ## 27 | ## install module-setup.sh: 28 | ## 29 | ##============================================================================== 30 | 31 | dracut_module=90lsvm 32 | dracut_module_path=/usr/lib/dracut/modules.d/${dracut_module} 33 | 34 | src=${top}/scripts/module-setup.sh 35 | dest=${dracut_module_path}/module-setup.sh 36 | install -D ${src} ${dest} 37 | if [ "$?" != "0" ]; then 38 | echo "$0: install failed: ${src} => ${dest}" 39 | exit 1 40 | fi 41 | -------------------------------------------------------------------------------- /scripts/ubuntu/lsvmaskpass: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | lsvmaskpass() 4 | { 5 | if [ -z "${cryptsource}" ]; then 6 | echo "$0: cryptsource environment variable undefined" > /dev/stderr 7 | return 1 8 | fi 9 | 10 | if [ -z "${crypttarget}" ]; then 11 | echo "$0: crypttarget environment variable undefined" > /dev/stderr 12 | return 1 13 | fi 14 | 15 | if [ "${crypttarget}" == "boot" ]; then 16 | keyfile="/etc/lsvmload/bootkey"; 17 | else 18 | keyfile="/etc/lsvmload/rootkey"; 19 | fi 20 | 21 | if [ ! -f "${keyfile}" ]; then 22 | echo "$0: keyfile does not exist: $keyfile" > /dev/stderr 23 | return 1 24 | fi 25 | 26 | cat ${keyfile} | /sbin/cryptsetup luksOpen --test-passphrase --key-file=- ${cryptsource} ${crypttarget} 27 | 28 | if [ "$?" != "0" ]; then 29 | echo "$0: invalid passphrase: $keyfile" > /dev/stderr 30 | return 1 31 | fi 32 | 33 | cat $keyfile 34 | 35 | return 0 36 | } 37 | 38 | lsvmaskpass 39 | 40 | if [ "$?" != "0" ]; then 41 | /lib/cryptsetup/askpass "Please unlock disk: " 42 | fi 43 | -------------------------------------------------------------------------------- /scripts/prependlic: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This utility must be run in root of distro: 4 | 5 | if [ ! -d "lsvmload" ]; then 6 | echo "$0: must be run from root of source directory" 7 | exit 1 8 | fi 9 | 10 | if [ ! -f "LICENSE" ]; then 11 | echo "$0: LICENSE file not found" 12 | exit 1 13 | fi 14 | 15 | # Generate license.h: 16 | licensefile=`/bin/mktemp` 17 | echo "/*" >> $licensefile 18 | echo "**==============================================================================" >> $licensefile 19 | echo "**" >> $licensefile 20 | cat LICENSE | sed 's/.*/** &/g' >> $licensefile 21 | echo "**" >> $licensefile 22 | echo "**==============================================================================" >> $licensefile 23 | echo "*/" >> $licensefile 24 | 25 | # Prepend license.h to each file that does not already have it: 26 | files=`find . -name '*.[ch]'` 27 | for i in ${files} 28 | do 29 | grep -q "^\*\* MIT License" $i 30 | if [ "$?" != "0" ]; then 31 | echo "Patching $i" 32 | cat ${licensefile} > $i.bak 33 | cat $i >> $i.bak 34 | cp $i.bak $i 35 | rm -f $i.bak 36 | fi 37 | done 38 | -------------------------------------------------------------------------------- /scripts/centos/update_grub_config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # First, read the current grub cmdline args 4 | cmdline=$(grep "^GRUB_CMDLINE_LINUX=" /etc/default/grub) 5 | if [[ -z "$cmdline" ]]; then 6 | exit 1 7 | printf "GRUB_CMDLINE_LINUX=\"\"\n" >> /etc/default/grub 8 | cmdline=$(grep "^GRUB_CMDLINE_LINUX=" /etc/default/grub) 9 | fi 10 | newcmdline="${cmdline%\"}" 11 | 12 | # Now, read /etc/cryptab for possible UUIDS 13 | vars=$(awk '{ print $2 }' /etc/crypttab) 14 | for uuid in $vars; do 15 | if [[ ${uuid:0:4} != "UUID" ]]; then 16 | # Device name, use BLKID to figure out UUID 17 | uuid=$(blkid "$uuid" | grep -o "\&2 20 | exit 1 21 | fi 22 | fi 23 | 24 | uuid=${uuid:5} 25 | if [[ "$cmdline" =~ "rd.luks.uuid=$uuid" ]] || [[ "$cmdline" =~ "rd.luks.uuid=luks-$uuid" ]]; then 26 | # Found the uuid 27 | continue 28 | fi 29 | 30 | newcmdline+=" rd.luks.uuid=$uuid" 31 | done 32 | newcmdline+=\" 33 | sed -i "s#$cmdline#$newcmdline#g" /etc/default/grub 34 | -------------------------------------------------------------------------------- /scripts/redhat/update_grub_config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # First, read the current grub cmdline args 4 | cmdline=$(grep "^GRUB_CMDLINE_LINUX=" /etc/default/grub) 5 | if [[ -z "$cmdline" ]]; then 6 | exit 1 7 | printf "GRUB_CMDLINE_LINUX=\"\"\n" >> /etc/default/grub 8 | cmdline=$(grep "^GRUB_CMDLINE_LINUX=" /etc/default/grub) 9 | fi 10 | newcmdline="${cmdline%\"}" 11 | 12 | # Now, read /etc/cryptab for possible UUIDS 13 | vars=$(awk '{ print $2 }' /etc/crypttab) 14 | for uuid in $vars; do 15 | if [[ ${uuid:0:4} != "UUID" ]]; then 16 | # Device name, use BLKID to figure out UUID 17 | uuid=$(blkid "$uuid" | grep -o "\&2 20 | exit 1 21 | fi 22 | fi 23 | 24 | uuid=${uuid:5} 25 | if [[ "$cmdline" =~ "rd.luks.uuid=$uuid" ]] || [[ "$cmdline" =~ "rd.luks.uuid=luks-$uuid" ]]; then 26 | # Found the uuid 27 | continue 28 | fi 29 | 30 | newcmdline+=" rd.luks.uuid=$uuid" 31 | done 32 | newcmdline+=\" 33 | sed -i "s#$cmdline#$newcmdline#g" /etc/default/grub 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LSVMTools 2 | 3 | MIT License 4 | 5 | Copyright (c) Microsoft Corporation. All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE 24 | -------------------------------------------------------------------------------- /doc/howto/cryptsetup.txt: -------------------------------------------------------------------------------- 1 | 2 | Using cryptsetup to create an encrypted file system: 3 | ==================================================== 4 | 5 | $ wipefs -a 6 | 7 | $ cat /dev/zero > 8 | 9 | $ cryptsetup luksFormat 10 | 11 | $ cryptsetup luksDump 12 | 13 | $ cryptsetup luksOpen c1 # creates /dev/mapper/c1 14 | 15 | $ mke2fs -j /dev/mapper/c1 16 | 17 | $ mount /dev/mapper/c1 /mnt 18 | 19 | Creating a loop-device: 20 | ======================= 21 | head -c 100M /dev/zero > luksfile # create empty file 22 | losetup /dev/loop0 luksfile # map luksfile to /dev/loop0 23 | cryptsetup luksFormat --key-size 512 --hash sha256 /dev/loop0 24 | cryptsetup luksOpen /dev/loop0 luks 25 | mke2fs -j /dev/mapper/luks 26 | mount /dev/mapper/luks /mnt/luks 27 | 28 | Detaching a loop device: 29 | ======================== 30 | losetup -d /dev/loop0 # unmap 31 | 32 | LUKS/TPM 33 | ======== 34 | 35 | https://github.com/shpedoikal/tpm-luks 36 | 37 | cryptsetup -v --cipher aes-xts-plain64 --key-size 256 --hash sha1 --iter-time 1000 --use-urandom --verify-passphrase luksFormat 38 | -------------------------------------------------------------------------------- /3rdparty/zlib/Makefile: -------------------------------------------------------------------------------- 1 | include ../../defs.mak 2 | 3 | PKGNAME=zlib-1.2.11 4 | URL=http://zlib.net/$(PKGNAME).tar.gz 5 | 6 | all: dirs download 7 | $(MAKE) -f linux.mak 8 | $(MAKE) -f efi.mak 9 | 10 | clean: 11 | $(MAKE) -f linux.mak clean 12 | $(MAKE) -f efi.mak clean 13 | 14 | depend: dirs download 15 | $(MAKE) -f linux.mak depend 16 | $(MAKE) -f efi.mak depend 17 | 18 | distclean: clean 19 | rm -rf zlib 20 | rm -f depend.mak 21 | 22 | install: 23 | 24 | dirs: 25 | mkdir -p $(TOP)/build/obj/zliblinux/zlib 26 | mkdir -p $(TOP)/build/obj/zlibefi/zlib 27 | 28 | 29 | ##============================================================================== 30 | ## 31 | ## Download zlib distro: 32 | ## 33 | ##============================================================================== 34 | 35 | download: ./zlib/Makefile 36 | 37 | ./zlib/Makefile: 38 | wget $(URL) -O - | tar zxvf - 39 | mv $(PKGNAME) zlib 40 | 41 | ##============================================================================== 42 | ## 43 | ## Test: 44 | ## 45 | ##============================================================================== 46 | 47 | testzlib: 48 | gcc -o $(BINDIR)/testzlib testzlib.c -lzliblinux -lposixlinux -L $(LIBDIR) 49 | $(BINDIR)/./testzlib 50 | 51 | -------------------------------------------------------------------------------- /scripts/dev/bashrc: -------------------------------------------------------------------------------- 1 | # Save directory location: "sd label" 2 | function sd 3 | { 4 | if [ "$1" == "" ] 5 | then 6 | name=`basename $PWD` 7 | else 8 | name=$1 9 | fi 10 | 11 | mkdir -p $HOME/.dirs 12 | pwd > $HOME/.dirs/$name 13 | } 14 | 15 | # Jump to directory location: "jd label" 16 | function jd 17 | { 18 | if [ "$1" == "" ] 19 | then 20 | cd $HOME 21 | return 22 | fi 23 | 24 | name=$1 25 | cd `cat $HOME/.dirs/$name` 26 | pwd 27 | } 28 | 29 | # Add to PATH variable: 30 | function extend_path 31 | { 32 | # Put /root/bin on path: 33 | export PATH=/root/bin:$PATH 34 | 35 | # Put and /root/lsvmtools/build/bin on path: 36 | export PATH=/root/lsvmtools/build/bin:$PATH 37 | } 38 | 39 | # Install LUKS shortcut aliases 40 | function install_luks_shortcuts 41 | { 42 | alias ldump="cryptsetup luksDump" 43 | alias lopen="cryptsetup luksOpen" 44 | alias lclose="cryptsetup luksClose" 45 | alias laddkey="cryptsetup luksAddKey" 46 | alias lrmkey="cryptsetup luksRemoveKey" 47 | alias lchkey="cryptsetup luksChangeKey" 48 | } 49 | 50 | extend_path 51 | 52 | install_luks_shortcuts 53 | 54 | export GITURL=https://mikbras:PASSWORD@github.com/Microsoft/lsvmtools 55 | 56 | export LSVMPREP_SEAL=1 57 | export LSVMPREP_DBXUPDATE=1 58 | -------------------------------------------------------------------------------- /deb/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: lsvmtools 3 | Source: https://github.com/Microsoft/lsvmtools 4 | 5 | Files: * 6 | Copyright: 2017 Microsoft Corporation 7 | License: MIT 8 | 9 | Files: debian/* 10 | Copyright: 2017 Microsoft Corporation 11 | License: MIT 12 | 13 | License: MIT 14 | Permission is hereby granted, free of charge, to any person obtaining a 15 | copy of this software and associated documentation files (the "Software"), 16 | to deal in the Software without restriction, including without limitation 17 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 18 | and/or sell copies of the Software, and to permit persons to whom the 19 | Software is furnished to do so, subject to the following conditions: 20 | . 21 | The above copyright notice and this permission notice shall be included 22 | in all copies or substantial portions of the Software. 23 | . 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 25 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 27 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 28 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 29 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 30 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 31 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/sys/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | -------------------------------------------------------------------------------- /3rdparty/gnuefi/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: checkout 2 | 3 | TARGET1=./$(DIRNAME)/x86_64/lib/libefi.a 4 | TARGET2=./$(DIRNAME)/x86_64/gnuefi/libgnuefi.a 5 | DIRNAME=gnu-efi-3.0.2 6 | TARFILE=$(DIRNAME).tar 7 | BZ2FILE=$(TARFILE).bz2 8 | 9 | all: 10 | $(MAKE) checkout 11 | $(MAKE) depend 12 | $(MAKE) build 13 | 14 | build: $(TARGET1) $(TARGET2) 15 | 16 | $(TARGET1): 17 | ( cd $(DIRNAME); make lib ) 18 | 19 | $(TARGET2): 20 | ( cd $(DIRNAME); make gnuefi ) 21 | $(MAKE) lds 22 | 23 | LINKSCRIPT=elf_x86_64_efi.lds 24 | 25 | clean: 26 | mkdir -p $(DIRNAME) 27 | - ( cd $(DIRNAME); make clean 2> /dev/null ) 28 | 29 | distclean: clean 30 | rm -rf $(DIRNAME) 31 | rm -rf $(LINKSCRIPT) 32 | rm -f $(BZ2FILE) $(TARFILE) ./download 33 | rm -f depend.mak 34 | 35 | checkout: ./$(DIRNAME)/Makefile 36 | 37 | $(DIRNAME)/Makefile: 38 | rm -f $(BZ2FILE) $(TARFILE) ./download 39 | wget https://sourceforge.net/projects/gnu-efi/files/$(BZ2FILE)/download 40 | mv download $(BZ2FILE) 41 | bunzip2 $(BZ2FILE) 42 | tar xvf $(TARFILE) 43 | rm -f $(BZ2FILE) $(TARFILE) ./download 44 | 45 | lds: 46 | sed -f sub.sed ./gnu-efi-3.0.2/gnuefi/elf_x86_64_efi.lds > $(LINKSCRIPT) 47 | 48 | depend: 49 | @ rm -f depend.mak 50 | @ echo "$(TARGET1): \\" >> depend.mak 51 | @ find . -name '*.[ch]' | sed 's/.*/& \\/g' >> depend.mak 52 | @ echo "" >> depend.mak 53 | @ echo "$(TARGET2): \\" >> depend.mak 54 | @ find . -name '*.[ch]' | sed 's/.*/& \\/g' >> depend.mak 55 | @ echo "" >> depend.mak 56 | 57 | -include depend.mak 58 | -------------------------------------------------------------------------------- /scripts/blkdev_utils: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ##============================================================================== 4 | ## 5 | ## mount_to_blkdev(mountpoint) 6 | ## 7 | ## Example: mount_to_blkdev /boot 8 | ## 9 | ##============================================================================== 10 | mount_to_blkdev() 11 | { 12 | local path="$1" 13 | mount | grep "[[:space:]]$path[[:space:]]" | awk '{print $1}' 14 | } 15 | 16 | ##============================================================================== 17 | ## 18 | ## logical_dev_to_physical_dev(logical_dev) 19 | ## 20 | ## Example: logical_dev_to_physical_dev /dev/mapper/boot 21 | ## 22 | ##============================================================================== 23 | logical_dev_to_physical_dev() 24 | { 25 | local dev="$1" 26 | local devbase=$(basename "$dev") 27 | local partdev=$(dmsetup ls --tree -o compact,blkdevname,notrunc | grep "$devbase" | awk -F " " '{print $(NF-1)}' | sed 's/[<>]//g') 28 | printf "/dev/$partdev" 29 | } 30 | 31 | ##============================================================================== 32 | ## 33 | ## physical_dev_to_gpt_uuid(physical_dev) 34 | ## 35 | ## Example: physical_dev_to_gpt_uuid /dev/sda2 36 | ## 37 | ##============================================================================== 38 | physical_dev_to_gpt_uuid() 39 | { 40 | local dev="$1" 41 | local devbase=$(basename "$dev") 42 | ls -l /dev/disk/by-partuuid | grep "$devbase" | awk '{print $(NF-2)}' 43 | } 44 | -------------------------------------------------------------------------------- /lsvmutils/alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include "config.h" 31 | #include "alloc.h" 32 | -------------------------------------------------------------------------------- /posix/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #define POSIXEFI_SUPPRESS_DEFINITIONS 31 | #include 32 | -------------------------------------------------------------------------------- /posix/limits.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #define POSIXEFI_SUPPRESS_DEFINITIONS 31 | #include 32 | -------------------------------------------------------------------------------- /lsvmload/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | char __version[] = "\r\n@VERSION@=" LSVMLOAD_VERSION "\r\n"; 31 | -------------------------------------------------------------------------------- /lsvmload/globals.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include "config.h" 31 | #include "globals.h" 32 | 33 | Globals globals; 34 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/math.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifdef _efibuild_math_h 31 | #define _efibuild_math_h 32 | 33 | #endif /* _efibuild_math_h */ 34 | -------------------------------------------------------------------------------- /posix/include/math.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_math_h 31 | #define _posix_math_h 32 | 33 | #include 34 | 35 | #endif /* _posix_math_h */ 36 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_memory_h 31 | #define _efibuild_memory_h 32 | 33 | #endif /* _efibuild_memory_h */ 34 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/stdarg.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_stdarg_h 31 | #define _efibuild_stdarg_h 32 | 33 | #endif /* _efibuild_stdarg_h */ 34 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/strings.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_strings_h 31 | #define _efibuild_strings_h 32 | 33 | #endif /* _efibuild_strings_h */ 34 | -------------------------------------------------------------------------------- /posix/include/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_memory_h 31 | #define _posix_memory_h 32 | 33 | #include 34 | 35 | #endif /* _posix_memory_h */ 36 | -------------------------------------------------------------------------------- /posix/include/sys/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_types_h 31 | #define _posix_types_h 32 | 33 | #include 34 | 35 | #endif /* _posix_types_h */ 36 | -------------------------------------------------------------------------------- /posix/include/strings.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_strings_h 31 | #define _posix_strings_h 32 | 33 | #include 34 | 35 | #endif /* _posix_strings_h */ 36 | -------------------------------------------------------------------------------- /lsvmutils/inline.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _inline_h 31 | #define _inline_h 32 | 33 | #include "config.h" 34 | 35 | #define INLINE static __inline 36 | 37 | #endif /* _inline_h */ 38 | -------------------------------------------------------------------------------- /posix/include/fcntl.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_fcntl_h 31 | #define _posix_fcntl_h 32 | 33 | #include 34 | #include 35 | 36 | #endif /* _posix_fcntl_h */ 37 | -------------------------------------------------------------------------------- /posix/include/inttypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_inttypes_h 31 | #define _posix_inttypes_h 32 | 33 | #include 34 | #include 35 | 36 | #endif /* _posix_inttypes_h */ 37 | -------------------------------------------------------------------------------- /posix/include/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_assert_h 31 | #define _posix_assert_h 32 | 33 | #include 34 | 35 | void posix_assert(int expr); 36 | 37 | #endif /* _posix_assert_h */ 38 | -------------------------------------------------------------------------------- /lsvmload/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _config_h 31 | #define _config_h 32 | 33 | #if 0 34 | #define ENABLE_FAULTS 35 | #endif 36 | 37 | #define CHECK_SHIM_CERTIFICATE 38 | 39 | #endif /* _config_h */ 40 | -------------------------------------------------------------------------------- /scripts/install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$#" != "0" ]; then 4 | echo "Usage: $0" 5 | exit 1 6 | fi 7 | 8 | if [ ! -f "VERSION" ]; then 9 | echo "$0: file not found: VERSION" 10 | exit 1 11 | fi 12 | 13 | if [ ! -f "lsvmprep" ]; then 14 | echo "$0: file not found: lsvmprep" 15 | exit 1 16 | fi 17 | 18 | srcdirname=`pwd` 19 | destdirname=${destdir}/opt/lsvmtools-`cat VERSION` 20 | 21 | rm -rf ${destdirname} 22 | mkdir -p ${destdir}/opt 23 | cp -r ${srcdirname} ${destdirname} 24 | 25 | if [ "$?" != "0" ]; then 26 | echo "$0: file to create ${destdirname}" 27 | exit 1 28 | fi 29 | 30 | if [ ! -d "${destdirname}" ]; then 31 | echo "$0: directory does not exist: ${destdirname}" 32 | exit 1 33 | fi 34 | 35 | rm -f ${destdirname}/install 36 | 37 | lsvmtool=${destdirname}/build/bin/lsvmtool 38 | 39 | if [ ! -x "${lsvmtool}" ]; then 40 | echo "$0: lsvmtool not found: ${lsvmtool}" 41 | exit 1 42 | fi 43 | 44 | install_lsvmtool() 45 | { 46 | if [ "$#" != "1" ]; then 47 | echo "$0: $FUNCNAME(): wrong # of args" 48 | exit 1 49 | fi 50 | 51 | local lsvmtool=$1 52 | 53 | if [ ! -x "${lsvmtool}" ]; then 54 | echo "$0: $FUNCNAME(): missing executable: ${lsvmtool}" 55 | exit 1 56 | fi 57 | 58 | local filename=/sbin/lsvmtool 59 | 60 | cp ${lsvmtool} ${filename} 61 | 62 | if [ ! -x "${filename}" ]; then 63 | echo "$0: $FUNCNAME(): failed to create: ${filename}" 64 | exit 1 65 | fi 66 | } 67 | 68 | install_lsvmtool ${lsvmtool} 69 | 70 | rm -f ${destdirname}/build/bin/striplic 71 | 72 | echo "" 73 | echo "Created ${destdirname}" 74 | echo "" 75 | -------------------------------------------------------------------------------- /lsvmload/efivfat.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efivfat_h 31 | #define _efivfat_h 32 | 33 | #include "config.h" 34 | #include 35 | 36 | int MapEFIVFAT( 37 | EFI_HANDLE imageHandle); 38 | 39 | #endif /* _efivfat_h */ 40 | -------------------------------------------------------------------------------- /lsvmload/progress.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _progress_h 31 | #define _progress_h 32 | 33 | #include "config.h" 34 | #include 35 | 36 | void PutProgress(const CHAR16* format, ...); 37 | 38 | #endif /* _progress_h */ 39 | -------------------------------------------------------------------------------- /posix/include/signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_sigset_h 31 | #define _posix_sigset_h 32 | 33 | typedef int sigset_t; 34 | 35 | int sigprocmask(int how, const sigset_t *set, sigset_t *oldset); 36 | 37 | #endif /* _posix_sigset_h */ 38 | -------------------------------------------------------------------------------- /lsvmload/espwrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _espwrap 31 | #define _espwrap 32 | 33 | #include "config.h" 34 | #include 35 | 36 | EFI_STATUS WrapESPFileIO( 37 | EFI_HANDLE imageHandle); 38 | 39 | #endif /* _espwrap */ 40 | -------------------------------------------------------------------------------- /posix/assert.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #define POSIXEFI_SUPPRESS_DEFINITIONS 31 | #include 32 | 33 | void __posix_panic(const char* func); 34 | 35 | void posix_assert(int expr) 36 | { 37 | if (!expr) 38 | __posix_panic("assert"); 39 | } 40 | -------------------------------------------------------------------------------- /posix/include/stdbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_stdbool_h 31 | #define _posix_stdbool_h 32 | 33 | #include 34 | 35 | typedef unsigned char posix_bool; 36 | #define false 0 37 | #define true 1 38 | 39 | #endif /* _posix_stdbool_h */ 40 | -------------------------------------------------------------------------------- /scripts/ubuntu/patch_cryptroot.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PREREQ="cryptroot" 4 | prereqs() 5 | { 6 | echo "$PREREQ" 7 | } 8 | 9 | case $1 in 10 | prereqs) 11 | prereqs 12 | exit 0 13 | ;; 14 | esac 15 | 16 | 17 | . /usr/share/initramfs-tools/hook-functions 18 | . $(dirname "$0")/blkdev_utils 19 | # Begin real processing here 20 | 21 | filename="$DESTDIR/conf/conf.d/cryptroot" 22 | 23 | ## 24 | ## Get the block device from /boot path: 25 | ## 26 | 27 | path=/boot 28 | dev=$(mount_to_blkdev $path) 29 | 30 | ## 31 | ## If /dev/mapper path, then convert to underyling partition name: 32 | ## 33 | 34 | echo $dev | grep /dev/mapper > /dev/null 35 | 36 | if [ "$?" = "0" ]; then 37 | part=$(logical_dev_to_physical_dev "$dev") 38 | else 39 | part=$dev 40 | fi 41 | 42 | ## 43 | ## If not a LUKS device, then nothing to patch: 44 | ## 45 | 46 | cryptsetup isLuks $part 47 | 48 | if [ "$?" != "0" ]; then 49 | # success! 50 | exit 0 51 | fi 52 | 53 | uuid=`blkid $part | cut -d '"' -f 2` 54 | line="target=boot,source=UUID=$uuid,key=none,rootdev,lvm=none" 55 | 56 | ## 57 | ## Avoid adding duplicate lines: 58 | ## 59 | 60 | if [ -f "$filename" ]; then 61 | fgrep -i "$uuid" $filename > /dev/null 62 | if [ "$?" = 0 ]; then 63 | exit 0 64 | fi 65 | fi 66 | 67 | ## 68 | ## Prepend line to file: 69 | ## 70 | 71 | echo "$line" > $filename.new 72 | cat $filename >> $filename.new 73 | cp $filename.new $filename 74 | rm -f $filename.new 75 | 76 | ## 77 | ## Append string to every line in the file: 78 | ## 79 | 80 | sed 's-.*-&,keyscript=/lib/cryptsetup/scripts/lsvmaskpass-g' $filename > $filename.new 81 | cp $filename.new $filename 82 | rm -f $filename.new 83 | -------------------------------------------------------------------------------- /lsvmtool/dbxupdate.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _dbxupdate_h 31 | #define _dbxupdate_h 32 | 33 | #include "config.h" 34 | #include 35 | 36 | int ApplyDBXUpdate( 37 | const void* data, 38 | UINTN size); 39 | 40 | #endif /* _dbxupdate_h */ 41 | -------------------------------------------------------------------------------- /lsvmutils/getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _getopt_h 31 | #define _getopt_h 32 | 33 | #include "config.h" 34 | 35 | int GetOpt( 36 | int* argc, 37 | const char* argv[], 38 | const char* optname, 39 | const char** optarg); 40 | 41 | #endif /* _getopt_h */ 42 | -------------------------------------------------------------------------------- /lsvmutils/heap.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include "heap.h" 31 | #include "alloc.h" 32 | 33 | void HeapFree(Heap* heap) 34 | { 35 | UINTN i; 36 | 37 | for (i = 0; i < heap->size; i++) 38 | { 39 | Free(heap->data[i]); 40 | } 41 | 42 | heap->size = 0; 43 | } 44 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/limits.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_limits_h 31 | #define _efibuild_limits_h 32 | 33 | #define ULONG_MAX 18446744073709551615UL 34 | #define LONG_MAX 9223372036854775807L 35 | #define INT_MAX 2147483647 36 | 37 | #endif /* _efibuild_limits_h */ 38 | -------------------------------------------------------------------------------- /lsvmload/loadconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _loadconf_h 31 | #define _loadconf_h 32 | 33 | #include "config.h" 34 | #include 35 | #include "log.h" 36 | 37 | int LoadConf( 38 | EFI_HANDLE imageHandle, 39 | Error* err); 40 | 41 | #endif /* _loadconf_h */ 42 | -------------------------------------------------------------------------------- /lsvmutils/efiblkdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efiblkdev_h 31 | #define _efiblkdev_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | 37 | Blkdev* BlkdevFromBIO( 38 | EFI_BIO* bio); 39 | 40 | #endif /* _efiblkdev_h */ 41 | -------------------------------------------------------------------------------- /posix/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #define POSIXEFI_SUPPRESS_DEFINITIONS 31 | #include 32 | 33 | int errno; 34 | 35 | void __posix_warn(const char* func); 36 | 37 | char *posix_strerror(int errnum) 38 | { 39 | __posix_warn("strerror"); 40 | return "unknown error"; 41 | } 42 | -------------------------------------------------------------------------------- /rpm/SPECS/lsvmtools.spec: -------------------------------------------------------------------------------- 1 | %define _topdir %(realpath $PWD) 2 | %define name lsvmtools 3 | %define release 1 4 | %define version 1.0.0 5 | %define prefix /opt/lsvmtools-%{version} 6 | %define buildroot %{_topdir}/%{name}-%{version}-root 7 | 8 | BuildRoot: %{buildroot} 9 | Summary: LSVMTools 10 | License: MIT 11 | Name: %{name} 12 | Version: %{version} 13 | Release: %{release} 14 | Source: %{name}-%{version}.tar.gz 15 | Prefix: %{prefix} 16 | Group: Development/Tools 17 | 18 | %description 19 | The LSVMTools package is for shielding Hyper-V Linux VMs. 20 | 21 | %prep 22 | %setup -q 23 | 24 | %build 25 | ./configure 26 | make 27 | 28 | %install 29 | make install DESTDIR=$RPM_BUILD_ROOT RELEASE=1 30 | 31 | %files 32 | %defattr(-,root,root) 33 | 34 | %exclude /opt/lsvmtools-1.0.0/scripts/install 35 | 36 | %doc %attr(0644,root,root) /opt/lsvmtools-1.0.0/VERSION 37 | %doc %attr(0644,root,root) /opt/lsvmtools-1.0.0/LICENSE 38 | 39 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/lsvmprep 40 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/build/bin/lsvmtool 41 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/dbxupdate.bin 42 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/lsvmload/lsvmload.efi 43 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/sanity 44 | 45 | %attr(0644,root,root) /opt/lsvmtools-1.0.0/policy/*.policy 46 | 47 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/scripts/* 48 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/scripts/centos/* 49 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/scripts/centos/* 50 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/scripts/redhat/* 51 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/scripts/sles/* 52 | %attr(0755,root,root) /opt/lsvmtools-1.0.0/scripts/ubuntu/* 53 | -------------------------------------------------------------------------------- /lsvmload/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _kernel_h 31 | #define _kernel_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | 38 | EFI_STATUS StartKernel( 39 | EXT2* bootfs); 40 | 41 | #endif /* _kernel_h */ 42 | -------------------------------------------------------------------------------- /lsvmutils/memblkdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _memblkdev_h 31 | #define _memblkdev_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | 37 | Blkdev* BlkdevFromMemory( 38 | void* data, 39 | UINTN size); 40 | 41 | #endif /* _memblkdev_h */ 42 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_assert_h 31 | #define _efibuild_assert_h 32 | 33 | void __panic(const char* func); 34 | 35 | static __inline__ void assert(int expr) 36 | { 37 | if (expr) 38 | __panic("assert"); 39 | } 40 | 41 | #endif /* _efibuild_assert_h */ 42 | -------------------------------------------------------------------------------- /posix/include/errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_errno_h 31 | #define _posix_errno_h 32 | 33 | #include 34 | 35 | #define posix_EINVAL 1 36 | #define posix_ENOMEM 1 37 | #define posix_ENOENT 1 38 | 39 | extern int posix_errno; 40 | 41 | char *posix_strerror(int errnum); 42 | 43 | #endif /* _posix_errno_h */ 44 | -------------------------------------------------------------------------------- /lsvmload/image.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _image_h 31 | #define _image_h 32 | 33 | #include "config.h" 34 | #include 35 | 36 | EFI_STATUS Exec( 37 | IN EFI_HANDLE parentImageHandle, 38 | IN EFI_SYSTEM_TABLE *systemTable, 39 | IN void* efiData, 40 | IN UINTN efiSize); 41 | 42 | #endif /* _image_h */ 43 | -------------------------------------------------------------------------------- /posix/include/limits.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_limits_h 31 | #define _posix_limits_h 32 | 33 | #include 34 | 35 | #define posix_ULONG_MAX 18446744073709551615UL 36 | #define posix_LONG_MAX 9223372036854775807L 37 | #define posix_INT_MIN (-posix_INT_MAX - 1) 38 | #define posix_INT_MAX 2147483647 39 | 40 | #endif /* _posix_limits_h */ 41 | -------------------------------------------------------------------------------- /lsvmutils/eficommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _eficommon_h 31 | #define _eficommon_h 32 | 33 | #include "config.h" 34 | 35 | #if defined(BUILD_EFI) 36 | # include 37 | # include 38 | # include 39 | # include 40 | #else 41 | # include "eficompat.h" 42 | # include 43 | #endif 44 | 45 | #endif /* _eficommon_h */ 46 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/stddef.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_stderr_h 31 | #define _efibuild_stderr_h 32 | 33 | #define offsetof(TYPE, MEMBER) ((size_t)(&((((TYPE*)0)->MEMBER)))) 34 | 35 | typedef unsigned long size_t; 36 | typedef long ssize_t; 37 | 38 | #if !defined(NULL) 39 | # define NULL ((void*)0) 40 | #endif 41 | 42 | #endif /* _efibuild_stderr_h */ 43 | -------------------------------------------------------------------------------- /lsvmutils/chksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _chksum_h 31 | #define _chksum_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | 36 | static __inline UINT32 Chksum(const void* data, UINTN size) 37 | { 38 | UINT8* p = (UINT8*)data; 39 | UINTN r = 0; 40 | 41 | while (size--) 42 | r += *p++; 43 | 44 | return r; 45 | } 46 | 47 | #endif /* _chksum_h */ 48 | -------------------------------------------------------------------------------- /lsvmtool/ext2tests.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | 4 | nmake 5 | set "target=ext2.exe --ext2fs \\.\Harddisk1Partition2" 6 | set "testdir=ext2fs" 7 | for /f %%i in ('echo %cd%') do set pwd=%%i 8 | echo. 9 | 10 | echo Testing lsr 11 | copy nul lsrresult.txt > nul 12 | %target% lsr / | sort > lsrtmp.txt 13 | for /f %%i in ('type lsrtmp.txt') do ( 14 | set t=%%i 15 | set t=!t:/=\! 16 | echo %pwd%\%testdir%!t! >> lsrresult.txt 17 | ) 18 | del lsrtmp.txt 19 | 20 | dir /s /b %testdir% | sort > dirresult.txt 21 | fc /w dirresult.txt lsrresult.txt 22 | del lsrresult.txt 23 | del dirresult.txt 24 | echo. 25 | 26 | echo Testing get 27 | %target% get /initrd.img-3.13.0-24-generic initrdcopy 28 | fc /b initrdcopy %testdir%\initrd.img-3.13.0-24-generic 29 | echo. 30 | 31 | echo Testing mkdir 32 | %target% mkdir /newdir 33 | mkdir %testdir%\newdir 34 | %target% ls / | findstr newdir 35 | echo. 36 | 37 | echo Testing trunc 38 | %target% check 39 | %target% trunc /initrd.img-3.13.0-24-generic 40 | %target% get /initrd.img-3.13.0-24-generic initrdempty 41 | copy nul trunctest > nul 42 | fc /b trunctest initrdempty 43 | del trunctest 44 | del initrdempty 45 | echo. 46 | 47 | echo Testing update 48 | %target% update initrdcopy /initrd.img-3.13.0-24-generic 49 | %target% get /initrd.img-3.13.0-24-generic initrdcopy1 50 | fc initrdcopy initrdcopy1 51 | del initrdcopy1 52 | del initrdcopy 53 | echo. 54 | 55 | echo Testing put 56 | %target% put main.c /main.c 57 | %target% put main.c /newdir/main.c 58 | %target% get /main.c m1.c 59 | %target% get /newdir/main.c m2.c 60 | fc main.c m1.c 61 | fc main.c m2.c 62 | del m1.c 63 | del m2.c 64 | echo. 65 | 66 | echo Testing rm 67 | %target% rm /main.c 68 | %target% rm /newdir/main.c 69 | echo. 70 | 71 | echo Final check 72 | %target% check 73 | echo. 74 | 75 | echo All tests complete 76 | -------------------------------------------------------------------------------- /posix/include/stdarg.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_stdarg_h 31 | #define _posix_stdarg_h 32 | 33 | #include 34 | 35 | #if defined(BUILD_EFI) 36 | # include 37 | # include 38 | #else 39 | typedef int posix_va_list; 40 | # define posix_va_start(ap, format) posix_memset(&ap, 0, sizeof(ap)) 41 | # define posix_va_end(ap) 42 | #endif 43 | 44 | #endif /* _posix_stdarg_h */ 45 | -------------------------------------------------------------------------------- /lsvmload/dbxupdate.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _dbxupdate_h 31 | #define _dbxupdate_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | 38 | EFI_STATUS ApplyDBXUpdate( 39 | EFI_HANDLE imageHandle, 40 | EFI_TCG2_PROTOCOL *tcg2Protocol, 41 | EXT2* bootfs, 42 | BOOLEAN* reboot); 43 | 44 | #endif /* _dbxupdate_h */ 45 | -------------------------------------------------------------------------------- /lsvmload/rootfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _rootfs_h 31 | #define _rootfs_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | 38 | int TestRootDevice( 39 | EFI_HANDLE imageHandle, 40 | EFI_TCG2_PROTOCOL* tcg2Protocol, 41 | const UINT8* passphraseData, 42 | UINTN passphraseSize); 43 | 44 | #endif /* _rootfs_h */ 45 | -------------------------------------------------------------------------------- /lsvmutils/cacheblkdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _cacheblkdev_h 31 | #define _cacheblkdev_h 32 | 33 | #include "config.h" 34 | #include 35 | 36 | Blkdev* NewCacheBlkdev( 37 | Blkdev* dev); 38 | 39 | void CacheBlkdevStats( 40 | Blkdev* dev, 41 | UINTN* numBlocks, 42 | UINTN* numChains, 43 | UINTN* maxChains, 44 | UINTN* longestChain); 45 | 46 | #endif /* _cacheblkdev_h */ 47 | -------------------------------------------------------------------------------- /lsvmutils/dump.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _dump_h 31 | #define _dump_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | 37 | void HexDump( 38 | const void* data, 39 | UINT32 size); 40 | 41 | void ASCIIDump( 42 | const void* data, 43 | UINT32 size); 44 | 45 | UINTN FormatHexByte( 46 | TCHAR buf[3], UINT8 x); 47 | 48 | #endif /* _dump_h */ 49 | -------------------------------------------------------------------------------- /3rdparty/openssl/efi/include/errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _efibuild_errno_h 31 | #define _efibuild_errno_h 32 | 33 | #define EINVAL 1 34 | #define ENOMEM 1 35 | #define ENOENT 1 36 | 37 | extern int errno; 38 | 39 | void __warn(const char* func); 40 | 41 | static __inline__ char *strerror(int errnum) 42 | { 43 | __warn("strerror"); 44 | return "unknown error"; 45 | } 46 | 47 | #endif /* _efibuild_errno_h */ 48 | -------------------------------------------------------------------------------- /lsvmload/shim.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _bootloader_h 31 | #define _bootloader_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | 38 | EFI_STATUS StartShim( 39 | EFI_HANDLE imageHandle, 40 | EFI_SYSTEM_TABLE *systemTable, 41 | EFI_TCG2_PROTOCOL* tcg2Protocol, 42 | EXT2* bootfs); 43 | 44 | #endif /* _bootloader_h */ 45 | -------------------------------------------------------------------------------- /lsvmutils/lsvmloadtrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _lsvmloadtrace_h 31 | #define _lsvmloadtrace_h 32 | 33 | #if defined(BUILD_EFI) 34 | # define LSVMLOAD_TRACE lsvmload_trace(__FILE__, __LINE__) 35 | # define LSVMLOAD_TRACE2(s,n) lsvmload_trace(s, (int)n) 36 | #else 37 | # define LSVMLOAD_TRACE 38 | # define LSVMLOAD_TRACE2(s,n) 39 | #endif 40 | 41 | void lsvmload_trace(const char* file, int line); 42 | 43 | #endif /* _lsvmloadtrace_h */ 44 | -------------------------------------------------------------------------------- /posix/include/stddef.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_stderr_h 31 | #define _posix_stderr_h 32 | 33 | #include 34 | 35 | #define posix_offsetof(TYPE, MEMBER) ((posix_size_t)(&((((TYPE*)0)->MEMBER)))) 36 | 37 | typedef unsigned long posix_size_t; 38 | typedef long posix_ssize_t; 39 | 40 | #define posix_NULL ((void*)0) 41 | 42 | #if !defined(NULL) 43 | # define NULL posix_NULL 44 | #endif 45 | 46 | #endif /* _posix_stderr_h */ 47 | -------------------------------------------------------------------------------- /lsvmload/bootbio.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _bootbio_h 31 | #define _bootbio_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | EFI_STATUS WrapBootBIO( 40 | EFI_HANDLE imageHandle, 41 | EFI_TCG2_PROTOCOL* tcg2Protocol, 42 | const UINT8* masterkeyData, 43 | UINTN masterkeySize); 44 | 45 | #endif /* _bootbio_h */ 46 | -------------------------------------------------------------------------------- /lsvmutils/strlcpy.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | UINTN STRLCPY( 31 | DEST* dest, 32 | const SRC* src, 33 | UINTN size) 34 | { 35 | const SRC* start = src; 36 | 37 | if (size) 38 | { 39 | DEST* end = dest + size - 1; 40 | 41 | while (*src && dest != end) 42 | *dest++ = (DEST)*src++; 43 | 44 | *dest = '\0'; 45 | } 46 | 47 | while (*src) 48 | src++; 49 | 50 | return src - start; 51 | } 52 | -------------------------------------------------------------------------------- /striplic/depend.mak: -------------------------------------------------------------------------------- 1 | /root/lsvmtools/build/obj/striplic/main.o: main.c \ 2 | /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/features.h \ 3 | /usr/include/x86_64-linux-gnu/sys/cdefs.h \ 4 | /usr/include/x86_64-linux-gnu/bits/wordsize.h \ 5 | /usr/include/x86_64-linux-gnu/gnu/stubs.h \ 6 | /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ 7 | /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \ 8 | /usr/include/x86_64-linux-gnu/bits/types.h \ 9 | /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \ 10 | /usr/include/_G_config.h /usr/include/wchar.h \ 11 | /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ 12 | /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ 13 | /usr/include/x86_64-linux-gnu/bits/sys_errlist.h /usr/include/stdlib.h \ 14 | /usr/include/x86_64-linux-gnu/bits/waitflags.h \ 15 | /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ 16 | /usr/include/x86_64-linux-gnu/bits/endian.h \ 17 | /usr/include/x86_64-linux-gnu/bits/byteswap.h \ 18 | /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ 19 | /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ 20 | /usr/include/x86_64-linux-gnu/sys/select.h \ 21 | /usr/include/x86_64-linux-gnu/bits/select.h \ 22 | /usr/include/x86_64-linux-gnu/bits/sigset.h \ 23 | /usr/include/x86_64-linux-gnu/bits/time.h \ 24 | /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ 25 | /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ 26 | /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ 27 | /usr/include/x86_64-linux-gnu/sys/stat.h \ 28 | /usr/include/x86_64-linux-gnu/bits/stat.h /usr/include/ctype.h \ 29 | /usr/include/xlocale.h /usr/include/unistd.h \ 30 | /usr/include/x86_64-linux-gnu/bits/posix_opt.h \ 31 | /usr/include/x86_64-linux-gnu/bits/environments.h \ 32 | /usr/include/x86_64-linux-gnu/bits/confname.h /usr/include/getopt.h \ 33 | /usr/include/string.h 34 | -------------------------------------------------------------------------------- /lsvmload/luksbio.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _luksbio_h 31 | #define _luksbio_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | /* Open the LUKS BIO with the matching UUID */ 41 | EFI_BIO* OpenLUKSBIO( 42 | EFI_HANDLE imageHandle, 43 | const char uuid[GUID_STRING_SIZE]); 44 | 45 | #endif /* _luksbio_h */ 46 | -------------------------------------------------------------------------------- /lsvmutils/grubcfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _mbutils_grubcfg_h 31 | #define _mbutils_grubcfg_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | #include "strarr.h" 36 | 37 | int GrubcfgPatch( 38 | void* data, 39 | const UINTN size); 40 | 41 | int GRUBCfgFindInitrd( 42 | const char* dataIn, 43 | UINTN size, 44 | char matched[PATH_MAX], 45 | char title[PATH_MAX], 46 | char path[PATH_MAX]); 47 | 48 | #endif /* _mbutils_grubcfg_h */ 49 | -------------------------------------------------------------------------------- /lsvmload/initrd.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _initrd_h 31 | #define _initrd_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | int GetInitrdPath( 40 | char path[PATH_MAX]); 41 | 42 | int PatchInitrd( 43 | EFI_HANDLE imageHandle, 44 | EFI_TCG2_PROTOCOL* tcg2Protocol, 45 | EXT2* bootfs, 46 | const char* initrdPath); 47 | 48 | #endif /* _initrd_h */ 49 | -------------------------------------------------------------------------------- /lsvmutils/uefidbx.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _uefidbx_h_ 31 | #define _uefidbx_h_ 32 | 33 | #include "eficommon.h" 34 | #include "sha.h" 35 | 36 | const void* SkipOptionalDBXHeader( 37 | const void* data, 38 | UINTN* size); 39 | 40 | int LoadDBXHashes( 41 | const void* data, 42 | UINTN size, 43 | SHA256Hash** hashesData, 44 | UINTN* hashesSize); 45 | 46 | int NeedDBXUpdate( 47 | const char* dbxupdatePath, 48 | BOOLEAN* need); 49 | 50 | #endif /* _uefidbx_h_ */ 51 | -------------------------------------------------------------------------------- /lsvmutils/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _conf_h 31 | #define _conf_h 32 | 33 | #include "config.h" 34 | #include "error.h" 35 | 36 | typedef int (*ConfCallback)( 37 | const char* name, 38 | const char* value, 39 | void* callbackData, 40 | Error* err); 41 | 42 | int ParseConf( 43 | const char* text, 44 | unsigned long textSize, 45 | ConfCallback callback, 46 | void* callbackData, 47 | unsigned int* errorLine, 48 | Error* err); 49 | 50 | #endif /* _conf_h */ 51 | -------------------------------------------------------------------------------- /lsvmutils/exec.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _lsvmtools_exec_h 31 | #define _lsvmtools_exec_h 32 | 33 | #include 34 | 35 | int Exec( 36 | int argc, 37 | const char* argv[], 38 | int* status, 39 | Error* err); 40 | 41 | int ExecWithStdin( 42 | const void* data, /* write this to standard input of child */ 43 | size_t size, /* size of data */ 44 | int argc, 45 | const char* argv[], 46 | int* status, 47 | Error* err); 48 | 49 | #endif /* _lsvmtools_exec_h */ 50 | -------------------------------------------------------------------------------- /lsvmutils/strlcat.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | UINTN STRLCAT( 31 | DEST* dest, 32 | const SRC* src, 33 | UINTN size) 34 | { 35 | const SRC* start = src; 36 | 37 | if (size) 38 | { 39 | DEST* end = dest + size - 1; 40 | 41 | while (*dest && dest != end) 42 | dest++; 43 | 44 | while (*src && dest != end) 45 | *dest++ = (DEST)*src++; 46 | 47 | *dest = '\0'; 48 | } 49 | 50 | while (*src) 51 | src++; 52 | 53 | return src - start; 54 | } 55 | -------------------------------------------------------------------------------- /lsvmutils/pass.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _mbutils_pass_h 31 | #define _mbutils_pass_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | 36 | #define SALT_SIZE 16 37 | #define SALT_STRING_SIZE (3 + SALT_SIZE + 1) 38 | 39 | int GenerateSalt( 40 | char salt[SALT_STRING_SIZE]); 41 | 42 | char *SHA512Crypt( 43 | const char* password, 44 | const char* salt 45 | ); 46 | 47 | int CryptPassword( 48 | char* buf, 49 | UINTN bufSize, 50 | const char* password); 51 | 52 | 53 | #endif /* _mbutils_pass_h */ 54 | -------------------------------------------------------------------------------- /lsvmload/trace.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _trace_h 31 | #define _trace_h 32 | 33 | #include "config.h" 34 | #include "log.h" 35 | 36 | #define TRACE LOGI(L"TRACE: %a(%d)", __FILE__, (int)__LINE__) 37 | 38 | #if defined(TRACE_GOTOS) 39 | # define GOTO(LABEL) \ 40 | do \ 41 | { \ 42 | Print(L"GOTO: %a(%d): %a()\n", __FILE__, (int)__LINE__, __FUNCTION__); \ 43 | Wait(); \ 44 | goto LABEL; \ 45 | } \ 46 | while (0) 47 | #else 48 | # define GOTO(LABEL) goto LABEL 49 | #endif 50 | 51 | #endif /* _trace_h */ 52 | -------------------------------------------------------------------------------- /lsvmutils/lsvmloadpolicy.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _mbutils_lsvmloadpolicy_h 31 | #define _mbutils_lsvmloadpolicy_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | #include "tpm2.h" 36 | 37 | int SealLSVMLoadPolicy( 38 | EFI_TCG2_PROTOCOL *protocol, 39 | const void* lsvmloadData, 40 | UINTN lsvmloadSize, 41 | BOOLEAN sealForSecureBoot, 42 | const BYTE dataIn[TPM2X_MAX_DATA_SIZE], 43 | UINT16 sizeIn, 44 | BYTE dataOut[TPM2X_BLOB_SIZE], 45 | UINTN* sizeOut, 46 | Error* err); 47 | 48 | #endif /* _mbutils_lsvmloadpolicy_h */ 49 | -------------------------------------------------------------------------------- /3rdparty/xz/testxz.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include 31 | 32 | int lzmaextras_test_compress_decompress( 33 | const unsigned char* data, 34 | unsigned long size); 35 | 36 | void __posix_panic(const char* msg) 37 | { 38 | printf("__posix_panic: %s\n", msg); 39 | } 40 | 41 | void __posix_warn(const char* msg) 42 | { 43 | printf("__posix_warn: %s\n", msg); 44 | } 45 | 46 | int main() 47 | { 48 | if (lzmaextras_test_compress_decompress("hello", 5) != 0) 49 | { 50 | printf("oops\n"); 51 | return 1; 52 | } 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /3rdparty/zlib/testzlib.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include 31 | 32 | int posix_errno = 0; 33 | 34 | int zlibextras_test_compress_decompress( 35 | const unsigned char* data, 36 | unsigned long size); 37 | 38 | void __posix_panic(const char* msg) 39 | { 40 | printf("__posix_panic: %s\n", msg); 41 | } 42 | 43 | void __posix_warn(const char* msg) 44 | { 45 | printf("__posix_warn: %s\n", msg); 46 | } 47 | 48 | int main() 49 | { 50 | if (zlibextras_test_compress_decompress("hello", 5) != 0) 51 | { 52 | printf("oops\n"); 53 | return 1; 54 | } 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /lsvmutils/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _error_h 31 | #define _error_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | #include "strings.h" 36 | 37 | typedef struct _Error 38 | { 39 | TCHAR buf[256]; 40 | } 41 | Error; 42 | 43 | INLINE void ClearErr( 44 | Error* err) 45 | { 46 | if (err) 47 | Memset(err, 0, sizeof(Error)); 48 | } 49 | 50 | #if !defined(BUILD_EFI) 51 | # if defined(__GNUC__) 52 | __attribute__((format(printf, 2, 3))) 53 | # endif 54 | #endif 55 | void SetErr( 56 | Error* err, 57 | const TCHAR* format, 58 | ...); 59 | 60 | #endif /* _error_h */ 61 | -------------------------------------------------------------------------------- /posix/include/stdint.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_stdint_h 31 | #define _posix_stdint_h 32 | 33 | #include 34 | 35 | #define SIZE_MAX 18446744073709551615UL 36 | 37 | #define UINT32_C(c) c 38 | 39 | typedef unsigned char posix_uint8_t; 40 | typedef char posix_int8_t; 41 | 42 | typedef unsigned short posix_uint16_t; 43 | typedef short posix_int16_t; 44 | 45 | typedef unsigned int posix_uint32_t; 46 | typedef int posix_int32_t; 47 | 48 | typedef unsigned long long posix_uint64_t; 49 | typedef long long posix_int64_t; 50 | 51 | typedef unsigned long int posix_uintptr_t; 52 | 53 | #endif /* _posix_stdint_h */ 54 | -------------------------------------------------------------------------------- /posix/include/dlfcn.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_dlsym_h 31 | #define _posix_dlsym_h 32 | 33 | #include 34 | 35 | #define posix_RTLD_NOW 0 36 | #define posix_RTLD_LAZY 1 37 | 38 | typedef struct 39 | { 40 | const char *dli_fname; 41 | void *dli_fbase; 42 | const char *dli_sname; 43 | void *dli_saddr; 44 | } 45 | posix_Dl_info; 46 | 47 | void *posix_dlopen(const char *filename, int flags); 48 | 49 | void *posix_dlsym(void *handle, const char *symbol); 50 | 51 | char *posix_dlerror(); 52 | 53 | int posix_dlclose(void *handle); 54 | 55 | int posix_dladdr(void *addr, posix_Dl_info *info); 56 | 57 | #endif /* _posix_dlsym_h */ 58 | -------------------------------------------------------------------------------- /lsvmutils/error.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include "config.h" 31 | 32 | #if defined(BUILD_EFI) 33 | # include 34 | # include 35 | # define VSNPRINTF VSPrint 36 | #else 37 | # include 38 | # include 39 | # define VSNPRINTF vsnprintf 40 | #endif 41 | 42 | #include "error.h" 43 | 44 | void SetErr( 45 | Error* err, 46 | const TCHAR* format, 47 | ...) 48 | { 49 | if (err) 50 | { 51 | TCHAR buf[sizeof(err->buf)]; 52 | va_list ap; 53 | 54 | va_start(ap, format); 55 | VSNPRINTF(buf, sizeof(buf), (TCHAR*)format, ap); 56 | Tcscpy(err->buf, buf); 57 | va_end(ap); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lsvmutils/efivarauth.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _mbutils_efivarauth_h 31 | #define _mbutils_efivarauth_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | 36 | typedef struct 37 | { 38 | UINT32 dwLength; 39 | UINT16 wRevision; 40 | UINT16 wCertificateType; 41 | UINT16 bCertificate[0]; 42 | } 43 | WIN_CERTIFICATE; 44 | 45 | typedef struct 46 | { 47 | WIN_CERTIFICATE Hdr; 48 | EFI_GUID CertType; 49 | UINT8 CertData[0]; 50 | } 51 | WIN_CERTIFICATE_EFI_GUID; 52 | 53 | typedef struct 54 | { 55 | EFI_TIME TimeStamp; 56 | WIN_CERTIFICATE_EFI_GUID AuthInfo; 57 | } 58 | EFI_VARIABLE_AUTHENTICATION_2; 59 | 60 | #endif /* _mbutils_efivarauth_h */ 61 | -------------------------------------------------------------------------------- /lsvmutils/vars.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _mbutils_vars_h 31 | #define _mbutils_vars_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | 36 | #define VARS_MAX 32 37 | 38 | typedef struct _Var 39 | { 40 | const char* name; 41 | const unsigned char* data; 42 | UINTN size; 43 | } 44 | Var; 45 | 46 | typedef struct Vars 47 | { 48 | Var data[VARS_MAX]; 49 | UINTN size; 50 | } 51 | Vars; 52 | 53 | const Var* VarsFind( 54 | const Vars* vars, 55 | const char* name); 56 | 57 | int VarsLoad( 58 | const Vars* vars, 59 | const char* name, 60 | UINTN extraBytes, 61 | unsigned char** data, 62 | UINTN* size); 63 | 64 | #endif /* _mbutils_vars_h */ 65 | -------------------------------------------------------------------------------- /3rdparty/xz/lzmaextras.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _lzmaextras_h 31 | #define _lzmaextras_h 32 | 33 | int lzmaextras_compress( 34 | const unsigned char* inData, 35 | unsigned long inSize, 36 | unsigned char** outData, 37 | unsigned long* outSize); 38 | 39 | int lzmaextras_decompress( 40 | const unsigned char* inData, 41 | unsigned long inSize, 42 | unsigned char** outData, 43 | unsigned long* outSize); 44 | 45 | int lzmaextras_test_compress_decompress( 46 | const unsigned char* data, 47 | unsigned long size); 48 | 49 | /* Returns 0 if this data is in .xz format */ 50 | int lzmaextras_test( 51 | const unsigned char* data, 52 | unsigned long size); 53 | 54 | #endif /* _lzmaextras_h */ 55 | -------------------------------------------------------------------------------- /lsvmutils/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _file_h 31 | #define _file_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | #include "sha.h" 36 | 37 | #if defined(BUILD_EFI) 38 | # error "unsupported" 39 | #endif 40 | 41 | BOOLEAN IsDir( 42 | const char* path); 43 | 44 | int LoadFile( 45 | const char* path, 46 | size_t extraBytes, 47 | unsigned char** dataOut, 48 | size_t* outSize); 49 | 50 | int PutFile( 51 | const char* path, 52 | const void* data, 53 | size_t size); 54 | 55 | int AppendFile( 56 | const char* path, 57 | const void* data, 58 | size_t size); 59 | 60 | int LoadSHA256( 61 | const char* path, 62 | SHA256Hash* sha256); 63 | 64 | #endif /* _file_h */ 65 | -------------------------------------------------------------------------------- /3rdparty/openssl/linux/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../defs.mak 2 | 3 | ##============================================================================== 4 | ## 5 | ## TARGET 6 | ## 7 | ##============================================================================== 8 | 9 | TARGET=$(LIBDIR)/libcryptolinux.a 10 | 11 | ##============================================================================== 12 | ## 13 | ## OPENSSLSRCDIR 14 | ## 15 | ##============================================================================== 16 | 17 | OPENSSLSRCDIR=$(OPENSSLPACKAGE) 18 | 19 | ##============================================================================== 20 | ## 21 | ## all: 22 | ## 23 | ##============================================================================== 24 | 25 | $(TARGET): 26 | $(MAKE) unpack 27 | $(MAKE) configure 28 | $(MAKE) build 29 | 30 | ##============================================================================== 31 | ## 32 | ## build 33 | ## 34 | ##============================================================================== 35 | 36 | build: 37 | $(MAKE) -C $(OPENSSLSRCDIR) DIRS=crypto CC="gcc $(LINUX_CFLAGS)" 38 | mkdir -p $(LIBDIR) 39 | cp $(OPENSSLSRCDIR)/libcrypto.a $(TARGET) 40 | 41 | ##============================================================================== 42 | ## 43 | ## unpack 44 | ## 45 | ##============================================================================== 46 | 47 | unpack: 48 | rm -rf $(OPENSSLSRCDIR) 49 | tar zxvf ../$(OPENSSLSRCDIR).tar.gz 50 | 51 | ##============================================================================== 52 | ## 53 | ## configure: 54 | ## 55 | ##============================================================================== 56 | 57 | configure: 58 | ( cd $(OPENSSLSRCDIR); ./config ) 59 | 60 | ##============================================================================== 61 | ## 62 | ## clean: 63 | ## 64 | ##============================================================================== 65 | 66 | clean: 67 | - @ $(MAKE) -C $(OPENSSLSRCDIR) clean 2> /dev/null > /dev/null 68 | - @ rm -f $(TARGET) 69 | 70 | distclean: 71 | $(MAKE) -s clean 72 | rm -rf $(OPENSSLSRCDIR) 73 | 74 | install: 75 | -------------------------------------------------------------------------------- /lsvmload/progress.c: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #include "progress.h" 31 | #include 32 | #include "log.h" 33 | 34 | void PutProgress(const CHAR16* format, ...) 35 | { 36 | va_list ap; 37 | CHAR16* wcs = NULL; 38 | 39 | /* Format the string */ 40 | { 41 | va_start(ap, format); 42 | 43 | if (!(wcs = VPoolPrint((CHAR16*)format, ap))) 44 | { 45 | va_end(ap); 46 | goto done; 47 | } 48 | 49 | va_end(ap); 50 | } 51 | 52 | /* Log the progress message */ 53 | LOGI(L"progress: %s", Wcs(wcs)); 54 | 55 | /* Print the progress message */ 56 | Print(L"%s\n", Wcs(wcs)); 57 | 58 | done: 59 | 60 | if (wcs) 61 | FreePool(wcs); 62 | } 63 | -------------------------------------------------------------------------------- /lsvmutils/luksblkdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _luksblddev_h 31 | #define _luksblddev_h 32 | 33 | #include "config.h" 34 | #include "blkdev.h" 35 | 36 | BOOLEAN IsRawLUKSDevice( 37 | Blkdev* rawdev); 38 | 39 | Blkdev* LUKSBlkdevFromMasterkey( 40 | Blkdev* rawdev, 41 | const UINT8* masterkey, 42 | UINT32 masterkeyBytes); 43 | 44 | Blkdev* LUKSBlkdevFromRawBytes( 45 | Blkdev* rawdev, 46 | const UINT8* passphraseData, 47 | UINTN passphraseBytes); 48 | 49 | Blkdev* LUKSBlkdevFromPassphrase( 50 | Blkdev* rawdev, 51 | const char *passphrase); 52 | 53 | int LUKSBlkdevGetMasterKey( 54 | Blkdev* dev, 55 | const UINT8** masterkeyData, 56 | UINTN* masterkeyBytes); 57 | 58 | #endif /* _luksblddev_h */ 59 | -------------------------------------------------------------------------------- /posix/include/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _posix_time_h 31 | #define _posix_time_h 32 | 33 | #include 34 | 35 | typedef long posix_time_t; 36 | 37 | struct posix_timeval 38 | { 39 | int dummy; 40 | }; 41 | 42 | struct posix_tm 43 | { 44 | int tm_sec; 45 | int tm_min; 46 | int tm_hour; 47 | int tm_mday; 48 | int tm_mon; 49 | int tm_year; 50 | int __tm_wday_unsupported; 51 | int __tm_yday_unsupported; 52 | int tm_isdst; 53 | }; 54 | 55 | posix_time_t posix_time(posix_time_t *timer); 56 | 57 | struct posix_tm *posix_gmtime_r(const posix_time_t *timep, struct posix_tm *result); 58 | 59 | struct posix_tm *posix_localtime(const posix_time_t *timep); 60 | 61 | #endif /* _posix_time_h */ 62 | -------------------------------------------------------------------------------- /3rdparty/xz/Makefile: -------------------------------------------------------------------------------- 1 | include ../../defs.mak 2 | 3 | export PKGVERSION=5.2.3 4 | PKGNAME=xz-$(PKGVERSION) 5 | URL=https://sourceforge.net/projects/lzmautils/files/$(PKGNAME).tar.gz/download 6 | 7 | all: dirs download 8 | $(MAKE) -f linux.mak 9 | $(MAKE) -f efi.mak 10 | 11 | clean: 12 | $(MAKE) -f linux.mak clean 13 | $(MAKE) -f efi.mak clean 14 | 15 | depend: dirs download 16 | $(MAKE) -f linux.mak depend 17 | $(MAKE) -f efi.mak depend 18 | 19 | distclean: clean 20 | rm -rf xz 21 | rm -f depend.mak 22 | 23 | install: 24 | 25 | dirs: 26 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz 27 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/rangecoder 28 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/simple 29 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/delta 30 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/lzma 31 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/check 32 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/lz 33 | @ mkdir -p $(TOP)/build/obj/lzmalinux/xz/src/liblzma/common 34 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz 35 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/rangecoder 36 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/simple 37 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/delta 38 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/lzma 39 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/check 40 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/lz 41 | @ mkdir -p $(TOP)/build/obj/lzmaefi/xz/src/liblzma/common 42 | 43 | ##============================================================================== 44 | ## 45 | ## Download xz distro: 46 | ## 47 | ##============================================================================== 48 | 49 | download: ./xz/configure.ac 50 | 51 | ./xz/configure.ac: 52 | wget $(URL) -O - | tar zxvf - 53 | mv $(PKGNAME) xz 54 | 55 | ##============================================================================== 56 | ## 57 | ## Tests: 58 | ## 59 | ##============================================================================== 60 | 61 | testxz: 62 | gcc -o $(BINDIR)/testxz testxz.c -llzmalinux -lposixlinux -L $(LIBDIR) 63 | $(BINDIR)/./testxz 64 | 65 | -------------------------------------------------------------------------------- /lsvmutils/heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _mbutils_heap_h 31 | #define _mbutils_heap_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | #include "inline.h" 36 | 37 | /* 38 | * Maintains a heap of dynamically allocated objects that may be released 39 | * all at once by calling HeapFree(). 40 | */ 41 | 42 | #define HEAP_SIZE 32 43 | 44 | #define HEAP_INITIALIZER { 0 } 45 | 46 | typedef struct _Heap 47 | { 48 | UINTN size; 49 | void* data[HEAP_SIZE]; 50 | } 51 | Heap; 52 | 53 | INLINE int HeapAdd(Heap* heap, void* ptr) 54 | { 55 | if (heap->size == HEAP_SIZE) 56 | return -1; 57 | 58 | heap->data[heap->size++] = ptr; 59 | return 0; 60 | } 61 | 62 | void HeapFree(Heap* heap); 63 | 64 | #endif /* _mbutils_heap_h */ 65 | -------------------------------------------------------------------------------- /lsvmtool/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _lsvmtool_config_h 31 | #define _lsvmtool_config_h 32 | 33 | #if defined(_WIN32) 34 | /* Windows 32-bit and 64-bit (always defined) */ 35 | #elif defined(__linux__) 36 | /* Linux */ 37 | #else 38 | # error "unsupported platform" 39 | #endif 40 | 41 | #if defined(__linux__) 42 | # define HAVE_TCG2 43 | # define HAVE_OPENSSL 44 | #endif 45 | 46 | #if defined(_WIN32) 47 | # include 48 | #endif 49 | 50 | #if defined(_WIN32) 51 | /* Ignore: "warning C4706: assignment within conditional expression" */ 52 | # pragma warning(disable : 4706) 53 | #endif 54 | 55 | #if defined(_WIN32) 56 | # define PATH_MAX MAX_PATH 57 | #endif 58 | 59 | #if !defined(_WIN32) 60 | # define ENABLE_VFAT 61 | #endif 62 | 63 | #endif /* _lsvmtool_config_h */ 64 | -------------------------------------------------------------------------------- /lsvmutils/print.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _print_h 31 | #define _print_h 32 | 33 | #include "config.h" 34 | #include "eficommon.h" 35 | 36 | #if !defined(BUILD_EFI) 37 | # include 38 | # include 39 | # include 40 | #endif 41 | 42 | #if !defined(BUILD_EFI) 43 | # define Print printf 44 | # define SPrint snprintf 45 | #endif 46 | 47 | #if defined(BUILD_EFI) 48 | int __Printf(const CHAR16 *format, ...); 49 | #else 50 | int __Printf(const char *format, ...); 51 | #endif 52 | 53 | #if defined(BUILD_EFI) 54 | # define PRINTF0(FMT) __Printf(TCS(FMT)) 55 | # define PRINTF(FMT, ...) __Printf(TCS(FMT), __VA_ARGS__) 56 | #else 57 | # define PRINTF0(FMT) __Printf(FMT) 58 | # define PRINTF(FMT, ...) __Printf(FMT, __VA_ARGS__) 59 | #endif 60 | 61 | #endif /* _print_h */ 62 | -------------------------------------------------------------------------------- /lsvmload/keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _keys_h 31 | #define _keys_h 32 | 33 | #include "config.h" 34 | #include 35 | #include 36 | #include 37 | 38 | EFI_STATUS __UnsealKey( 39 | EFI_HANDLE imageHandle, 40 | EFI_TCG2_PROTOCOL* protocol, 41 | const TPM2X_BLOB* sealedData, 42 | UINT8** masterkeyData, 43 | UINTN* masterkeySize); 44 | 45 | EFI_STATUS __LoadSealedData( 46 | EFI_HANDLE imageHandle, 47 | const CHAR16* path, 48 | TPM2X_BLOB* sealedData); 49 | 50 | EFI_STATUS UnsealKeys( 51 | EFI_HANDLE imageHandle, 52 | EFI_TCG2_PROTOCOL* tcg2Protocol); 53 | 54 | EFI_STATUS CapPCR( 55 | EFI_HANDLE imageHandle, 56 | EFI_TCG2_PROTOCOL* tcg2Protocol, 57 | UINT32 pcr); 58 | 59 | #endif /* _keys_h */ 60 | -------------------------------------------------------------------------------- /lsvmload/console.h: -------------------------------------------------------------------------------- 1 | /* 2 | **============================================================================== 3 | ** 4 | ** LSVMTools 5 | ** 6 | ** MIT License 7 | ** 8 | ** Copyright (c) Microsoft Corporation. All rights reserved. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 11 | ** of this software and associated documentation files (the "Software"), to deal 12 | ** in the Software without restriction, including without limitation the rights 13 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | ** copies of the Software, and to permit persons to whom the Software is 15 | ** furnished to do so, subject to the following conditions: 16 | ** 17 | ** The above copyright notice and this permission notice shall be included in 18 | ** all copies or substantial portions of the Software. 19 | ** 20 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | ** SOFTWARE 27 | ** 28 | **============================================================================== 29 | */ 30 | #ifndef _lsvmload_console_h 31 | #define _lsvmload_console_h 32 | 33 | #include "config.h" 34 | #include 35 | 36 | void WaitWithMessage(const CHAR16* message); 37 | 38 | void Wait(void); 39 | 40 | EFI_STATUS ClearScreen(); 41 | 42 | EFI_STATUS SetColors( 43 | UINTN foreground, 44 | UINTN background); 45 | 46 | EFI_STATUS OutputString( 47 | const CHAR16* str); 48 | 49 | EFI_STATUS PrintErrorWait( 50 | const CHAR16* format, 51 | ...); 52 | 53 | EFI_STATUS GetInput( 54 | const CHAR16 *prompt, 55 | BOOLEAN echo, 56 | CHAR16 *buf, 57 | UINTN bufSize); 58 | 59 | EFI_STATUS DisableKeyboardInput(EFI_SYSTEM_TABLE *systemTable); 60 | 61 | EFI_STATUS InstallSimpleInputInterface(); 62 | 63 | #endif /* _lsvmload_console_h */ 64 | --------------------------------------------------------------------------------