All Projects → Foxboron → go-uefi

Foxboron / go-uefi

Licence: MIT license
Linux UEFI library written in pure Go.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-uefi

UEFI MULTI
UEFI_MULTI - Make Multi-Boot USB-Drive
Stars: ✭ 33 (-57.69%)
Mutual labels:  uefi, uefi-secureboot
MultiOS-USB
Boot operating systems directly from ISO files
Stars: ✭ 106 (+35.9%)
Mutual labels:  uefi, uefi-secureboot
Ventoy
A new bootable USB solution.
Stars: ✭ 29,413 (+37608.97%)
Mutual labels:  uefi, secure-boot
sicherboot
Unmaintained systemd-boot integration with secure boot support; consider https://github.com/Foxboron/sbctl instead.
Stars: ✭ 31 (-60.26%)
Mutual labels:  uefi, secure-boot
meta-secure-core
OpenEmbedded layer for the use cases on secure boot, integrity and encryption
Stars: ✭ 80 (+2.56%)
Mutual labels:  uefi, secure-boot
arch-secure-boot
UEFI Secure Boot for Arch Linux + btrfs snapshot recovery
Stars: ✭ 60 (-23.08%)
Mutual labels:  uefi, secure-boot
MetalOS
Homebrew x64 OS written in C++ that runs Doom!
Stars: ✭ 33 (-57.69%)
Mutual labels:  uefi
SmmExploit
The report and the exploit of CVE-2021-26943, the kernel-to-SMM local privilege escalation vulnerability in ASUS UX360CA BIOS version 303.
Stars: ✭ 98 (+25.64%)
Mutual labels:  uefi
AttestationSamples
A small subset of the submitted sample data from https://github.com/GrapheneOS/Auditor. It has a sample attestation certificate chain per device model (ro.product.model) along with a subset of the system properties from the sample as supplementary information.
Stars: ✭ 25 (-67.95%)
Mutual labels:  secure-boot
mu oem sample
Project Mu OEM Sample Code
Stars: ✭ 27 (-65.38%)
Mutual labels:  uefi
GrubFM-Installer
GrubFM Installer
Stars: ✭ 27 (-65.38%)
Mutual labels:  uefi
edk2-dipper
A UEFI Firmware for Dipper(Xiaomi MI 8)
Stars: ✭ 93 (+19.23%)
Mutual labels:  uefi
rEFInd-chalkboard
A simple monochrome theme for the rEFInd UEFI boot manager
Stars: ✭ 27 (-65.38%)
Mutual labels:  uefi
boot2flappy
Flappy Bird as bootable UEFI executable
Stars: ✭ 48 (-38.46%)
Mutual labels:  uefi
exynos-usbdl
Unsigned code loader for Exynos BootROM
Stars: ✭ 57 (-26.92%)
Mutual labels:  secure-boot
AiliceOS
AiliceOS: Build an x86_64 and UEFI OS using Rust
Stars: ✭ 59 (-24.36%)
Mutual labels:  uefi
multizone-linux
MultiZone® Security Enclave for Linux
Stars: ✭ 18 (-76.92%)
Mutual labels:  secure-boot
daintree
ARMv8-A/RISC-V kernel (with UEFI bootloader)
Stars: ✭ 32 (-58.97%)
Mutual labels:  uefi
UefiToolsPkg
Various useful utilities for UEFI
Stars: ✭ 87 (+11.54%)
Mutual labels:  uefi
uefi-elf-bootloader
UEFI ELF Bootloader example
Stars: ✭ 40 (-48.72%)
Mutual labels:  uefi

go-uefi

A UEFI library written to interact with Linux efivars. The goal is to provide a Go library to enable application authors to better utilize secure boot and UEFI. This also includes unit-testing to ensure the library is compatible with existing tools, and integration tests to ensure the library is able of deal with future UEFI revisions.

Features

  • Implements most Secure Boot relevant structs as defined in UEFI Spec Version 2.8 Errata A (February 14th 2020).
  • PE/COFF Checksumming.
  • Microsoft Authenticode signing.
  • Working with EFI_SIGNATURE_LIST and EFI_SIGNATURE_DATABASE.
  • Integration tests utilizing vmtest and tianocore.
  • Virtual filesystem support for easier testing.

Examples

Some example can be found under cmd/.

Append signatures to db

package main
import (
	"github.com/foxboron/go-uefi/efi"
	"github.com/foxboron/go-uefi/efi/signature"
	"github.com/foxboron/go-uefi/efi/util"
)

var (
    cert, _ = util.ReadKeyFromFile("signing.key")
    key, _ = util.ReadCertFromFile("signing.cert")
    sigdata = signature.SignatureData{
	    Owner: util.EFIGUID{Data1: 0xc1095e1b, Data2: 0x8a3b, Data3: 0x4cf5, Data4: [8]uint8{0x9d, 0x4a, 0xaf, 0xc7, 0xd7, 0x5d, 0xca, 0x68}},
	    Data:  []uint8{}}
)

func main() {
    db, _ := efi.Getdb()
    db.AppendSignature(signature.CERT_SHA256_GUID, &sigdata)
    buf, _ := efi.SignEFIVariable(key, cert, "db", db.Bytes())
    efi.WriteEFIVariable("db", buf)
}

Sign UEFI binary

package main
import (
	"github.com/foxboron/go-uefi/efi/pecoff"
	"github.com/foxboron/go-uefi/efi/util"
)

var (
	key, _ := util.ReadKeyFromFile("signing.key")
	cert, _ := util.ReadCertFromFile("signing.cert")
)

func main(){
	peFile, _ := os.ReadFile("somefile")
	ctx := pecoff.PECOFFChecksum(peFile)
	sig, _ := pecoff.CreateSignature(ctx, Cert, Key)
	b, _ := pecoff.AppendToBinary(ctx, sig)
	os.WriteFile("somefile.signed", b, 0644)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].