CryptLib: undefine va_arg and friends before redefining them

Upstream GNU-EFI contains changes to efistdarg.h resulting in the va_start,
va_arg and va_end macros to be #defined unconditionally. Make sure we #undef
them before overriding the definitions.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
unhook_system_services: bail on systab == NULL

Prevent unhook_system_services() from dereferencing a NULL systab, which
may occur if hook_system_services() has never been called.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Factor out x86-isms and add cross compile support

This patch cleans up and refactors the Makefiles to better allow new
architectures to be added:
- remove unused Makefile definitions
- import Makefile definitions from top level rather than redefining
- move x86 specific CFLAGS to inside ifeq() blocks
- remove x86 inline asm
- allow $(FORMAT) to be overridden: this is necessary as there exists no
  EFI or PE/COFF aware objcopy for ARM

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Add support for 64-bit ARM (AArch64)

This adds support for building the shim for a 64-bit ARM UEFI environment.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Add support for 32-bit ARM

This adds support for building the shim for a 32-bit ARM UEFI environment.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>